Question: Please do in Python. Compute the second derivative d 2 u d x 2 of the function u = s i n ( x )

Please do in Python. Compute the second derivative d2udx2 of the function u=sin(x) in the domain xin[0,2] for h=0.1,0.05,0.025 and
0.01 using the centered difference scheme:
d2udx2~~uj-1-2uj+uj+1h2,
Plot both the discretized derivatives and the analytic derivative on a single graph. Do not forget to label the axes and the
legend explaining what each line is.
Then, compare the results with the exact solution by calculating the maximum error (i.e., the maximum of the absolute
error) and answer How does the maximum error change with the grid spacing h? Plot the maximum error (y-axis) as a
function of the grid spacing h(x-axis).Do
 Please do in Python. Compute the second derivative d2udx2 of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!