This assignment was given on 07 April 2009. The work is due 14 April 2009.
For this week's assignment, we will compute approximate solutions of the boundary value problem
- a(x) * u''(x) - a'(x) * u'(x) + c(x) * u(x) = f(x)where a(x), c(x) and f(x) are functions that we know, and, at the endpoints:
u(0) = u(1) = 0.
We are going to choose values of a(x), c(x) and f(x) in such a way that the exact answer is always
uexact(x) = x * ( 1 - x ) * exp ( x )
We will be interested in the error between our approximate solution u(x) and the exact solution. Our measure for the error will be simple. If we are using n nodes, then the error will be the maximum of the absolute value of the difference between the exact solution and our approximate values.
That is, we compare our computed values U(i) to the exact solution evaluated at each node X(I):
error = max ( 1 <= I <= N ) | u(i) - uexact ( x(i) ) |
Problem | a(x) | c(x) | f(x) |
---|---|---|---|
1 | a(x) = 1 | c(x) = 0 | f(x) = x * ( x + 3 ) * exp ( x ) |
2 | a(x) = 1 | c(x) = 2 | f(x) = x * ( 5 - x ) * exp ( x ) |
3 | a(x) = 1 | c(x) = 2 * x | f(x) = - x * ( 2 x^2 - 3 x - 3 ) * exp ( x ) |
4 | a(x) = 1 + x^2 | c(x) = 0 | f(x) = ( x + 3 x^2 + 5 x^3 + x^4 ) * exp ( x ) |
Question 1: When we approximate the solution of the boundary value problem, we can expect that the error is roughly proportional to some power of h, the spacing between the nodes. Use the finite element program to solve problem 1.
You can get a copy of the finite element program at http://www.sc.fsu.edu/~burkardt/m_src/fem1d_bvp_linear/fem1d_bvp_linear.m and you can find examples of how to run the program and define the A, C and F functions in http://www.sc.fsu.edu/~burkardt/m_src/fem1d_bvp_linear/fem1d_bvp_linear_test.m
Use a number of nodes n = 11, 101, and 1001, so that h is 1/10, 1/100 and 1/1000. Compute the maximum errors in each solution, and call them E1, E2 and E3.Turn in the following information (five numbers, and no more than 10 words!):
Question 2: You have written a program for the finite difference approximation of solutions to the boundary value problem which used a backward difference to approximate u'(x).
Use your backward difference finite difference program to solve problem 3. Use a number of nodes n = 11, 101, and 1001, so that h is 1/10, 1/100 and 1/1000. Compute the maximum errors in each solution, and call them F1, F2 and F3.
Turn in the following information (five numbers, and no more than 10 words!):
Question 3: You have written a program for the finite difference approximation of solutions to the boundary value problem which used a central difference to approximate u'(x).
Use your central difference finite difference program to solve problem 3. Use a number of nodes n = 11, 101, and 1001, so that h is 1/10, 1/100 and 1/1000. Compute the maximum errors in each solution, and call them G1, G2 and G3.
Turn in the following information (five numbers, and no more than 10 words!):