✍ ️Get Free Writing Help
WhatsApp

WriteMyStudy

compare the three values u1, u2, and u3 with the values obtained in Exercise 8.2.

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, […]

Read Me

find through experimentation the largest value of Δt where the exact solution and the numerical solution by Heun’s method cannot be distinguished visually.

a) A second-order Runge-Kutta method, also known has Heun’s method, is derived in Sect. 8.4.5. Make a function ode_Heun(f, U_0, dt, T) (as a counterpart to ode_FE(f, U_0, dt, T) in ode_FE.py) for solving a scalar ODE problem u = f (u, t), u(0) = U0, t ∈ (0, T ], with this method using a time step size Δt. b) Solve the simple ODE […]

Read Me

Calculate u1, u2, and u3. Check that the numbers are the same as obtained in a)-c).

1.Section 8.2.4 describes a geometric interpretation of the Forward Euler method. This exercise will demonstrate the geometric construction of the solution in detail. Consider the differential equation u = u with u(0) = 1. We use time steps Δt = 1. a) Start at t = 0 and draw a straight line with slope u (0) = u(0) = 1. Go one time step forward […]

Read Me

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.

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. b) The test in a) can be made more general using the fact that if f is linear in u and […]

Read Me

For the case in b), find through experimentation the largest value of Δt where the exact solution and the numerical solution by Heun’s method cannot be distinguished visually.

a) A second-order Runge-Kutta method, also known has Heun’s method, is derived in Sect. 8.4.5. Make a function ode_Heun(f, U_0, dt, T) (as a counterpart to ode_FE(f, U_0, dt, T) in ode_FE.py) for solving a scalar ODE problem u = f (u, t), u(0) = U0, t ∈ (0, T ], with this method using a time step size Δt. b) Solve the simple ODE […]

Read Me

Write up the complete model, implement it, and rerun the case from Sect. 8.3.8 with various choices of parameters to illustrate various effects.

1.In the SIRV model with time-dependent vaccination from Sect. 8.3.9, we want to test the effect of an adaptive vaccination campaign where vaccination is offered 2.We consider the SIRV model from Sect. 8.3.8, but now the effect of vaccination is time-limited. After a characteristic period of time, π, the vaccination is no more effective and individuals are consequently moved from the V to the S […]

Read Me

Consider the file osc_FE.py implementing the Forward Euler method for the oscillating system model (8.43)–(8.44).

1.Consider the file osc_FE.py implementing the Forward Euler method for the oscillating system model (8.43)–(8.44). The osc_FE.py code is what we often refer to as a flat program, meaning that it is just one main program with no functions. Your task is to refactor the code in osc_FE.py according to the specifications below. Refactoring, means to alter the inner structure of the code, while, to […]

Read Me

Add a call to osc_energy in the programs osc_FE.py and osc_EC.py and plot the sum of the kinetic and potential energy.

a) Make a function osc_energy(u, v, omega) for returning the potential and kinetic energy of an oscillating system described by (8.43)–(8.44). The potential energy is taken as 1 2ω2u2 while the kinetic energy is 1 2 v2. (Note that these expressions are not exactly the physical potential and kinetic energy, since these would be 1 2mv2 and 1 2 ku2 for a model mx + […]

Read Me

Find an expression for the Nn in terms of Nn−1 and formulate an algorithm for computing Nn, n = 1, 2,…,Nt .

1.We consider the ODE problem N (t) = rN(t), N(0) = N0. At some time, tn = nΔt, we can approximate the derivative N (tn) by a backward difference, see Fig. 8.22: N (tn) ≈ N(tn) − N(tn − Δt) Δt = Nn − Nn−1 Δt , which leads to Nn − Nn−1 Δt = rNn , called the Backward Euler scheme. a) Find an […]

Read Me

Make plots for comparing the Crank-Nicolson scheme with the Forward and Backward Euler schemes in the same test problem as in Exercise 8.12.

1.It is recommended to do Exercise 8.12 prior to the present one. Here we look at the same population growth model N (t) = rN(t), N(0) = N0. The time derivative N (t) can be approximated by various types of finite differences. Exercise 8.12 considers a backward difference (Fig. 8.22), while Sect. 8.2.2 explained the forward difference (Fig. 8.4). A centered difference is more accurate […]

Read Me
Don`t copy text!