Transforming Ordinary Differential Equations to A simple Algebraic System Using SciPy (Part 1)

3 years ago
23

We return to solving differential equations back going back to the free fall/parachutist problem from a previous video. We will solve this problem using a finite difference method (Euler’s method) in two ways: First, will we use simple loops. Second, we will transform the system of equations into a sparse matrix representation. In the simple linear case in this video, we can solve for the position and velocity simply by inverting a matrix.

The next video in this series will deal with the nonlinear case which is more challenging to solve via matrix manipulation.

This may seem overkill for such a simple problem, especially given that Scipy comes with its own ODE solver, but we will use a similar method when we move on to partial differential equations. There, we will transform a PDE into a system of ODEs that can be solved with regular ODE solvers.

Edit: There was an error in both the code and the matrix as written out in the notebook. The first row should not have a -1 in it. Instead it should be a zero. It doesn''t make a difference in the result as the initial velocity is zero, but it is technically incorrect. I have fixed this in the notebook on Github.

Original Video: https://youtu.be/XPT3_L13RFM

Github: https://github.com/kpmooney/numerical_methods_youtube/tree/master/free_fall

Tip Jar: https://paypal.me/kpmooney

Loading comments...