# Problem with NDSolve: derivative interpreted as square [duplicate]

I am using Mathematica 9, and trying to solve a very easy differential equation with NDSolve. The code I have is

s=NDSolve[{y'[x]==y[x],y[0]==1},y,{x,0,1}]


but I get the error

NDSolve::dvnoarg: The function y appears with no arguments.


and the output

NDSolve[{(y^2)[x] == y[x], y[0] == 1}, y, {x, 0, 1}]


So it seems like it is interpreting the derivative as a square? How can I get rid of this bug?

(second order derivatives work fine for some reason)

## marked as duplicate by Michael E2, m_goldberg, Bob Hanlon, MarcoB, Yves KlettJul 2 '15 at 6:23

• Clear[y, x]; sol = NDSolve[{y'[x] == y[x], y[0] == 1}, y[x], {x, 0, 1}] !Mathematica graphics – Nasser Jun 29 '15 at 9:18
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – Gordon Coale Jun 29 '15 at 9:26
• @jon: the only answer so far suggested that this might be a formatting issue. It can happen in rare cases (e.g. by accidentially using some unknown keyboard shortcuts) that some of the formatting gets into a state where it is difficult to understand what happens. Could you select the cell which contains the equations and then choose the menu entry Cell -> Show Expression? This will show the plain box expression in the FrontEnd. If you would copy that and put it here as code we could probably understand what has happened... – Albert Retey Jun 29 '15 at 10:20
• The OP has not returned in two days since asking to let us know what's going on. If my answer is correct, in which case quitting and restarting Mathematica would solve the problem, then I think this is a duplicate of q/40314. Alternatively, it could be put on hold as a simple mistake, but I think marking it a duplicate is more likely to help future visitors. If OP returns and clarifies the issue, the question can be reopened. – Michael E2 Jul 1 '15 at 20:15

I can reproduce this behavior like this:

y' = y^2;

s = NDSolve[{y'[x] == y[x], y[0] == 1}, y, {x, 0, 1}]


NDSolve::dvnoarg: The function y appears with no arguments. >>

(*  NDSolve[{(y^2)[x] == y[x], y[0] == 1}, y, {x, 0, 1}]  *)


Executing Clear[y, x] or even ClearAll[y, x] won't work because the problem is stored in the SubValues for Derivative:

SubValues[Derivative]
(*  {HoldPattern[Derivative[1][y]] :> y^2}  *)


(Note that this does not set a value for y'' (i.e. Derivative[2][y]) so "second order derivatives work fine" as the OP observed.)

If we clear Derivative, it will work:

ClearAll[Derivative]
s = NDSolve[{y'[x] == y[x], y[0] == 1}, y, {x, 0, 1}]
(*  {{y->InterpolatingFunction[{{0.,1.}},<>]}}  *)


Alternatively, quitting the kernel is a common way to reset confusing behavior such as this.

If this is the answer (the problem is yet unclear), then these answers address the same issue:

As @halirutan said in one of the answers, this is very tricky to track down.

This seems like a cell/formatting issue. Try using a new notebook.

Btw, om my pc (math 10) your example gives the correct result.

Cheers

• Seems ? Can you expand on this. As it is right now this is more of a comment – Sektor Jun 29 '15 at 9:29
• I wrote "This seems" as I don't have the OP's original notebook to make sure. From the info available at hand: y'[x] turning to (y^2)[x] but the rest y[x] remaining the same, it looks like a formatting issue. Some time the frontend bombs out (I'm sure you have noticed) and things like have been known to happen :) – cheap_slut95 Jun 29 '15 at 9:46