Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this differential equation:


And DSolve sucessfully solves it:

sol = DSolve[eq,ψ[r],r];

But when I check by replacing all, in this case it doesn't replace the derivative of the function:


Derivative still must be replaced too. If I do:


Then this gives True.

In other cases Mathematica replaced the function and its derivatives in one shot. What's happening in this case?

share|improve this question
No, it's a different case. Look here:…. This states da if I do like that, it is sufficient to verify my solution. But in this particular case, I have to do an extra substitution. – Giovanni F. Sep 20 '13 at 22:23
Try sol = DSolve[eq, \[Psi], r] instead – Dr. belisarius Sep 20 '13 at 22:58
up vote 3 down vote accepted

When you use DSolve[eq,f,x] you get a rule for the function. When you use DSolve[eq,f[x],x] you get a rule for the function evaluated at value x.

When you use f[x]->blah, Mathematica will replace all occurrences of f[x] but it will leave the occurrences of f'[x] untouched. That happens because you have not defined the function f, so Mathematica does not know that it should create another replacement rule (your D[sol,r]).

When you use f->blah, Mathematica replaces all occurrences of f and that includes not only f[x] but also Derivative[1][f][x] (which is the internal representation of f'[x]).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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