Qaror
The step size (h) goes down by (frac<1><3>) so the error is ( > ight)^<4>=frac<1><81>) of the original error.Exercise 19
You’ve estimated the error of a Forward Euler method on an interval ([0,10]) with (20) time steps. If you increase to (100) time steps, by what factor will the error go down?
Qaror
The step size (h) goes down by (frac<1><5>) so the error is ( left<(frac<1><5>> ight)^<2>=frac<1><25>) of the original error.
Exercise 20
Suppose (x(t)) solves the differential equation (x'=-2tx^2) with initial condition x(1) = 1. Solve the above IVP for x(2) using:
a) Euler method with step size (0.5)
b) Analytically.
Qaror
a) We have (f(t,x)=-2tx^2) . With (x(1)=1) , we have (f(1,1)=-2) so we adjust (x) by ((0.5)cdot(-2)=-1) . Thus we estimate (x(1.5)=0) . Repeat the process, with (f(1.5,0)=0) causing no adjustment. Our estimate is (x(2)=0) .
b) This is a separable equation. It separates to [int frac=int -2tdt ,.] The implicit form of the solution is [frac<-1>=-t^2+c ,.] The explicit form is [x(t)=frac<1> ,.]
We plus in our initial condition, (frac<1><1+c>=1) so (c=0) and our solution is [x(t)=frac<1> ,.] Therefore (x(2)=frac<1><4>) .
Exercise 21
Use the explicit Euler method to plot the estimate (y(2)) if (y(t)) is the solution to (y'=t-y^3) with (y(0)=1) . Use (10) steps, (20) steps, and (30) steps and plot all three.
Qaror
Use the sample code provided in the chapter and add a line to plot the result.
Exercise 22
Use the Explicit Euler and Runge-Kutta methods to estimate (y(2)) if (y(t)) is a solution to (y'=frac<1>) with (y(0)=1) and (10) time steps.
Qaror
Combine the sample codes for Runge-Kutta and Euler Explicit from the chapter notes.
2.4. Implicit Runge-Kutta schemes¶
We have discussed that explicit Runge-Kutta schemes become quite complicated as the order of accuracy increases. Implicit Runge-Kutta methods might appear to be even more of a headache, especially at higher-order of accuracy (p) . We will give a very brief introduction into the subject, so that you get an impression.
Generally speaking, RK methods can be defined as follows:
For explicit RK methods one has (h=s-1) . This implies that any (k_i) can be computed explicitly from the knowledge of the previously computed (k_j) with (jAs an example, let us consider some relatively simple implicit RK scheme - we went on Wikipedia and picked one named Qin and Zhang’s two-stage second-order implicit method. It reads:
Let’s implement it for the problem of a body in free fall described by (20). Make sure you understand the implementation of the implicit scheme in the code1>4>1>1>1>1>25>1>2>5>1>5>1>81>1>4>3>3>1>
Do'stlaringiz bilan baham: |