Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BELLOW IS THE PROGRAM OUTPUT. PLEASE HELP. Write a separate function for each of the following. You may define and call additional functions. Computation of
BELLOW IS THE PROGRAM OUTPUT. PLEASE HELP.
Write a separate function for each of the following. You may define and call additional functions. Computation of divided differences Evaluation of the interpolating polynomial Must use a nested form as discussed in class. Your program must store divided differences in a single dimensional array. All floating point arithmetic will be double precision. Program input: Sequence of x values of data points, x= -8,-6, -4, -2, 0, 2, 4, 6, 8 Sequence of x values to evaluate P(x), x = -8,-7,-6, -5, -4, -3,-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8 Program output (See below for an example.) Divided differences at each iteration Table containing f(x), P(x), \f(x) - P(x) for the 17 data points. . How many data points? 7 Enter X values separated by spaces: -6 -4 -2 0 2 4 6 Divided Differences Iteration: 0 0.0270270270 0.0588235294 0.2000000000 1.0000000000 0.2000000000 0.0588235294 0.0270270270 Iteration: 1 0.0270270270 0.0158982512 0.0705882353 0.4000000000 -0.4000000000 -0.0705882353 -0.0158982512 Iteration: 2 0.0270270270 0.0158982512 0.0136724960 0.0823529412 -0.2000000000 0.0823529412 Iteration: 2 0.0270270270 0.0158982512 0.0136724960 0.0823529412 -0.2000000000 0.0823529412 0.0136724960 Iteration: 3 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0470588235 0.0470588235 -0.0114467409 Iteration: 4 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0117647059 -0.0073131955 Iteration. 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0019077901 -0.0019077901 Iteration: 6 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0019077901 -0.0003179650 How many test values? 13 Enter all X values separated by spaces: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 i Xi f(Xi) | P (Xi) |f(Xi)-P (Xi) | 1 2 3 4 5 6 7 8 9 10 11 12 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.027027027 0.038461538 0.058823529 0.100000000 0.200000000 0.500000000 1.000000000 0.500000000 0.200000000 0.100000000 0.058823529 0.038461538 0.027027027 0.027027027 0.674085851 0.058823529 -0.170429253 0.200000000 0.750397456 1.000000000 0.750397456 0.200000000 -0.170429253 0.058823529 0.674085851 0.027027027 0.000000000 0.635624312 0.000000000 0.270429253 0.000000000 0.250397456 0.000000000 0.250397456 0.000000000 0.270429253 0.000000000 0.635624312 0.000000000 5 6 Write a separate function for each of the following. You may define and call additional functions. Computation of divided differences Evaluation of the interpolating polynomial Must use a nested form as discussed in class. Your program must store divided differences in a single dimensional array. All floating point arithmetic will be double precision. Program input: Sequence of x values of data points, x= -8,-6, -4, -2, 0, 2, 4, 6, 8 Sequence of x values to evaluate P(x), x = -8,-7,-6, -5, -4, -3,-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8 Program output (See below for an example.) Divided differences at each iteration Table containing f(x), P(x), \f(x) - P(x) for the 17 data points. . How many data points? 7 Enter X values separated by spaces: -6 -4 -2 0 2 4 6 Divided Differences Iteration: 0 0.0270270270 0.0588235294 0.2000000000 1.0000000000 0.2000000000 0.0588235294 0.0270270270 Iteration: 1 0.0270270270 0.0158982512 0.0705882353 0.4000000000 -0.4000000000 -0.0705882353 -0.0158982512 Iteration: 2 0.0270270270 0.0158982512 0.0136724960 0.0823529412 -0.2000000000 0.0823529412 Iteration: 2 0.0270270270 0.0158982512 0.0136724960 0.0823529412 -0.2000000000 0.0823529412 0.0136724960 Iteration: 3 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0470588235 0.0470588235 -0.0114467409 Iteration: 4 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0117647059 -0.0073131955 Iteration. 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0019077901 -0.0019077901 Iteration: 6 0.0270270270 0.0158982512 0.0136724960 0.0114467409 -0.0073131955 0.0019077901 -0.0003179650 How many test values? 13 Enter all X values separated by spaces: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 i Xi f(Xi) | P (Xi) |f(Xi)-P (Xi) | 1 2 3 4 5 6 7 8 9 10 11 12 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.027027027 0.038461538 0.058823529 0.100000000 0.200000000 0.500000000 1.000000000 0.500000000 0.200000000 0.100000000 0.058823529 0.038461538 0.027027027 0.027027027 0.674085851 0.058823529 -0.170429253 0.200000000 0.750397456 1.000000000 0.750397456 0.200000000 -0.170429253 0.058823529 0.674085851 0.027027027 0.000000000 0.635624312 0.000000000 0.270429253 0.000000000 0.250397456 0.000000000 0.250397456 0.000000000 0.270429253 0.000000000 0.635624312 0.000000000 5 6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started