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'm new to Mathematica, and have numerically solved two similar functions with the following code;

a = 5.9336*10^-6; ro = 500*10^-6; Do2 = 2*10^-9; f = 
 2.6835*10^-7; po = 100; 

rl = Sqrt[(6*Do2*f*po)/a];
rn = ro (0.5 - Cos[(ArcCos[1 - (2*rl^2)/(ro^2)] - 2*Pi)/3]);
k = 1*10^-6;

sol = NDSolve[{a*C[r] == (C''[r] + (2/r) C'[r]) (C[r] + k), 
    C[ro] == f*po, C'[rn] == 0}, C, {r, rn, ro}];

solreal = NDSolve[{a == (Creal''[r] + (2/r) Creal'[r]), Creal[ro] == f*po, 
    Creal'[rn] == 0}, Creal, {r, rn, ro}];

Plot[Evaluate[{(C[r]/f) /. sol, (Creal[r]/f) /. solreal} ], {r, rn, 
  ro}, PlotRange -> All]

However, I have TWO problems; one is that even though the functions are increasing along the x-axis, the values of the Y-axis are all displaying the exact same number (100). Any idea why this is?

Secondly, can I some how open the array of values for these functions to look at what they are at specific points?

Sorry if these are obvious questions!

share|improve this question
1  
the y- axis thing is because your functions vary less than what you have assigned as the accuracy of the y-axis. Replace PlotRange->All with PlotRange->{All , {99.999, 100.001}} and you'll see what I mean. As for the function values C[0.00036] /. sol gives you the value of C at 0.00036 and so on. –  gpap Apr 17 '13 at 10:20
    
If you want to know the value at a certain point in the plot just select the plot and press the period key. You get the plot position of your mouse as a tool tip. If you want to have a list of values you could use the Table function. –  Sjoerd C. de Vries Apr 17 '13 at 21:16
add comment

1 Answer

Your values, while increasing, are extremely close to 100 across the entire range you plot:

(C[#]/f) /. sol & /@ {rn, ro} // InputForm
{{99.99999980718516}, {100.00000000198392}}

You may need custom plot Ticks if you wish to distinguish that scale.

You can easily create a table of values using Table or Array. If you want to look inside InterpolatingFunction itself see:

How to splice together several instances of InterpolatingFunction?

share|improve this answer
    
Thank you! I'll get on that now.. –  DRG Apr 17 '13 at 10:20
add comment

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.