Docsity

Finite Difference Method for Two-Point Boundary Value Problems in Math652 - Prof. Yongchen, Assignments of Mathematics

Toggle sidebar
bg1
Department of Mathematics Colorado State University
Math652 Programming Assignment 1
Consider the two-point boundary value problem
−u00 =f, 0< x < 1.
1. Write programs which approximate the solution of this boundary value problem using finite
difference method for the two choices of fand boundary conditions given by
(a) f=−[2x2+ 2(x−1)2+ 8x(x−1))] and the boundary condition
u(0) = 0,5u(1) + u0(1) = 6,
for which the solution is u=x2(1 −x)2+x.
(b) f= 1 when 0 < x < c and f= 0 when c < x < 1, where c=√2/2. The boundary
condition is u(0) = 0, u(1) = 0. The exact solution is given by u=−x2/2+(c−c2/2)x
for 0 <x<cand c2(1 −x)/2 for c<x<1. In this case the differential equation will
hold true for all 0 < x < 1 except for x < c where fis not defined.
Do this for n= 4,8,16,32,64 uniform subintervals. For each of these values of n, have your
program compute the l∞and l2norms of the error vectors. Using doule precision in your
computation.
2. Now suppose the error Eh≈Chαfor some constant Cand α. Then
Eh1
Eh2≈Chα
1
Chα
2
implies α= ln Eh1
Eh2
/ln h1
h2
.
Determine αfor each two successive values of hfor both boundary value problems and both
types of errors.
3. Plot the exact solutions and numerical solutions.
4. Comment on the relationship of the results your obtained to the error estimates derived in
class. In particular, seince the solution uof part (b) is piecewise polynomial, uand all its
derivatives are continuous for 0 <x<cand c<x<1. Are u, u0and u00 also continuous at
x=c?
Notes: Due Feb 6, 2009. Free to choose computer language.
1

Partial preview of the text

Download Finite Difference Method for Two-Point Boundary Value Problems in Math652 - Prof. Yongchen and more Assignments Mathematics in PDF only on Docsity!

Department of Mathematics Colorado State University

Math652 Programming Assignment 1

Consider the two-point boundary value problem

−u′′^ = f, 0 < x < 1.

  1. Write programs which approximate the solution of this boundary value problem using finite difference method for the two choices of f and boundary conditions given by

(a) f = −[2x^2 + 2(x − 1)^2 + 8x(x − 1))] and the boundary condition

u(0) = 0, 5 u(1) + u′(1) = 6,

for which the solution is u = x^2 (1 − x)^2 + x. (b) f = 1 when 0 < x < c and f = 0 when c < x < 1, where c =

2 /2. The boundary condition is u(0) = 0, u(1) = 0. The exact solution is given by u = −x^2 /2 + (c − c^2 /2)x for 0 < x < c and c^2 (1 − x)/2 for c < x < 1. In this case the differential equation will hold true for all 0 < x < 1 except for x < c where f is not defined.

Do this for n = 4, 8 , 16 , 32 , 64 uniform subintervals. For each of these values of n, have your program compute the l∞ and l 2 norms of the error vectors. Using doule precision in your computation.

  1. Now suppose the error Eh ≈ Chα^ for some constant C and α. Then Eh 1 Eh 2 ≈ Ch

α 1 Chα 2 implies α = ln Eh^1 Eh 2 / ln h^1 h 2

Determine α for each two successive values of h for both boundary value problems and both types of errors.

  1. Plot the exact solutions and numerical solutions.
  2. Comment on the relationship of the results your obtained to the error estimates derived in class. In particular, seince the solution u of part (b) is piecewise polynomial, u and all its derivatives are continuous for 0 < x < c and c < x < 1. Are u, u′^ and u′′^ also continuous at x = c?

Notes: Due Feb 6, 2009. Free to choose computer language.