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 have an InterpolatingFunction that I'd like to plot, and I wonder why I have to perform a ReplaceAll on the following function:

Plot[Evaluate[IIz[r, t] /. soln] /. t -> 5, {r, 0, 490}, PlotRange -> {{0, 
 490}, {.000015, -.00035}}, AxesLabel -> Automatic]`

soln is the solution to a differential diffusion equation given by Mathematica (v. 9.0.1) as

{{IIz[r,t]->InterpolatingFunction[{{1.*10^-8,490.5},{0.,10.}},<>][r,t]}}[r, 
 t]}} 

When I plot the 3D solution, there is no problem in using

Plot3D[Evaluate[IIz[r, t] /. soln], {r, 0, 490}, {t, 0, 10}, 
 PlotRange -> 
 {{0, 490}, {0, 10}, {.000015, -.00035}}, 
 AxesLabel -> Automatic] 

and I would think that all I'd need to do to plot this in terms of a fixed t would be to replace t with a constant like so:

Plot[Evaluate[IIz[r, 5] /. soln] , {r, 0, 490}, 
 PlotRange -> {{0, 490}, 
 {.000015, -.00035}}, AxesLabel -> Automatic]`

However, when I input that, I get a blank plot… What gives?

For the original differential equation, see this question.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

It will work as you expect if you get the solution in a form like

IIz ->InterpolatingFunction[...

and not like

IIz[r,t] -> ...

since in the second case you have to have the explicit t, not 5, in order for the match to succeed.

share|improve this answer
    
I didn't even realize that specification was unnecessary… Thank you for the clarification, and as you, say, it works perfectly. Is there any advantage to getting the solution in the original form rather than IIz[r,t]? –  Dustin Wheeler May 24 '13 at 21:26

Your Answer

 
discard

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.