1.The purpose of this exercise is to make a file test_ode_FE.py that makes use of the ode_FE function in the file ode_FE.py and automatically verifies the implementation of ode_FE. a) The solution computed by hand in Exercise 8.2 can be used as a reference solution. Make a function test_ode_FE_1()that calls ode_FE to compute three time steps in the problem u
= u, u(0) = 1, and compare the three values u1, u2, and u3 with the values obtained in Exercise 8.2. b) The test in a) can be made more general using the fact that if f is linear in u and does not depend on t, i.e., we have u
= ru, for some constant r, the Forward Euler method has a closed form solution as outlined in Sect. 8.2.1: un = U0(1+rΔt)n. Use this result to construct a test function test_ode_FE_2() that runs a number of steps in ode_FE and compares the computed solution with the listed formula for un.
#Sales Offer!| Get upto 25% Off: