Message Boards Message Boards

2
|
11007 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Getting Value from Interpolating Function

I solved a system of ordinary differental equations using NDsolve. Their plots look perfect. However, I am unable to extract the values from them at particular values.

sol = NDSolve[{eqR1, eqR2, icR1, icR2, icm}, {R[t], m[t]}, {t, 0, 30*10^(-5)}]
Rbubble = R[t] /. sol
mdot = m[t] /. sol
Plot[{Rbubble/Ro}, {t, 0, 30*10^(-5)}, PlotRange -> Automatic, 
 AxesLabel -> {"Time (in s)", "Bubble Radius"}]
Plot[mdot*4*Pi*Rbubble^2, {t, 0, 30*10^(-5)}, PlotRange -> Automatic, 
 AxesLabel -> {"Time (in s)", "Mass Flux at interface"}]

I am sure the solutions are correct because the plots look right. But I am unable to access Rbubble[0].

Please help!!!

POSTED BY: Raunak Bardia
4 Replies
Posted 9 years ago
POSTED BY: David Keith
Posted 9 years ago

Hi Raunak,

It would be easier to respond if you had included the definitions for the equations. Then I could reproduce the work and display a syntax for doing what you want.

But ---- Rhubble=R[t]/.sol produces an expression in t. When you plot that, Plot substitutes values for t and the plot works fine. But Rhubble is not a function; it is an expression. To evaluate it at t=0, you could use Rhubble/.t->0, which makes the replacement for t.

Alternatively, you could make Rhubble a function by using Rhubble[t_]=R[t]/.sol. Now you would need to plot Rhubble[t], and Rhubble[0] would return a value.

BTW -- I have used the variable names you gave. But it is better to begin user symbols with lower case. This is because Mathematica uses upper case for reserved symbols.

Best,

David

POSTED BY: David Keith
POSTED BY: Raunak Bardia
Posted 9 years ago
POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract