1
$\begingroup$

I would like to solve a list of equation with NDSolve with each equation having a different StartingStepSize. When I tried naively to use a table in the option NDSolve gave me an error. The only workaround I found is the solution given in this thread. However it would force me to rewrite a lot of my actual code. Does anyone know if it is possible to add a table in the options of NDSolve, or doing something equivalent?

$\endgroup$

1 Answer 1

2
$\begingroup$

You could use Map

step={0.001,0.01,.1}; (* starting stepsize *) 
Map[NDSolve[{x'[t]==-x[t],x[0]==1},x,{t,0,10},StartingStepSize->#]&,step]

which gives you a list of solutions for a given ode with different stepsize!

For a list of odes MapThread[NDSolve[#1, StartingStepSize -> #2] &, {odes, step}] solves your problem.

$\endgroup$
2
  • $\begingroup$ Works like a charm. Thank you! $\endgroup$
    – Free_ion
    Jul 19, 2019 at 14:15
  • $\begingroup$ You're welcome! $\endgroup$ Jul 19, 2019 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.