# differential equation solution with DSolve

I have a problem for my work, I need to calculate this diff. equation I have,

r =\sqrt[ rinf + (ro - rinf)*E^((n*ϵ)/((1 - gm) (1 - rinf))
(1 - z^(-3 (1 - gm))))*z^(-3 ((gm - gx)/(1 - rinf)))]


And

geff = (gm - gx - ϵ*n*z^(-3 (1 - gm)))*rinf/(1 - rinf) (2/(1 + r) - 1) + gx - n


And the diff. eq. is:

DSolve[{D[ρ[z], z] == -3/z ρ[z]*geff, ρ == ρo}, ρ[z], z]


Mathematica can calculate without adding $gx-n$ to $geff$ ($gx -n$ are the last expressions in $geff$), but when I added $gx-n$ to $geff$ a problem happened and only gives me an integral result, Mathematica can not. Please, anybody?

It is surprising that DSolve cannot solve the ODE, because

int = Integrate[-3/z *geff, z]
(* -(1/(1 + rinf)) rinf (-((n z^(-3 + 3 gm) ϵ)/(-1 + gm)) +
3 (gm - gx) Log[z] + 2 Log[1 + rinf + E^((n (z^3 - z^(3 gm)) ϵ)/((-1 + gm)
(-1 + rinf) z^3)) (-rinf + ro) z^((3 (gm - gx))/(-1 + rinf))]) *)


can be performed, and the solution of the ODE then is simply

s = ρo Exp[int]/Exp[int /. z -> 1]


which can be verified by

Simplify[{D[ρ[z], z] == -3/z ρ[z]*geff, ρ == ρo} /.
ρ -> Function[z, Evaluate@s]]
(* {True, True} *)

• Much more suprising: MMA can solve the generalized problem DSolve[{ \[Rho]'[z]/\[Rho][z] == f'[z] }, \[Rho][z], z] (*{{\[Rho][z] -> E^f[z] C}}*) Sep 12 '18 at 15:24
• Thank you so much @bbgodfrey ... But I apologize because I forgot to put the square root of " r " in the first equation. The correct expression is " r=\sqrt{.....} ". I'm so sorry, can you help me? Sep 14 '18 at 2:02
• @will.al I do not believe that  r=\sqrt{.....} is syntactically correct. Do you mean Sqrt[…..]? In any case, I shall see what I can do. Sep 14 '18 at 2:09
• Hi @bbgodfrey... It is correct, is Sqrt[...]. Thank you. Sep 14 '18 at 2:12
• @will.al I am not optimistic that -3/z *geff can be integrated in general. Do the parameters have any special values, for instance are some of them integers? Sep 14 '18 at 2:36