Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Smart way to deal with NDSolve variable paramet...' topicStudent Support Forum > General > Archives > "Smart way to deal with NDSolve variable paramet..."

Next Comment >Help | Reply To Topic
Author Comment/Response
fpghost
07/24/12 06:19am

Hi,

I'm currently doing something like:

y[a,b,c]:= y./ NDSolve[{eqn[a,b,c], y[0]==init[a,b,c], y'[0]==dinit[a,b,c],y,{r,2,10000}][[1]]

This works and I can get out numeric values for a particular y[a,b,c][r1], but the problem is if I then go to get y[a,b,c][r2] (i.e. feeding the same coefficients (a,b,c) into my differential equation, but wanting a different value of r in the already computed InterpolatingFunction) it does the whole computation of the InterpolatingFunction all over again for the whole 10000 range (which takes a couple of minutes which I can't spare)

There must be a better way to do this given that for the parameters (a,b,c) the InterpolatingFunction has already been constructed once, so I should then be able to just cherry pick diff values of 'r'.


If I just wrote:

f= y./ NDSolve[{eqn[1,2,3], y[0]==init[1,2,3], y'[0]==dinit[1,2,3],y,{r,2,10000}][[1]]

i.e. solving for specific values of parameters (a,b,c)=(1,2,3), then I can access the precomputed interpolating function instantaneously after running once only, i.e. f[10], f[200] at lightening speed.

How should I set this up so I can feed into general parameters (a,b,c) but then be able to accress the InterpolatingFunction for this set with redoing the NDSolve?

thanks

URL: ,

Subject (listing for 'Smart way to deal with NDSolve variable paramet...')
Author Date Posted
Smart way to deal with NDSolve variable paramet... fpghost 07/24/12 06:19am
Re: Smart way to deal with NDSolve variable par... Michael 07/27/12 7:09pm
Re: Re: Smart way to deal with NDSolve variable... fpghost 07/30/12 10:45am
Re: Smart way to deal with NDSolve variable par... fpghost 07/28/12 03:54am
Next Comment >Help | Reply To Topic