help with this pls
Posted: Fri Jun 10, 2022 11:55 am
help with this pls
Write a function interpolate_function(function, limit, points, int_style) which takes function (a function object), limit (x-axis boundary, float), points (the number of interpolated points, integer) and int style (interpolation style as string), and returns the interpolated points (it is of numpy array type). Note: no visualisation is required. For example: Test print(interpolate function(np.sin, 2 no.pl, 20, "cubic')) print (interpolate_function(np.sin, 2 rp.pi, 15, linear'))
1 import numpy as np 2 from scipy irport interpolate 4-def S 6 7 interpolate_function(function, limit, points, ***doing some interpolation*** x_pts= np.linspace(0, limit, 10) y_pts= function(x_pts) #YOUR CODE GOES HERE
Write a function interpolate_function(function, limit, points, int_style) which takes function (a function object), limit (x-axis boundary, float), points (the number of interpolated points, integer) and int style (interpolation style as string), and returns the interpolated points (it is of numpy array type). Note: no visualisation is required. For example: Test print(interpolate function(np.sin, 2 no.pl, 20, "cubic')) print (interpolate_function(np.sin, 2 rp.pi, 15, linear'))
1 import numpy as np 2 from scipy irport interpolate 4-def S 6 7 interpolate_function(function, limit, points, ***doing some interpolation*** x_pts= np.linspace(0, limit, 10) y_pts= function(x_pts) #YOUR CODE GOES HERE