Question: (Python Question) 1a.) On solving u xx = f numerically for x (0, 1) with boundary condition u(0) = 0, u(1) = 1. Write a
(Python Question)
1a.) On solving uxx = f numerically for x (0, 1) with boundary condition u(0) = 0, u(1) = 1.
Write a code to solve it with f(x) = sin(2x) + ex and the domain (0, 1) subdivided into 100 small intervals.
Write a subroutine to solve the equation with the number of intervals (denoted by m), and the right hand side function f(x) as input.
Pick a right hand side function so that you know the exact solution, run the code, calculate the error, and the convergence order by taking m = 10, 20, 40, 80, 160, 320, 640. Plot the error curve (as a function of the number of intervals) in a way that the convergence order is easily visualized.
1b.) Repeat number 2 with the boundary condition changed to u'(0) = 0, u(1) = 1 by adopting the first and then the second order treatment of the Neumann boundary condition at 0.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
