These two functions make way more sense now but I'm still confused about how I can write a function "newtinterp" out of these two. (Input arguments (x,y,z) where (xi, yi), i = 1,..., n+1, (interpolation data points) and z=(z1, ..., zm)(vectors containing m points on which we want to evaluate the interpolating polynomial)).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

These two functions make way more sense now but I'm still confused about how I can write a function "newtinterp" out of these two. (Input arguments (x,y,z) where (xi, yi), i = 1,..., n+1, (interpolation data points) and z=(z1, ..., zm)(vectors containing m points on which we want to evaluate the interpolating polynomial)).

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I tried to make an estimate of a population with the newtinterp function above but it somehow does not work. Can somebody please tell me what is wrong with my code? 

In [248] import pandas as pd
import matplotlib.pyplot as plt
from scipy. interpolate import CubicSpline
x= [1991, 1996, 2001, 2006, 2011, 2016]
y = [3516000,3762300, 3916200, 4209100, 4399400,4747200]
Z = 0
data = pd.DataFrame({ 'Years': x, 'Population': y })
f = newtinterp(x, y, z)
for x in range (1991, 2017):
print("Population in ",x," is: ", f(x))
[ 3.51600000E+06 4.92600000e+04 -1.84800000e+03
-3.15333333e+01 2.59920000e+00]
TypeError
Input In [248], in <cell line: 11>()
10 f = newtinterp(x, y, z)
11 for x in range (1991, 2017):
---> 12
print("Population in ",x," is: ", f(x))
TypeError: 'numpy. float64' object is not callable
3.08533333e+02
Traceback (most recent call last)
Transcribed Image Text:In [248] import pandas as pd import matplotlib.pyplot as plt from scipy. interpolate import CubicSpline x= [1991, 1996, 2001, 2006, 2011, 2016] y = [3516000,3762300, 3916200, 4209100, 4399400,4747200] Z = 0 data = pd.DataFrame({ 'Years': x, 'Population': y }) f = newtinterp(x, y, z) for x in range (1991, 2017): print("Population in ",x," is: ", f(x)) [ 3.51600000E+06 4.92600000e+04 -1.84800000e+03 -3.15333333e+01 2.59920000e+00] TypeError Input In [248], in <cell line: 11>() 10 f = newtinterp(x, y, z) 11 for x in range (1991, 2017): ---> 12 print("Population in ",x," is: ", f(x)) TypeError: 'numpy. float64' object is not callable 3.08533333e+02 Traceback (most recent call last)
Solution
Bartleby Expert
SEE SOLUTION
Follow-up Question

How can I implement this part of the question in the newtinterp function?

Let
f(x)=
1
1+25x²
−1≤ x ≤ 1.
=
Using the newtinterp compute the interpolating polynomial p € Pn, which in-
terpolates the points (xi, f(xi)), i 1,2,..., n + 1 of a uniform partition of [-1,1] for
n = : 5, 10, 20, 100. Let zi, i = 1,2,..., 201, equi-distributed points of [-1,1]. Plot your
interpolants and comment on the results.
Transcribed Image Text:Let f(x)= 1 1+25x² −1≤ x ≤ 1. = Using the newtinterp compute the interpolating polynomial p € Pn, which in- terpolates the points (xi, f(xi)), i 1,2,..., n + 1 of a uniform partition of [-1,1] for n = : 5, 10, 20, 100. Let zi, i = 1,2,..., 201, equi-distributed points of [-1,1]. Plot your interpolants and comment on the results.
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education