Message Boards Message Boards

How do I tune my NDSolve code to start fast, so it can be run hundreds of times?

Posted 3 months ago
3 Replies
POSTED BY: Gareth Russell

This worked great, thank you so much!

Another thing I tried was compiling the interpolated random walks which are coefficients in the differential equations. It seems to make things faster, but in trials with the exact same seed I end up with less triggers on my whenevent code, and I have no idea why that would be--I don't think the compilation should affect the solution at all, but it seems to be doing just that. Any ideas why that might be?

POSTED BY: Kaden Tro

I haven't run your code, but NDSolve is a very high level function that does a large amount of pre-evaluation of the problem before actually integrating, in which it is picking the best method, etc. I notice that you don't specify a method, so you may be triggering that whole process every time you restart. I suggest you experiment with specifying as many of the NDSolve options that you can, but especially the method.

POSTED BY: Gareth Russell
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