Take the 2-minute tour ×

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: reference.wolfram.com/mathematica/howto/…. 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 –  belisarius Sep 20 '13 at 22:58

1 Answer 1

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


