Question: Please fix my python code so that interpoly(x,y) works for the following x and y: x=(0.0,0.5,1.0,1.5,2.0,2.5) y=(-2.0,0.5,-2.0,1.0,-0.5,1.0) ------ from scipy import * from pylab import

Please fix my python code so that

interpoly(x,y) works for the following x and y:

x=(0.0,0.5,1.0,1.5,2.0,2.5)

y=(-2.0,0.5,-2.0,1.0,-0.5,1.0)

------

from scipy import *

from pylab import *

from scipy.integrate import quad

import sys

import numpy as np

import matplotlib.pyplot as plt

def matrix(x):

n=[]

N=len(x)

for i in range(N):

temp=[]

for j in range(N+1):

temp.append(x[i]**(N-j))

n.append(temp)

return n

def interpoly(x,y):

c=linalg.solve([matrix(x)],[y])

return c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!