Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. You may use
In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. You may use any of the powerful functions available in the standard python modules, including numpy and matplotlib, but you not use anything from scipy See your MAE 3013 equation sheet and textbook for a reminders of the Cubic Spline method. I will have a document and video posted shortly the remind you of what you learned in MAE 3013 about Cubic Splines Write a function defined as: def CubicSpline(x, f, kfirst-0, klast 0, npoints 1001): Purpose: generate cubic spline data for the values given in the x and farrays x: an array of x values, uniformly spaced f. the values for some unknown f(x) at each value given in the x-array kfirst and klast: the slopes at the beginning and end of the spline curve npoints: the number of points in the spline arrays to be returned. return value: a pair of X and Y arrays (of size npoints) containing points on the cubic spline Write a python main function to test your Cubic Spline function. Your program will send the data shown to your CubicSpline) function. It will plot the returned arrays, producing plots very similar to those shown Cubic Spline x np.array ([0,2,4,6]) f-np.array ([4,0,4,80]) kfirst 0 klast-20 60 Cubic Spline 6 x=np . array ( [1.5, 3, 4.5, 6, 7.5, 91) f-np.array ([3.5, 1.5, -2, 6.9, 8.2 ,1.5]) k_first-2 k as -4 4 8 In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. You may use any of the powerful functions available in the standard python modules, including numpy and matplotlib, but you not use anything from scipy See your MAE 3013 equation sheet and textbook for a reminders of the Cubic Spline method. I will have a document and video posted shortly the remind you of what you learned in MAE 3013 about Cubic Splines Write a function defined as: def CubicSpline(x, f, kfirst-0, klast 0, npoints 1001): Purpose: generate cubic spline data for the values given in the x and farrays x: an array of x values, uniformly spaced f. the values for some unknown f(x) at each value given in the x-array kfirst and klast: the slopes at the beginning and end of the spline curve npoints: the number of points in the spline arrays to be returned. return value: a pair of X and Y arrays (of size npoints) containing points on the cubic spline Write a python main function to test your Cubic Spline function. Your program will send the data shown to your CubicSpline) function. It will plot the returned arrays, producing plots very similar to those shown Cubic Spline x np.array ([0,2,4,6]) f-np.array ([4,0,4,80]) kfirst 0 klast-20 60 Cubic Spline 6 x=np . array ( [1.5, 3, 4.5, 6, 7.5, 91) f-np.array ([3.5, 1.5, -2, 6.9, 8.2 ,1.5]) k_first-2 k as -4 4 8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started