ODE integrations with the midpoint method

Topic: ODE integrations with the midpoint method

In this assignment you’ll implement the midpoint method (also known as RK2) to integrate a differential equation forward in time.

1) Create a file ode.py.

2) What is the analytic solution to the ODE

y'(t) = 0.1 * y(t)

with the boundary condition

y(0) = 1? Write the answer as a comment at the beginning of the file ode.py.

3) Implement the midpoint method in python and integrate the above ODE from t=0 to t=10. Output the value at t=10. Choose a timestep such that error is less than 10% (compare your result to the exact answer from part 2).

3) When you’re done, don’t forget to add the file ode.py to git and commit the changes.

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now