Difference between revisions of "Physics 212, 2019: Lecture 9"
(Created page with "{{PHYS212-2019}} ==Runge-Kutta 2 integration== ===Scripts for this Lecture=== :: GrowthFunctions -- module defining different growth func...") |
(→Your work) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
==Runge-Kutta 2 integration== | ==Runge-Kutta 2 integration== | ||
+ | How do we solve systems on nonlinear ODEs in the first place? The Euler method, which we introduced before, is good. But how accurate is it? We will talk about <math>O(dt^n)</math> notation, and we will show that the Euler method is <math>O(dt)</math>. We will verify this by using the scripts that I have uploaded below. We will run the simple Euler method of solving differential equations on the malthusian grows problem with different <math>dt</math>, and show by plotting the error at the end that the error goes down in proportion to <math>dt</math>. | ||
+ | We then will talk about Runge-Kutta methods of solving differential equations. I will add additional notes later on, but for now please use these lecture notes http://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node5.html . Additionally, we discussed how RK2 method is a prediction-correction method. | ||
+ | |||
+ | ===Your work=== | ||
+ | ;Problem 1: Use a different differential equation from those provided to show that Runge-Kutta 2 has error <math>O(dt^2)</math>, and the scaling of the error is not a scaling due to the equation being solved, but largely due to the methods used to solve it. Do this in a Jupyter notebook. | ||
===Scripts for this Lecture=== | ===Scripts for this Lecture=== | ||
Line 8: | Line 13: | ||
::[[media:Integrators2019.txt | Integrators]] -- module defining different integrators (Euler and Runge-Kutta, which we will use during the next lecture). | ::[[media:Integrators2019.txt | Integrators]] -- module defining different integrators (Euler and Runge-Kutta, which we will use during the next lecture). | ||
::[[media:moduleTwo2019.txt | Module 2]] -- catch-all scripts I used during the class. | ::[[media:moduleTwo2019.txt | Module 2]] -- catch-all scripts I used during the class. | ||
+ | ::[[media:IntegrateODE.txt | Module 2 as a notebook]] -- integration as a notebook. |
Latest revision as of 09:17, 14 February 2019
Back to the main Teaching page.
Back to Physics 212, 2019: Computational Modeling.
Runge-Kutta 2 integration
How do we solve systems on nonlinear ODEs in the first place? The Euler method, which we introduced before, is good. But how accurate is it? We will talk about notation, and we will show that the Euler method is . We will verify this by using the scripts that I have uploaded below. We will run the simple Euler method of solving differential equations on the malthusian grows problem with different , and show by plotting the error at the end that the error goes down in proportion to .
We then will talk about Runge-Kutta methods of solving differential equations. I will add additional notes later on, but for now please use these lecture notes http://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node5.html . Additionally, we discussed how RK2 method is a prediction-correction method.
Your work
- Problem 1
- Use a different differential equation from those provided to show that Runge-Kutta 2 has error , and the scaling of the error is not a scaling due to the equation being solved, but largely due to the methods used to solve it. Do this in a Jupyter notebook.
Scripts for this Lecture
- GrowthFunctions -- module defining different growth functions.
- Integrators -- module defining different integrators (Euler and Runge-Kutta, which we will use during the next lecture).
- Module 2 -- catch-all scripts I used during the class.
- Module 2 as a notebook -- integration as a notebook.