Docsity

Solved Problem Set 7 | Numerical Methods for Differential Equations | MATH 4820, Assignments of Differential Equations

Toggle sidebar
bg1
Math 4820
D. Schwendeman Problem Set 7
Due:
Monday, 4/12/10
1. Consider the linear BVP
u00 +1
tu0=Q(t),0< t ≤1, u0(0) = 0, u0(1) + αu(1) = β
(a) Show that lim
t→0
1
tu0=u00. (Hint: use L’Hˆopital’s rule.)
(b) Write a code to solve the BVP numerically using the finite-difference scheme
1
h2δ2
tvj+1
2htj
δ0tvj=Q(tj),1
2hδ0tv0= 0,1
2hδ0tvN+αvN=β
with tj=jh,h= 1/N. Note that the finite-difference approximation is singular at tj= 0.
Use the result in part (a) to redefine the approximation of the ODE when tj= 0 (i.e. when
j= 0). Eliminate the ghost values v−1and vN+1 from the resulting equations so that the
linear system is tridiagonal (similar to what was discussed in class).
(c) Use your code to solve the BVP for the case Q(t) = 1 −t2and α=β= 1. Compare the
numerical solution with the exact solution for N= 40, 80 and 160, and verify the method
is second-order accurate. Plot the numerical solution for N= 40 and the exact solution on
the same graph.
2. Consider the nonlinear BVP
u00 −cosh(λu) = 0,−1≤t≤2, u(−1) = 1, u(2) = 3
Note that when λ= 1, the BVP agrees with the one considered in Problem Set 6. A
finite-difference approximation of the BVP is
1
h2δ2
tvj−cosh(λvj) = 0, j = 1,2, . . . , N −1, v0= 1, vN= 3.
For a path-following procedure, a key step is to determine how v= (v0, v1, . . . , vN) changes
with the parameter. Let us consider this step alone (and not the whole path-following
procedure). Write a code to determine vλ, the derivative of vwith respect to λ, when
λ= 1. (Hint: this code should be a minor modification of the one used in Problem Set 6.)
Use N= 60 and plot vλversus tj.
3. Consider the heat equation
ut=kuxx +Q(x, t),0≤x≤L, t ≥0,
with initial condition u(x, 0) = f(x) and Neumann-type boundary conditions ux(0, t) = α(t)
and ux(L, t) = β(t). An explicit finite-difference approximation is
vn+1
j=vn
j+νδ2
xvn
j+ ∆tQ(xj, tn),0≤j≤N, n ≥0
with v0
j=f(xj), δ0xvn
0= 2∆x α(tn), and δ0xvn
N= 2∆x β(tn). Here ν=k∆t/∆x2.
(a) Find Q(x, t), f(x), α(t) and β(t) so that u(x, t) = cos(2t) sin(3x) is an exact solution of
the initial-boundary-value problem (IBVP).
(b) Write a code to solve the IBVP numerically using the finite-difference approximation
above. Test your code using k=L= 1 and the functions found in part (a) so that an exact
solution is known. Compute the error in the numerical solution at t=.2 for N= 40, 80
and 160 with ∆tchosen such that νhas the same value (less that 0.5) for each N. Verify
the rate of convergence for the approximation.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Solved Problem Set 7 | Numerical Methods for Differential Equations | MATH 4820 and more Assignments Differential Equations in PDF only on Docsity!

Math 4820

D. Schwendeman Problem Set 7

Due: Monday, 4/12/

  1. Consider the linear BVP

u′′^ +

t

u′^ = Q(t), 0 < t ≤ 1 , u′(0) = 0, u′(1) + αu(1) = β

(a) Show that lim t→ 0

t

u′^ = u′′. (Hint: use L’Hˆopital’s rule.)

(b) Write a code to solve the BVP numerically using the finite-difference scheme

1 h^2

δ t^2 vj +

2 htj

δ 0 tvj = Q(tj ),

2 h

δ 0 tv 0 = 0,

2 h

δ 0 tvN + αvN = β

with tj = jh, h = 1/N. Note that the finite-difference approximation is singular at tj = 0. Use the result in part (a) to redefine the approximation of the ODE when tj = 0 (i.e. when j = 0). Eliminate the ghost values v− 1 and vN +1 from the resulting equations so that the linear system is tridiagonal (similar to what was discussed in class).

(c) Use your code to solve the BVP for the case Q(t) = 1 − t^2 and α = β = 1. Compare the numerical solution with the exact solution for N = 40, 80 and 160, and verify the method is second-order accurate. Plot the numerical solution for N = 40 and the exact solution on the same graph.

  1. Consider the nonlinear BVP

u′′^ − cosh(λu) = 0, − 1 ≤ t ≤ 2 , u(−1) = 1, u(2) = 3

Note that when λ = 1, the BVP agrees with the one considered in Problem Set 6. A finite-difference approximation of the BVP is

1 h^2

δ^2 t vj − cosh(λvj ) = 0, j = 1, 2 ,... , N − 1 , v 0 = 1, vN = 3.

For a path-following procedure, a key step is to determine how v = (v 0 , v 1 ,... , vN ) changes with the parameter. Let us consider this step alone (and not the whole path-following procedure). Write a code to determine vλ, the derivative of v with respect to λ, when λ = 1. (Hint: this code should be a minor modification of the one used in Problem Set 6.) Use N = 60 and plot vλ versus tj.

  1. Consider the heat equation

ut = kuxx + Q(x, t), 0 ≤ x ≤ L, t ≥ 0 ,

with initial condition u(x, 0) = f (x) and Neumann-type boundary conditions ux(0, t) = α(t) and ux(L, t) = β(t). An explicit finite-difference approximation is

vn j +1= vnj + νδ^2 xvnj + ∆tQ(xj , tn), 0 ≤ j ≤ N, n ≥ 0

with v^0 j = f (xj ), δ 0 xv 0 n = 2∆x α(tn), and δ 0 xvnN = 2∆x β(tn). Here ν = k∆t/∆x^2.

(a) Find Q(x, t), f (x), α(t) and β(t) so that u(x, t) = cos(2t) sin(3x) is an exact solution of the initial-boundary-value problem (IBVP).

(b) Write a code to solve the IBVP numerically using the finite-difference approximation above. Test your code using k = L = 1 and the functions found in part (a) so that an exact solution is known. Compute the error in the numerical solution at t = .2 for N = 40, 80 and 160 with ∆t chosen such that ν has the same value (less that 0.5) for each N. Verify the rate of convergence for the approximation.