I just started to use Mathematica. I don't manage to use NDSolve. For example, when I write

 s2 = NDSolve[{y[x]^2 = x, y[1] == 1}, y, {x, 0, 30}] 
    Plot[Evaluate[y[x] /. s2], {x, 1, 2}]

It doesn't plot curve on the graph... May it be because of the version ? I'm using 10.3


Thx !

Actually, the equation I'm trying to solve is :

pde = 1/x^2*D[x^2*f[x], x] + 
f[x]*((-2 + 12*f[x]^2)*1/x^2*D[x^2*f[x], x] - 
  1/x^2*D[x^2*D[1/x^2*D[x^2*f[x], x], x], x]) == 0

sol = NDSolve[{pde, f'[0] == 0, f''[1] == 0, f[0] ==1}, 
f, {x, -5, 5}]

But apparently, the last boundary condition is not good since I get in the answer "... True,True,f[0] == 1..." Do you have an idea how I can choose or make the programm choose a better condition ? If I don't write it, it doesn't plot anyting neither...


closed as off-topic by MarcoB, m_goldberg, Carl Woll, bbgodfrey, Lukas Lang May 13 '18 at 10:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Carl Woll, bbgodfrey, Lukas Lang
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ You have several mistakes: First y[x]^2 = x should be y[x]^2 == x. Secondly, you are trying to solve a ODE but actually you have not included a derivative of the function at all! $\endgroup$ – Dimitris May 9 '18 at 10:46
  • $\begingroup$ See mathematica.stackexchange.com/questions/40314/… $\endgroup$ – Michael E2 May 9 '18 at 12:04
  • 1
    $\begingroup$ you should not lump together multiple questions. You see now the first one is answered and the issue with the second one is unrelated. The "True", etc output indicates something has some old definition. Restart your kernel. $\endgroup$ – george2079 May 9 '18 at 16:03

Let'see a correct usage:

s = NDSolve[{y'[x] + y[x]^2 == x, y[0] == 1}, y, {x, 0, 30}] (*assigne the solution, in the form of interpolating function, to the variable s*)

Plot[Evaluate[y[x] /. s], {x, 0, 30}, PlotRange -> All] (*plot the function y[x]*)

As I have already mentioned there are several mistakes in your code: First y[x]^2 = x should be y[x]^2 == x. Secondly, you are trying to solve a ODE but actually you forgot to include a derivative of the function.


Not the answer you're looking for? Browse other questions tagged or ask your own question.