Math 104C UC Santa Barbara Local Truncation Error Mathematics Problems Please answer all of the problems on an assignment just using a jupyter notebook. Math 104C Homework #2
∗
Instructor: Xu Yang
General Instructions: Please write your homework papers neatly. You need to turn in both
your codes and descriptions on the appropriate runs you made by following Grader’s instructions.
Write your own code, individually. Do not copy codes!
1. Consider the second-order Runge-Kutta method:
U n+1 = U n +
where
(
k
(F1 + F2 )
2
F1 = f (tn , U n )
F2 = f (tn + k, U n + kF1 )
Show the local truncation error of the method is O(k 2 ).
2. Consider the initial value problem
(
u0 (t) = 1 + ut , 1 ≤ t ≤ 2,
u(1) = 2
(a) Solve the exact solution to this initial value problem.
(b) Write a code for the classical Fourth-order Runge-Kutta method and use it to solve the
problem using k = 0.2, 0.1, 0.05, 0.025. Your output should be a table like the following
k
0.2
0.1
0.05
0.025
ek
where ek = max |u(tk ) − U k | and N = k1 .
0≤k≤N
(c) Repeat the same process as in (b) using the second-order Runge-Kutta method given in
Problem 1.
∗
All course materials (class lectures and discussions, handouts, homework assignments, examinations, web materials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the
California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording
lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior
written permission of the instructor.
1
Use the short-hand notation fn = f (tn , U n ) for Problems 3–5.
3. Consider the following two-step method:
3
1
5
3
U n+2 − U n+1 + U n = k( fn+1 − fn )
2
2
4
4
Show the local truncation error is of O(k 2 ).
4. Consider another two-step method:
1
3
U n+2 − 3U n+1 + 2U n = k( fn+1 − fn )
2
2
Show the local truncation error is of O(k 2 ).
5. Consider the initial value problem
(
u0 (t) = u(t),
u(0) = 1.
t ∈ [0, 1]
The exact solution is u(t) = et .
(a). Write a code for solving the model problem using the method in Problem 3 with U 0 = 1
and U 1 = ek . Here k = 0.01 is the time step size. Graph the numerical solution and
exact solution in the same plot.
(b). Repeat the same procedure using the method in Problem 4.
(c). Compare the graph obtained in part (a) and (b). Show the difference that observed.
Can you explain it using zero-stability.
6. Consider the following two-step method:
U n+2 = U n + 2kfn+1 .
Show it is zero-stable.
2
Purchase answer to see full
attachment
LDR 3302-21.01.01-1A24-S1, Organizational Theory and Behavior Unit III Essay Top of Form Bottom of Form…
Chapter 9 What are teratogens? Give 5 examples. Define each of these stages: Germinal, embryonic,…
You are a Financial Analyst that has been appointed to lead a team in the…
You are familiar with the ANA Code of Ethics and have a growing understanding of…
This week’s discussion will focus on management decision-making and control in two companies, American corporation…
Mary Rowlandson felt that the man who eventually came to own her, Quinnapin, was “the…