Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 5 ) You will write a Python code that generates and evaluates Newton's Divided Differences polynomials. This code should have two functions, with names
You will write a Python code that generates and evaluates Newton's Divided Differences
polynomials. This code should have two functions, with names and inputs as shown
below. The first function calculates the coefficients and the second define and evaluates
the polynomial. Upload your code to a file named HWQuestionpy
def divideddifferencesnodex: npndarray, nodey: npndarray
npndarray:
Calculates the coefficients of a Newton's Divided Difference
polynomial using
divided differences via the recurrence relation
:param nodex: values for the nodes
:param nodey: values for the nodes
:return: array of coefficients
def newtons polynomial data: npndarray, node : npndarray, coeffs:
npndarray npndarray:
n
Defines and evaluates the Newton's Divided Difference Polynomial
:param data: values of the data on which we will evaluate the
polynomial
:param nodex: values for the nodes
:param coeffs: array of coefficients
return: polynomial evaluated on data
n
a Generate a set of and values using the code below. These will be the nodes. Use
the code you wrote to generate a Newton's Divided Difference polynomial that fits to
these nodes, and evaluate that polynomial for values of between and
Plot this polynomial evaluation and also plot the node points using a scatter plot
Upload this plot to a file named HWQuestionaplot.png
import numpy
b Evaluate this polynomial for the value of What is the result and what is the
absolute error in this result?
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