Question: We are using python In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required

 We are using python In this assignment, you must use variables,

We are using python

In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. For now, you may not use any of the powerful functions available in python modules, with a few exceptions: You may import functions from the math. copy, matplotlib.plot and nump You may NOT use numpy.linalg.lstsq0. You may usefsolve0 and quad0 from scipy, but nothing else. a) Write a program that demonstrates the Least Squares Curve Fitting method. You must write and call at least the following 3 functions def LeastSquares(x,y,power): # which calculates and returns an array containing the coefficients ofthe least squares polynomial def PlotLeastSquares(x,y,power): # which calls LeastSquares, generates datapoints and plots the least squares curve along with the original data. def mainC A main program that uses the data given below to 1. Call LeastSquares to generate and print the coefficients of a linear fit. 2. Call PlotLeastSqares to display a plot for the linear fit 3. Call LeastSquares to generate and print the coefficients of a Cubic fit. 4. Call PlotLeastSqares to display a plot for the Cubic fit 956 1.09 1.332 05 15 .31 46 52 .7 .74 82 y539 378 370 306 242 104 1.17 In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. For now, you may not use any of the powerful functions available in python modules, with a few exceptions: You may import functions from the math. copy, matplotlib.plot and nump You may NOT use numpy.linalg.lstsq0. You may usefsolve0 and quad0 from scipy, but nothing else. a) Write a program that demonstrates the Least Squares Curve Fitting method. You must write and call at least the following 3 functions def LeastSquares(x,y,power): # which calculates and returns an array containing the coefficients ofthe least squares polynomial def PlotLeastSquares(x,y,power): # which calls LeastSquares, generates datapoints and plots the least squares curve along with the original data. def mainC A main program that uses the data given below to 1. Call LeastSquares to generate and print the coefficients of a linear fit. 2. Call PlotLeastSqares to display a plot for the linear fit 3. Call LeastSquares to generate and print the coefficients of a Cubic fit. 4. Call PlotLeastSqares to display a plot for the Cubic fit 956 1.09 1.332 05 15 .31 46 52 .7 .74 82 y539 378 370 306 242 104 1.17

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!