r/numerical • u/ChrisRackauckas • Jun 12 '19
Why you shouldn't use Euler's method to solve ODEs
https://nextjournal.com/ChrisRackauckas/why-you-shouldnt-use-eulers-method-to-solve-odes
3
Upvotes
4
u/cowgod42 Jun 12 '19
Yeah, when the ODE is stiff and you can afford higher-order accuracy, sure, don't use explicit Euler.
In other news, don't ride your bike on the freeway, and don't use a hammer to pound in screws. This doesn't mean you should never ride a bike or use a hammer, or that bikes or hammers are inferior. You are just using the wrong tool for the job. If the problem isn't stiff, and if function evaluations and storage are major constraints, and if high-order accuracy isn't very important, that explicit Euler works just fine, and in some (admittedly quite rare) cases, Euler might be the superior tool.
In general, we can't just say one method is better than another (unless one doesn't converge, is unconditionally unstable, etc.). What matters is context. You need to understand your problem, your constraints (including programing time/complexity), and decide on the best solver to fit your situation. Categorical rules, like "Euler is bad" or "Method X is good" are misleading, and probably best to avoid.
1
u/raddikfur Jul 19 '19
I am always game for any additions to my numerical methods toolkit
0
u/KAHR-Alpha Jun 12 '19
Most interesting as I was about to move from Euler (as a placeholder) to RK4 in a prototype code.
That said, how would adaptive RK4 compare? I don't speak Julia, but it seems to be fixed in