Starting from:

$30

MATH232-Homework 4 Solved

This problem allows you to code and compare several different methods

Consider the following boundary value problem

                                                               u00 = ex in (0,1),          u(0) = 3,       u0(1) = −5.

It has a Dirichlet boundary condition on x = 0 and a Neumann boundary condition on x = 1.

(a)    Solve this problem analytically.

(b)   Implement a second-order finite difference method to solve this boundary value problem.Verify that your code is second-order accurate.

(c)    Use your second-order finite difference code from part (b) to compute the extrapolationmethod. Verify that your extrapolation method is fourth-order accurate.

(d)   Use your second-order finite difference code from part (b) to compute the deferred correction solution. Verify that your deferrred correction method is fourth-order accurate.

(e)    Modify your code to implement a fourth-order finite difference method to solve thisboundary value problem (you may want to make extensive use of the Matlab code fdcoeffF.m). Verify that your code is fourth-order accurate.

1





(f)     Implement the spectral collocation method on a Chebyshev grid to solve this boundaryvalue problem. You can modify the code SpectralMethod1.m which uses a uniform grid to solve this boundary value problem. Observe that this method is not working well as the number of points increases and then modify this code to use the Chebyshev grid. Verify that your spectral collocation method is now spectrally accurate.

For this problem, plot all of your errors versus m, the number of grid points used, on a single graph to compare them to one another. Then give a discussion on your results. For example, what are the costs and benefits to using one method over another with regards to accuracy and efficiency?

More products