Question: Using pycharm. Can't use numpy 3. (30 points) Write a function defined as: def interplD(x,xvals, yvals): x: a float or integer xvals: an array of

 Using pycharm. Can't use numpy 3. (30 points) Write a function

Using pycharm. Can't use numpy

3. (30 points) Write a function defined as: def interplD(x,xvals, yvals): x: a float or integer xvals: an array of floats or integers yvals: another array of floats or integers return value: the linearly interpolated value from yvals, based on the location of the x value within xvals. Note: the values in xvals will either be arranged from small to large, or they will be arranged from large to small. The will NOT be arranged randomly. You may NOT assume the x value is bounded between at least one pair of values in xvals. If the value of x cannot be located within xvals, then return the value of None (by saying return No. Do not extrapolate. The above note means that this interpID is different from the one you wrote for homework. To test the function, write and call the following main function: def mainO x1 array = [0.0, 0.1, 0.5, 1.8, 2.3, 4.7, 6.2] x2array = 19.2, 6.5, 4.7, 3.9, 2.2, 1.4, 0.5] yarray = [31, 5.2, 6.9, 4. 1, 3.5, 4.9, 6.4] anterpID(3.1, xlarray, yarray) print(vall) val2 interpID (5.2, x2array, yarray) print(val2) val3 = interp ID (0.3, x2array, x1 array) #this one should fail print(val3) main0 3. (30 points) Write a function defined as: def interplD(x,xvals, yvals): x: a float or integer xvals: an array of floats or integers yvals: another array of floats or integers return value: the linearly interpolated value from yvals, based on the location of the x value within xvals. Note: the values in xvals will either be arranged from small to large, or they will be arranged from large to small. The will NOT be arranged randomly. You may NOT assume the x value is bounded between at least one pair of values in xvals. If the value of x cannot be located within xvals, then return the value of None (by saying return No. Do not extrapolate. The above note means that this interpID is different from the one you wrote for homework. To test the function, write and call the following main function: def mainO x1 array = [0.0, 0.1, 0.5, 1.8, 2.3, 4.7, 6.2] x2array = 19.2, 6.5, 4.7, 3.9, 2.2, 1.4, 0.5] yarray = [31, 5.2, 6.9, 4. 1, 3.5, 4.9, 6.4] anterpID(3.1, xlarray, yarray) print(vall) val2 interpID (5.2, x2array, yarray) print(val2) val3 = interp ID (0.3, x2array, x1 array) #this one should fail print(val3) main0

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!