Question: Python: 1) Define the Python function f(x) for () above. In numpy arrays named xk and yk sample ()on the interval above with 10 evenly

Python:
1) Define the Python function f(x) for () above. In numpy arrays named xk and yk sample ()on the interval above with 10 evenly spaced points in x. Using xk and yk perform a cubic spline interpolation using the natural spline =0 boundary conditions (may use scipy.interpolate). CubicSpline. Sample with 100 new evaluation points, again evenly spaced, on the same interval, and provide the new values in an array ySpline.
2) Compute the maximum absolute error between ySpline data and the exact function f(x), store in a Python variable maxError1 and print it (error must be positive).
3) Change the cubic spline boundary condition to something more appropriate for this interval and function, obtain a new maximum error in a variable maxError2 and print it.
4) Suggest a different interval [,], of the same length (i.e. =), with reasoning in the comment cell, for which the error will reduce when employing a natural spline with the same f. Resample f on this new interval, again with 10 evenly spaced points, compute the spline with natural boundary conditions, obtain the error and store it in the variable maxError3.
Consider the function f(x)=sin(x),x[/2,/2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
