Numerical Methods Qualification Exam Problems and Solutions (University of Maryland)/Jan09 667

From testwiki
Jump to navigation Jump to search

Problem 4

One wants to solve the equation x+lnx=0, whose root is r0.5, using one or more of the following iterative methods


(i) xk+1=lnxk


(ii) xk+1=exk


(iii) xk+1=xk+exk2


Problem 4a

Which of the three methods can be used?

Solution 4a

Methods {ii} and {iii} are appropriate fixed point iterations for x+ln(x)=0


{i} is not a fixed point iteration

To be a suitable fixed point iteration, the range of each iteration must be within the domain of the next iteration. In the case of {i}, xk+1=lnxk can return values in (,), but can only take x-values in (0,).

{ii} and {iii} are fixed point iterations

Let f(x):=ex and g(x):=x+ex2


It is clear that

f:(,)(0,)

and

g:(,)(0,)


Also notice that given domain D=(0,1)


|f(x)f(y)||f(η)||xy| for some ηD

where maxηD|f(η)|=maxηD|ex|1


and


|g(x)g(y)||g(η)||xy| for some ηD

where maxηD|g(η)|=maxηD|12(1ex)|0.316060279


That is, f,g are both contractions.

Problem 4b

Which method should be used?

Solution 4b

For the interval (0,1), {iii} is a better fixed point iteration than {ii} since its Lipschitz constant is smaller.

Problem 4c

Give an even better iterative formula.

Solution 4c

Newton's method gives an iterative formula that has quadratic convergence, compared to {iii}'s linear convergence.

Problem 5

Consider the boundary value problem


{u+eu=00<x<1u(0)=u(1)=0


Discretize the problem with a finite element method using continuous, piecewise linear functions on an equidistant grid. Quadrature is to be done with the trapezoid rule. Write the method in the form


AUh+Fh(Uh)=0


where Uhm denoted by the vector of unknown nodal values of the approximation solutions, A is an m×m matrix whose elements are independent of the discretization parameter h, and Fh:mm is a nonlinear vector-valued function.

Solution 5

Finding the weak form

Let V=H01(0,1):={vH1:v(0)=v(1)=0}.

Multiplying by a test function vV and integrating by parts we obtain

01(uv)dx=01uvdxuv|01=01uvdx

Then the Variational formulation is: Find uV such that

a(u,v)=01uvdx+01euvdx=l(v)=0 for all vV

Define piecewise linear basis functions

Let's consider a partition of the interval [0,1],


τh:0=x0<x1<<xm+1=1.


As our finite element space, we take


Vh={vV:v|[xi1,xi]𝒫1([xi1,xi]),i=1,,m+1,v(0)=v(1)=0}.


For our basis of Vh, we use the hat functions {ϕj}j=1m, i.e., for j=1,2,,m


ϕj(x)={xxj1hfor x[xj1,xj]xj+1xhfor x[xj,xj+1]0otherwise


Therefore,


ϕj(x)={1hfor x[xj1,xj]1hfor x[xj,xj+1]0otherwise


Thus the discrete formulation reads: Find uhVh such that


a(uh,vh)=01uhvhdx+01euhvhdx=0,vhVh.


Since {ϕj}j=1m is a basis for Vh, we have


uh=j=1nuhjϕj.


Then, we obtain the following equivalent discrete problem: Find uh=(uh1,,uhm)t such that


a(uh,ϕi)=j=1muhjxi1xi+1ϕjϕidx+xi1xi+1ej=1muhjϕjϕidx=0 for i=1,,m .

Rewrite problem in matrix form

The equivalent discrete problem for i=1,2,,m


j=1muhjxi1xi+1ϕjϕidx+xi1xi+1ej=1muhjϕjϕidx=0


can be rewritten in matrix form as follows:


[2h1h1h2h1h1h2h]A[uh1uhm]Uh+h[euh1euh2euhm]Fh(Uh)


The first integral can be computed as follows:


01ϕjϕi={2hfor i=j1hfor |ij|=10otherwise


The second integral can be approximated using the trapezoidal rule i.e.


xi1xi+1euhϕi(x)=xi1xieuhϕi(x)+xixi+1euhϕi(x)(euh(xi1)ϕi(xi1)0+euh(xi)ϕi(xi)2)h+(euh(xi)ϕi(xi)+euh(xi+1)ϕi(xi+1)02)h=heuh(xi)ϕi(xi)1=heuh(xi)=hej=1muhjϕj(xi)=heuhi


Notice that the boundary conditions impose that uh0=uh(m+1)=0.

Problem 6

Determine the local order of accuracy and the stability properties of the two-step scheme


xi+23xi+1+2xi=Δt[1312f(ti+2,xi+2)53f(ti+1,xi+1)512f(ti,xi)]


as an approximation for the ODE x(t)=f(t,x). What is its convergence rate?

Solution 6

Local Order of Accuracy

Note that xix(ti). Also, denote the uniform step size Δt as h. Hence,


ti+1=ti+h


ti+2=ti+2h


Therefore, the given equation may be written as


x(ti+2h)3x(ti+h)+2x(ti)h[1312x(ti+2h)53x(ti+h)512x(ti)]


Expand Left Hand Side Using Taylor Expansion

Expanding about ti, we get


Orderx(ti+2h)3x(ti+h)2x(ti)Σ0x(ti)3x(ti)2x(ti)012x(ti)h3x(ti)h0x(ti)h242!x(ti)h232!x(ti)h2012x(ti)h2383!x(ti)h333!x(ti)h3056x(ti)h34𝒪(h4)𝒪(h4)0𝒪(h4)

Expand Right Hand Side Using Taylor Expansion

Also expanding about ti gives


Order1312hx(ti+2h)53hx(ti+h)512hx(ti)Σ0000011312hx(ti)53hx(ti)512hx(ti)1hx(ti)21312(2h)hx(ti)53hhx(ti)012h2x(ti)31312(2h)2hx(ti)253h2hx(ti)2043h3x(ti)4𝒪(h4)𝒪(h4)0𝒪(h4)

Compare Terms to Determine Order

Taking the difference of the left and right hand side Taylor expansions show that the two step equation is of order two since the terms match up to order 2.


xi+23xi+1+2xiΔt[1312f(ti+2,xi+2)53f(ti+1,xi+1)512f(ti,xi)]=𝒪(Δt3)


Notice that the order 3 term on the left hand side differs from the order 3 term on the right hand side. (5643)

Stability Condition

Our two-step equation is stable if the roots of the equation


λ23λ+2=0


Satisfy |λj|1, and if |λj|=1, then it must be a simple root.


Since λ23λ+2=(λ1)(λ2)=0 yields the roots 1 and 2, the two-step equation is not stable.

Convergence

A multi-step method is convergent if and only if it is stable and consistent. Our two-step equation is not stable, hence not guaranteed to converge.

Template:BookCat