Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Reducing large InterpolatingFunction objects' topicStudent Support Forum > General > Archives > "Reducing large InterpolatingFunction objects"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Michael
07/15/13 05:46am

In Response To 'Re: Reducing large InterpolatingFunction objects'
---------
Thank you!

That worked pretty well, I needed to add PlotRange->All otherwise the data after the first out of bounds section was lost.

Here is my final code for reference, which runs DSolve n times for time T, giving me lots of separate interpolation functions. (I am about to rewrite it to output just the one, hopefully)

Do[
sol = NDSolve[eqns, params, {t, T*i, T*(i + 1)}, MaxSteps -> 10^7];
bigOne = Flatten[p1[t] /. sol][[1, 0]];
npts = Dimensions[(List @@ bigOne)[[3]]][[2]];
Print[npts];
output[i] =
Module[{pl =
Plot[Abs[bigOne[t]], {t, T*i, T*(i + 1)},
PlotPoints -> Ceiling[npts/10^4], PlotRange -> All], pts},
Print[pl];
pts = Join[{{T*i, bigOne[T*i]}}(*from boundary conditions*),
Cases[pl, line_Line :> line[[1]], \[Infinity],
1][[1]], {{T*(i + 1), bigOne[T*(i + 1)]}}];
Print[Length[pts], " points"];
Interpolation[pts]];

eqns =(*equations with new boundary conditions*);

Clear[sol];
Clear[bigOne];
, {i, 0, n, 1}];


It sorted my problem in quite an ingenious way, Thanks!


URL: ,

Subject (listing for 'Reducing large InterpolatingFunction objects')
Author Date Posted
Reducing large InterpolatingFunction objects Michael 07/08/13 10:33am
Re: Reducing large InterpolatingFunction objects Peter Pein 07/09/13 01:08am
Re: Re: Reducing large InterpolatingFunction ob... Michael 07/15/13 05:46am
Re: Reducing large InterpolatingFunction objects Bill Simpson 07/09/13 02:17am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic