# How to solve this differential equation with a square root?

I've to solve this differential equation but I don't know how to do it. Someone can help me?

$$\frac{dy}{dx} = \frac{1}{x} \Bigg( -1 - \frac{2a}{\sqrt{a^2 - 3x L f^2 e^{3y}}} \Bigg)$$

where a, L and f are costant.

I've tried to solve it in Mathematica with DSolve in this way:

DSolve[1/x (-1 - (2 a/Sqrt[a^2 - 3 x L f^2 Exp[3 y[x]]])) == y'[x],
y[x], x]


Thanks everyone.

• Is this question about the Mathematica software? If not, this question is better suited for math.stackexchange. If you are asking about the Mathematica software, could you include what you have tried? Commented Mar 30, 2021 at 16:19
• yes it's about Mathematica software and I've tried with DSolve Commented Mar 30, 2021 at 16:23
• Please include what you have already tried with DSolve in your question Commented Mar 30, 2021 at 16:24
• Your DSolve works in 12.2 without providing values to the constants, and gives multiple solutions of the form y[x]->Log[Root[...]] Commented Mar 30, 2021 at 16:32
• a = 1; f = 1; L = 1; DSolve[ 1/x (-1 - (2 a/Sqrt[a^2 - 3 x L f^2 Exp[3 y[x]]])) == y'[x], y[x], x] produces a useless output. Try ParametricNDSolve. Commented Mar 30, 2021 at 16:34

## 2 Answers

Mathematica seems to have problems with Sqrt. "Squaring" gives

ode = ( -(2 a/Sqrt[a^2 - 3 x L f^2 Exp[3 y[x]]]))^2 == (x y'[x] + 1)^2
(*(4 a^2)/(a^2 - 3 E^(3 y[x]) f^2 L x) == (1 + x Derivative[1][y][x])^2*)


DSolveis now able to solve the ode

DSolve[ode, y[x], x][[1]]
(*Solve[(3 (6 Sqrt[a^2 x^2 (a^2 - 3 E^(3 y[x]) f^2 L x)]
ArcTan[Sqrt[-a^2 + 3 E^(3 y[x]) f^2 L x]/(3 a)] -
2 Sqrt[a^2 x^2 (a^2 - 3 E^(3 y[x]) f^2 L x)]
ArcTan[Sqrt[-a^2 + 3 E^(3 y[x]) f^2 L x]/a] +
a x Sqrt[-a^2 +
3 E^(3 y[x]) f^2 L x] (5 Log[x] +
3 Log[8 a^2 + 3 E^(3 y[x]) f^2 L x])))/(16 a x Sqrt[-a^2 +
3 E^(3 y[x]) f^2 L x]) - (3 y[x])/16 == C[1], y[x]]*)


As the Maple result, Mathematica evaluates an implicit equation in y[x]!

• You obtain a non-equivalent ODE by squaring. Commented Mar 31, 2021 at 15:35
• This ode includes all solution branches of the original ode! Commented Mar 31, 2021 at 17:30

As mentioned by flinty in the comment, v12.2 can solve the problem directly, with a Solve::ifun warning generated. If you need the implicit solution as given by Maple, you can:

Trace[
DSolve[1/x (-1 - (2 a/Sqrt[a^2 - 3 x L f^2 Exp[3 y[x]]])) == y'[x], y[x], x],
Solve[_, y[x]], TraceInternal -> True] // Flatten
(*
{HoldForm[
Solve[(3/8)*(3*Log[a - Sqrt[a^2 - 3*E^(3*y[x])*f^2*L*x]] +
2*Log[a + Sqrt[a^2 - 3*E^(3*y[x])*f^2*L*x]] +
3*Log[3*a + Sqrt[a^2 - 3*E^(3*y[x])*f^2*L*x]]) - 3*y[x] == C[1], y[x]]]}
*)