# How can I reduce the solutions returned by DSolve to a real-valued function over the reals?

I am trying to use DSolve in order to solve the following equation:

$$\qquad \rho'' +\Omega^2 \rho -\frac{1}{\rho^3}$$,

where $$\rho=\rho(t)$$ and $$\Omega$$ is a constant. I know that

$$\qquad \rho = \frac{1}{\Omega} \{\frac{A^2}{E^2}\, Cos(\Omega t)^2+\frac{B^2}{E^2}Sin(\Omega t)^2) +2 (\frac{A^2}{E^2}\frac{B^2}{E^2}-\Omega^2)^{1/2} Sin(\Omega t)\,Cos(\Omega t) \}^{1/2}$$

is a solution, but Mathematica does not give me this among the solution.

In particular

DSolve[ {ρ''[t] + Ω^2   ρ[t] - 1/(ρ[t])^3 == 0},  ρ[t], t,
Assumptions -> {Ω ∈ Reals  && t ∈ Reals}]


returns

{
{ρ[t] -> -(Sqrt[E^(-4 I Ω (t + C)) - 4 Ω^2 + 2 E^(-2 I Ω (t + C)) C + C^2]/(2 Sqrt[E^(-2 I Ω (t + C))] Ω))},
{ρ[t] -> Sqrt[E^(-4 I Ω (t + C)) - 4 Ω^2 + 2 E^(-2 I Ω (t + C)) C + C^2]/(2 Sqrt[E^(-2 I Ω (t + C))] Ω)},
{ρ[t] -> -(Sqrt[E^(4 I Ω (t + C)) - 4 Ω^2 + 2 E^(2 I Ω (t + C)) C + C^2]/(2 Sqrt[E^(2 I Ω (t + C))] Ω))},
{ρ[t] -> Sqrt[E^(4 I Ω (t + C)) - 4 Ω^2 + 2 E^(2 I Ω (t + C)) C + C^2]/(2 Sqrt[E^(2 I Ω (t + C))] Ω)}}
}


Note that $$\Omega$$ is real. I I want a real solution for $$\rho$$ too.

Mathematica gives a real solution, not realy obvious!!!

sol = DSolve[{ρ''[t] + Ω^2 ρ[t] - 1/(ρ[t])^3 == 0}, ρ[t], t,Assumptions -> {Ω ∈ Reals && t ∈ Reals}]


simplification by hand in 2 steps:

sol1 = sol // ExpToTrig
sol2=sol1 /. Sin[p_] -> I Sinh[p]

(*{{ρ[t] -> -((√(-4 Ω^2 + C^2 +
2 C Cos[2 Ω (t + C)] +
Cos[4 Ω (t + C)] +
2 C Sinh[2 Ω (t + C)] +
Sinh[4 Ω (t +
C)]))/(2 Ω Sqrt[
Cos[2 Ω (t + C)] +
Sinh[2 Ω (t + C)]]))},
{ρ[t] -> (√(-4 Ω^2 + C^2 +
2 C Cos[2 Ω (t + C)] +
Cos[4 Ω (t + C)] +
2 C Sinh[2 Ω (t + C)] +
Sinh[4 Ω (t + C)]))/(2 Ω Sqrt[
Cos[2 Ω (t + C)] +
Sinh[2 Ω (t + C)]])},
{ρ[t] -> -((√(-4 Ω^2 + C^2 +
2 C Cos[2 Ω (t + C)] +
Cos[4 Ω (t + C)] -
2 C Sinh[2 Ω (t + C)] -
Sinh[4 Ω (t +
C)]))/(2 Ω Sqrt[
Cos[2 Ω (t + C)] -
Sinh[2 Ω (t + C)]]))},
{ρ[t] -> (√(-4 Ω^2 + C^2 +
2 C Cos[2 Ω (t + C)] +
Cos[4 Ω (t + C)] -
2 C Sinh[2 Ω (t + C)] -
Sinh[4 Ω (t + C)]))/(2 Ω Sqrt[
Cos[2 Ω (t + C)] -
Sinh[2 Ω (t + C)]])}}*)

• Ok, but is there a way to tell Mathematica to show me the solution straight in this form? – rob Feb 3 '19 at 17:17
• sol // ExpToTrig /. Sin[p_] -> I Sinh[p]  – Ulrich Neumann Feb 4 '19 at 10:25