# Error entering equation in DSolve

I entered a command incorrectly as follows:

    DSolve[{y'[x]=y[x]},y[x],x]


I am now experiencing:

    DSolve[{y'[x] == y[x]}, y[x], x]


During evaluation of In:= DSolve::deqn: Equation or list of equations expected instead of True in the first argument {True}. >>

(* DSolve[{True},y(x),x] *)


How do I recover from this error. I've tried Clear[y'[x]]. That didn't work.

• Remove[y] will do the trick. – ciao Jan 13 '14 at 6:25
• That worked! Thanks. – David Jan 13 '14 at 6:43
• Related: (373) – Mr.Wizard Jan 13 '14 at 8:09
• @rasher I caution against using Remove here! It will break any definitions that reference y, and it will alter even localized appearances of the Symbol, though the definitions may still work. Try e.g. fn[y_] := Sin[y]; Remove[y]; Definition[fn] – Mr.Wizard Jan 13 '14 at 8:34
• @Mr.Wizard: Good point. Probably gave too quick-n-dirty, emphasis on dirty, solution. – ciao Jan 13 '14 at 8:38

## 2 Answers

It is for situations like this that Unset exists. :-)

After the mistaken Set operation:

y'[x] = "oh dear";

y'[x]

"oh dear"


Merely use:

y'[x] =.


The definition is cleared:

y'[x]

y'[x]


Please see halirutan's answer for an explanation of why ClearAll[y] does not work here.

Very tricky mistake because hard to track down. The problem is that y'[x] parses as

Derivative[y][x]


Therefore, your assignment is not to the symbol y but to the symbol Derivative and since you have multiple call like f[][] it goes into its SubValues:

SubValues[Derivative]
(* {HoldPattern[Derivative[y][x]] :> y[x]} *)


Therefore, evaluate

SubValues[Derivative] = {};


and the sun shines again

DSolve[{y'[x] == y[x]}, y[x], x]
(* {{y[x] -> E^x C}} *)

• If there are any other SubValues defined for Deritative this non-specific clearing will not be appropriate. In version 7 for example there are definitions for InverseLaplaceTransform by default. – Mr.Wizard Jan 13 '14 at 8:37
• @Mr.Wizard Yes, you are of course right. My answer was rather an explanation what happens than the correct way to solve the problem. I upvoted your answer, since Unset is the way to go IMO – halirutan Jan 13 '14 at 17:07
• I added a note to my answer directing readers to yours, because they are complementary. – Mr.Wizard Jan 13 '14 at 17:16
• I just noticed that technically this answer was incorrect. Evaluation of y'[x] is not the issue as one can see with HoldPattern[y'[x]] = "bad"; rather y'[x] parses as Derivative[y][x], as seen with HoldForm @ FullForm[y'[x]]. I am editing this answer accordingly. – Mr.Wizard May 1 '16 at 17:39