Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Curious minds want to know: I am solving a simple (linear) ode for a number of various parameters. When I use Odesolve, passing the various parameters, it runs relatively slowly compared with using Rkadapt passing the parameters via the initial conditions (since I have a lot of cases to look at, using Rkadapt seems the better choice). Why is this? Is it typical?
Solved! Go to Solution.
John Rudnicki wrote:
Curious minds want to know: I am solving a simple (linear) ode for a number of various parameters. When I use Odesolve, passing the various parameters, it runs relatively slowly compared with using Rkadapt passing the parameters via the initial conditions (since I have a lot of cases to look at, using Rkadapt seems the better choice). Why is this? Is it typical?
The way you use the solve block function you force the solve block to be evaluated for every single point which is plotted and that are quite a few.
If you precalculate the odesolve function just once with the parameters needed and use this I guess its equally fast (apart from the effort the odesolve solution has to put into interpolating).
See attached.
John Rudnicki wrote:
Curious minds want to know: I am solving a simple (linear) ode for a number of various parameters. When I use Odesolve, passing the various parameters, it runs relatively slowly compared with using Rkadapt passing the parameters via the initial conditions (since I have a lot of cases to look at, using Rkadapt seems the better choice). Why is this? Is it typical?
The way you use the solve block function you force the solve block to be evaluated for every single point which is plotted and that are quite a few.
If you precalculate the odesolve function just once with the parameters needed and use this I guess its equally fast (apart from the effort the odesolve solution has to put into interpolating).
See attached.
Thanks. That makes sense. And thanks for your help on various other problems and questions. Happy New Year.
John Rudnicki wrote:
Thanks. That makes sense. And thanks for your help on various other problems and questions. Happy New Year.
You are welcome!
The remarkable part is the difference in results, even if you chose "Adaptive" for odesolve. At max more than 2%. Not sure why.
Happy New Year! (6 hours to go 😉