# differential equations with implicit functions

I have an ordinary differential equation that contains coefficient functions that depend implicitly on the independent variable via an algebraic equation. I am trying to go ahead and use NSolve to solve for that coefficient function, but it doesn't work, even approximately. The problem seems to be in the evaluation of NSolve, but I can't fix it. Anybody knows help?

PP=a^5+a^2 +3w+4

(* 4+a^2+a^5+3 w *)

sol=NDSolve[{f'[w]==(a/.NSolve[PP,a][[1]]),f[0]==0},f,{w,0,3}][[1]]

(*Out[2]= {f->InterpolatingFunction[{{0.,3.}},<>]}*)

f'[0]/. sol

(*Out[3]= -1.13496*)

NSolve[PP/. w->0,a][[1]]

(* Out[4]= {a->-1.43359} *)

-
When I test your code, I get f'[0] = -1.43359, the same as a. (Exactly, in fact. The difference is 0..) – Michael E2 Apr 6 '13 at 23:46
What do you mean when you say it doesn't work? NDSolve seems to give an answer. Is it not the correct one? If yes what is the correct one? – Spawn1701D Apr 6 '13 at 23:49
what I meant was that f'[0] is not equal to a. The result I'm getting in fact has f' constant, whereas obviously a does depend on w. So if Michael is right, this means I have a bug in my system?? – Johannes Apr 7 '13 at 2:35
I've also tried what's called "defining numerical values" in the Mathematica manual. That does give the correct answer, however I'm now struggling to increase the precision. Maybe it's another bug? The thing that won't do is create an interpolating function for a[w], again because I need to be able to go to very high precision, and interpolation is too crude. – Johannes Apr 7 '13 at 2:39
I can reproduce your (wrong) result on v8.0.4. I get the right result on v9.0.0 and v9.0.1. I guess it's a bug. – Michael E2 Apr 7 '13 at 2:57