Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1: Analysis of performance of the cubic spline. Prepare a code implementing Lagrange's interpolating polynomial P(x) for function y = f(x) on the

image text in transcribedimage text in transcribed

 

Problem 1: Analysis of performance of the cubic spline. Prepare a code implementing Lagrange's interpolating polynomial P(x) for function y = f(x) on the interval [a, b] using n + 1 equally spaced nodes x0 = a, x1,...,xn = b. Keep the programming so that you can change the function y = f(x), the interval [a, b], and the number of equally spaced interpolation nodes n, easily. Do the programming so that you can graph f(x), P(x) in one figure, and |f(x) P(x) in another figure. Make sure you use plenty of points when you graph so that the graphs appear smooth. Prepare a code implementing the cubic spline S(x) with natural boundary conditions (S" (a) = S" (b) = 0). Keep you programming so that you can change the function y = f(x), the interval [a, b], and the number of equally spaced interpolation nodes n, easily. Do the programming so that you can graph f(x), S(x) in one figure, and f(x) S(x) in another figure. (You can use Algorithm 3.4 on page 142) . For y = cos(8x) on [0, 1] determine experimentally how many in- terpolation nodes are needed to approximate the function within 10-5 using Lagrange interpolation polynomial and the natural cu- bic spline. Plot f(x), P(x), and S(x) and also f(x) = P(x) and |f(x) S(x). Which method requires more nodes to approximate y = cos(8x) within the provided bounds? Does error behaves sim- ilarly or differently for the two methods? Where the largest errors occur in both cases? For yx-x2 on [0, 1] determine experimentally how many in- terpolation nodes are needed to approximate the function within 10-5 using Lagrange interpolation polynomial and the natural cu- bic spline. Plot f(x), P(x), and S(x) and also f(x) = P(x) and |f(x) S(x). If you can not reach the accuracy bounds, explain why. You can also try to use a lower threshold, say 10-2. Which methods requires more nodes to approximate function y = x = x on [0, 1] within the provided bounds? Does error behaves similarly or differently for the two methods? Where the largest errors occur in both cases? cos(8Tx) Compare the properties of error for both examples: y = and y = xx2. Do you observe any similarities or differences in the behavior of error. Describe what happens as the number of nodes is changed from 10 to 20 to 40 to 80 to 160 in both methods? (If you can not use large numbers of nodes, explain why. Can you explain the your observations using approximation theorems for the Lagrange's polynomial and spline interpolation from Chapter 3? Write a report. Include results of your experiments. Please include graphs of f(x), P(x), and S(x) and also |f(x) - P(x)| and |f(x) S(x). You may use tables to summarize properties of error. Include you comments and explanations of observed facts. Attach the code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Overview This problem involves implementing and analyzing two methods of interpolation Lagranges interpolating polynomial and cubic spline interpolation with natural boundary conditions Steps to Achie... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions