# DSolve and Plot [closed]

I was working on this equation to solve and plot it, but I'm little bit confuse?!

ClearAll["Global*"]
b = 0.7; a = 1.3; k = -0.002; d = 0.25;
sol=DSolve[{(2/3)*x*y[x]*Derivative[1][y][x] + a*y[x]^2 -
Sqrt[3]*d*y[x]*Sqrt[y[x]^2 + k/x^2 - b] + ((a - 2/3)*k)/x^2 - a*b == 0,
y[1] == 1}, y, x]

Plot[y[x]/.sol, {x, 1, 10}]

• Probably xy[x] , ay[x] and dh[x] should be x y[x] ,a y[x] and d h[x]? h[x]isn't defined? Dec 1 '21 at 20:38
• there isn't any h[x] actually only y[x], I did but the solution is not clear!! Dec 1 '21 at 20:44
• Without knowing h[x]  you can't plot the solution! Dec 1 '21 at 20:47
• There's no h[x] at all, please see again Dec 1 '21 at 20:48
• DSolve cannot solve your ODE, so it returns unevaluated. Consequently, y[x] cannot be plotted. Try NDSolve. Dec 2 '21 at 14:19

Ok with the modified question ( no h[x] anymore) Mathematica isn't able to solve the ode analytically ( DSolve).

But numerical solution (NDSolveorNDSolveValue) is possible:

Y = NDSolveValue[{(2/3)*x*y[x]*Derivative[1][y][x] + a*y[x]^2 -Sqrt[3]*d*y[x]*Sqrt[y[x]^2 + k/x^2 - b] + ((a - 2/3)*k)/x^2 -a*b == 0, y[1] == 1}
, y, {x, 1, 10}]

Plot[Y[x], {x, 1, 10}, PlotRange -> {0, 1}]


• I was thinking if I use this parametric plot how should be look like: ParametricNDSolve[{(2/3)*xy[x]*Derivative[1][y][x] + ay[x]^2 - dSqrt[3]*y[x]*Sqrt[y[x]^2 + k/x^2 - b] + (k*(a - 2/3))/ x^2 - ab == 0, y[1] == 1}, y, {x, 1, 10}, {b, k, d, a}] Plot[Evaluate[Table[y[b, k, d, a][x] /. sol, {b, -0.7, -0.69, 0.01}, {k, -0.002, -0.003, -0.001}, {d, 0.2, 0.4, 0.1}, {a, 1, 2, 0.5}]], {x, 1, 10}, PlotRange -> All] Dec 2 '21 at 15:21
• Again don't forget in your differential equation! Try Y = ParametricNDSolveValue[{(2/3)*x y[x]*Derivative[1][y][x] + a y[x]^2 - d Sqrt[3]*y[x]*Sqrt[y[x]^2 + k/x^2 - b] + (k*(a - 2/3))/x^2 - a b == 0, y[1] == 1}, y, {x, 1, 10}, {b, k, d, a}] Dec 2 '21 at 15:44
• ...and try Plot[Table[ Y[b, k, d, a][x] , {b, -0.7, -0.69, 0.01}, {k, -0.002, -0.003, -0.001}, {d, 0.2, 0.4, 0.1}, {a, 1, 2, 0.5}] , {x, 1, 10}, PlotRange -> All]` Dec 2 '21 at 15:47
• I did this but it is not running!! Dec 2 '21 at 15:56
• IAgain I checked my code and it runs (MMA v12.2) Dec 2 '21 at 16:06