Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

=+j on to staff their operations in the global marketplace.

Answered: 1 week ago