

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: White; Class: Computational Mathematics: Models, Methods and Analysis; Subject: Mathematics; University: North Carolina State University; Term: Fall 2004;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


MA402, Homework # Due Thursday, October 4, 2001
function [y1,y1,y3,y4,y5] = my_test(x,n) y1 = 1; y2=1; y3=1; y4=1; y5=1; for i=1:n y1 = y1i; y2=y2(-x); y3=y3*y3; y4 = y4 + y2/y1; y5 = y5 + y3/y1; end
Answer the following question:
(a) What are the inputs and outputs of the Matlab function? (b) Write down the equivalent mathematical expressions for all the outputs? (c) Verify your expression for x = 2 and n = 5 by running the code and checking with your mathematical expressions, see use a calculator.
(a) x = (3, − 4 , 0 , 3 /2)T^. (b) x = (sin k, cos k, 2 k)T^ for a fixed positive integer k.
(c) A =
. Evaluate ‖A‖ 1 , and ‖A‖∞ only.
ut = f + βuxx − aux − cu, 0 < x < 1 , u(x, 0) = sin(πx), initial condition, u(0, t) = 0 , u(1, t) = 0, boundary condition, f (x, t) = e−t^
− sin(πx) + aπ cos(πx) + c sin(πx) + βπ^2 sin(πx)
(a) Show that u(x, t) = e−t^ sin(πx) is a solution. That is: (1) it satisfies the differential equation (verify the left hand side equals the right hand side); (2) it satisfies the initial condition; (3) it satisfies the boundary condition.
(b) Formulate a finite difference scheme to solve the problem (use the central finite differ- ence for spatial variable, and forward finite difference for time variable). (c) Write down the matrix-vector form (uk+1^ = Auk^ +bk) of your finite difference equation. (d) Is there a steady state solution? If so, write down the differential equation for the steady state solution, and the linear system of equations of for the discrete steady state solution of the form Bu∗^ = b. (e) Test and debug your code (you can start with heatc.m) with β = 1, a = 1, and c = 1, tf inal = 1, and ∆t = h^2 /(2. 5 β). Compare with you results with the exact solution using 2-norm and fill-in the following table.
m error ‖em‖ 2 ratio (‖em‖ 2 /‖e 2 m‖ 2 ) 10 N/A 20 40 80 160
Table 1: Grid refinement analysis of the finite difference method. The order of convergence is about 2 meaning ‖e‖ 2 = O(h^2 ) since the ratio approach to 4.
Plot the solution for m = 80.
(f) Now fix β = 1, c = 1, tf inal = 1, and m = 50. Run you code with a = 10, a = 100, a = 1000, a = 10000, a = 100000. Did you observe anything? (g) Extra credit: Can you propose a different finite difference that may work better when a is large?