## Transcribed Text

1. Find the explicit form for the iteration matrix I − Q−1A in the Gauss-Seidel method
when
A =
2 −1
−1 2 −1
.
.
.
.
.
.
.
.
.
−1 2 −1
−1 2
2. Let A be positive denite, and let b a xed vector. For any x, the residual vector is
r = b − Ax, and the error vector is e = A−1
b − x. Show that the inner product of the
error vector with the residual vector is positive unless Ax = b.
3. An integral equation is an equation involving an unknown function with an argumentation. For example, here is a typical integral equation
x(t) = Z t
0
cos(s + x(s))ds + e
0
By dierentiating this integral equation, obtain an equivalent initial-value problem for
the unknown function.
4. Prove that when the fourth-order Runge-Kutta method is applied to the problem
x
0 = λx, the formula for advancing this solution will be
x(t + h) = [1 + hλ +
1
2
h
2λ
2 +
1
6
h
3λ
3 +
1
24
h
4λ
4
]x(t).
5. Let θ ∈ [0, 1] be a constant, and denote tn+θ = (1 − θ)tn + θtn+1. Consider the
generalized midpoint method
xn+1 = xn + hf(tn+θ,(1 − θ)xn + θxn+1)
Show that the method is absolutely stable when θ ∈ [1/2, 1].
6. The partial dierential equation
∂
2u
∂x2
+
∂
2u
∂y2
+ a(x, y)u = f(x, y)
is called a Helmholtz equation. When the coecient function a(x, y) = 0 it is reduced to
the Poisson equation. Consider the special case of a nonpositive constant coecient a,
and the corresponding boundary value problem
∂
2u
∂x2
+
∂
2u
∂y2
+ au = f(x, y), 0 < x, y < 1
u(x, y) = g(x, y), x = 0, or1, or y = 0 or 1
Derive a dierence scheme to solve this boundary value problem. Implement the scheme
in Matlab and use it solve the problem with a = −2, g(x, y) = 0, and
f(x, y) = xy[(x
2 − 7)(1 − y
2
) + (1 − x
2
)(y
2 − 7)]
1
7. Write a Matlab function that implements the Crank-Nicolson method for the problem
ut = uxx = f(x) 0 < x < L, t > 0
u(x, 0) = g(x), 0 < x < L
u(0, t) = u(L, t) = 0, t > 0
Test your function on the problem with the following data: L = 1, f(x) = 0, g(x) =
sin(πx). Compare the numerical solution to the exact solution u(x, t) = e
−π
2
t
sin(πx).

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.

Problem 6

function [u,telapsed ] = P6(n,to_plot)

% INPUTS

% n is the number of points to use, usually a power of 2

% to_plot --indicates if you want to see plots (1) or none (0)

% OUTPUTS

% solution u

% telapsed -- elapsed time.

rv=[];

iter=0;

if nargin < 1

n=16;

end

if nargin < 2

to_plot = 0;

end

G = numgrid('S',n+1);

A = delsq(G);

%make f vector and exact solutions

x=linspace(0,1,n+1);

y=linspace(0,1,n+1);

h=x(2)-x(1);

%modify A

a=-2;

A=A-a*h^2*speye(size(A));

[X,Y]=meshgrid(x,y);

f_large=X.*Y.*((X.^2-7).*(1-Y.^2) + (1-X.^2).*(Y.^2-7));

f=f_large(2:end-1,2:end-1);

f_vec=-h^2*reshape(f,(n-1)*(n-1),1);...