0
$\begingroup$

I have an equation like this which I need to solve analytically. However, Mathematica seems to only accept f'[x] notation, which does not let me put any variables inside the derivative. See the equation to understand what I mean. How do I insert the fraction within the derivative, in front of the $dx/dz$ term? Here, $a, b, c, x_0$ are just constants.

$$ \frac{d}{d z}\left( \frac{1}{1-\frac{x}{a}(2-b)} \frac{d x}{d z}\right)=0, \qquad x(0)=x_{0}, \qquad x^{\prime}(\ell)=-c \cdot x(\ell)^{n}, \qquad z\in [0,\ell] $$

My attempt so far is this, which may be giving the right answer but is giving me imaginary numbers and whatnot, which are wrong. Can I specify b to not be 2 or be 2 and solve separately? Let me know if posting the final answer will help. A bit long to type up but I can if needed.

eq = D[1/(1 - x[z]/a*(2 - b))*x'[z], z] == 0;
bc1 = x[0] == x0;
bc2 = x'[l] == -c*(x[l])^n;

aSol = x[z] /. DSolve[{eq, bc1, bc2}, x[z], z][[1]][[1]]
$\endgroup$
  • $\begingroup$ Try DSolveValue[{eq, bc1, bc2}, x , z] $\endgroup$ – Ulrich Neumann Mar 18 at 8:07
  • $\begingroup$ If I do that, I just get worse, ReplaceAll::reps: {z} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. $\endgroup$ – Zack Fair Mar 18 at 8:09
  • $\begingroup$ Try to restart your MMA session! $\endgroup$ – Ulrich Neumann Mar 18 at 9:28
1
$\begingroup$

Try

DSolveValue[{eq, bc1, bc2}, x , z]
(*Function[{z}, -1/(-2 + b)E^(-((I b z (\[Pi] - I Log[1 - 2/(2 - b) + b/(2 - b)] + ...*)

which returns a pure function for the solution of DSolve

Alternativly you could use ParametricNDSolve.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.