Question: Consider the recursion formula: with n = 0,, 1000, h= 1/1000, and a = -0.5. Create a list u. Store in its first three

Consider the recursion formula:

U=U+ha  

with n = 0,…, 1000, h= 1/1000, and a = -0.5. Create a list u. Store in its first three elements e 0 , e ha, and e 2ha 1. . These represent the starting values u0, u1, and u2 in the given formula. Build up the complete list from the recursion formula.

2. Construct a second list, td, in which you store the values nh, with n = 0, …, 1000. Plot td versus u (refer section Basic plotting in Chapter 6, Plotting, for more information). Make a second plot in which you plot the difference, that is, |eat, – un|, where tn represents the values inside the vector td. Set axis labels and a title. The recursion is a multistep formula to solve the differential equation u' = au with the initial value u(0) = u0 = 1. un approximates u(nh) = eanhu0.



U=U+ha

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!