Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implementation: Two Component Spline 10 points Piecewise polynomials are a conve

ID: 3790089 • Letter: I

Question

Implementation: Two Component Spline 10 points Piecewise polynomials are a convenient way to interpolate large data sets. In this problem we will use a two-piece polynomial to interpolate two adjacent sets of points You are given n points and observed function values in the domain interval x E (0,1] (ncluding 0, 1) and n points in the domain interval x E [1,2] (ncluding 1,2), so there are 2n -1 distinct points overall. Your inputs will be two numpy arrays, arr1 and arr2 of shape (n, 2) and (n, 2) respectively. Each row corresponds to the coordinates (x, y) of a point (node and function value in the dataset. The last rowof arr1 is the same as the first row of arr2 Your task is to interpolate these with polynomials of degrees n 1 and n respectively, i.e., set up the corresponding Vandermonde system and solve for the coefficients. We could obtain a continuous piecewise interpolant through the 2n 1 points by constructing the two interpolant pieces independently to be polynomials with degree n-1. However, a more meaningful piecewise interpolant can be obtained by ensuring the two pieces have the same derivative at the shared point x 1. To achieve this, after computing the first piece of the interpolant, we can compute the second piece with a modified Vandermonde system, which includes an equation for the derivative at x l Specifically, your code should have the following steps: Setup a n-by-n Vandermonde matrix and compute the coefficients of the first interpolant piece (i.e. the (n -1)-degree polynomial, using the (x, y)-pairs in arr1 Compute the derivative of the first interpolant piece at x 1, we'll call this d. Setup and solve the following (n 1)-by-(n 1) modified Vandermonde system, to compute the coefficients ao an of the second interpolant piece, 0 2x, 3x2 1 x yn 1 x where (xi, yi), ...,(xn,yn) are rows of arr2 and also x 1. Note that the first row ensure the derivative of the second interpolant piece is d at x 3 l

Explanation / Answer

The solution of an n×n Vandermonde matrix equation requires O(n2) operations.

For the above eqn we can write the determinant of the system of equation -

0+a1+2x1a1+3x1^2a2+....... = d

and same on for the other equations.

we can solve using it.