Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I dont know how to replace the paremeter inside of an interpolation function result from NDSolve by a function of another parameter.

This is it:

I have a function h[r_,f1[k],f2[k],f3[k],k]:= defined.

Then using `NDSolve like here

sol = NDSolve[ k D[ f1[k], k] == F[ f2[k], f3[k]],
               k D[ f2[k], k] == F[ f1[k], f3[k]],
               k D[ f3[k], k] == F[ f1[k], f2[k]], 
               f1[1] == 1, f2[1] == 1, f3[1] == 1, 
               { f1[k], f2[k], f3[k]}, { k, kmin, kmax}];

After this, I have a function defined by

k[r] = Interpolation[ Table[{ r, NIntegrate[ g[R], { R, 0, r}]},
                            { r, rmin, rmax, rstep}]];

If I do the plot of k[r] I dont have any problem, the same for the plot for the solution of NDSolve.

Plot[{ Evaluate[ f1[k] /. sol]}, { k, kmin, kmax}]

That I want its the next, replace the solution for the NDSolve in the original function h[ r, ...] and the function k[r] inside the interpotation function of the NDSolve, someting like this

Plot[ h[ r, Evaluate[ Evaluate[ f1[k] /. sol]/. k -> k[r]]], 
      k[r], Evaluate[ Evaluate[ f2[k] /. sol]/. k -> k[r]], 
      Evaluate[ Evaluate[ f3[k] /. sol]/. k -> k[r]]], { r, rmin, rmax}]

But this doesn´t yield any result, the graphic is empty.

Any ideas?

share|improve this question
It would be helpful if you show all the code to reproduce this. –  user21 Jul 22 '14 at 15:11

Your Answer


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

Browse other questions tagged or ask your own question.