# Analytically solve boundary-value problem with variables appearing inside integrand

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]]

• Try DSolveValue[{eq, bc1, bc2}, x , z] – Ulrich Neumann Mar 18 at 8:07
• 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. – Zack Fair Mar 18 at 8:09
• Try to restart your MMA session! – Ulrich Neumann Mar 18 at 9:28

DSolveValue[{eq, bc1, bc2}, x , z]

which returns a pure function for the solution of DSolve
Alternativly you could use ParametricNDSolve.