Numerically Integrating Differential Equations in Excel and Python: Euler's Method

preview_player
Показать описание
As a prelude to discussing the Runge Kutta algorithm, I’d like to start slightly simpler with the Euler method. We’ll discuss the pros and cons of this method for numerically solving ordinary differential equations (initial value problems) and set up some examples with both first and second order equations in both Python and Excel.

Рекомендации по теме
Комментарии
Автор

14:45 what you're describing here as unstable is simply the fact that explicit euler isn't a symplectic integrator. The 2nd order ODE you solved is an undamped spring mass system. Since it is undamped, its kinetic energy stays constant with time. With Euler's method, the energy actually increases with time due to numerical error in the euler solution, resulting to the drift/instability you're saying. Even the Runge Kutta method by solve_ivp also suffers from that although the drift is less noticeable because it's a higher order method.

But when the 1st order ODE was solved, euler's method didn't deviate much because the solution decays to zero - and so does the euler solution.

Edit: 15:38 this is the symplectic euler method, if I recall it correctly, which is better at conserving energy.

AJ-etvf