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?
Asked
Active
Viewed 105 times
1 Answers
2
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.
Ulrich Neumann
- 53,729
- 2
- 23
- 55
-
Works like a charm. Thank you! – Free_ion Jul 19 '19 at 14:15
-
You're welcome! – Ulrich Neumann Jul 19 '19 at 14:16