Question: Computational physics to be done in python please Question 1: Linear Regression (Computational) Write a general linear regression code that can take up to 3

Computational physics to be done in python please  Computational physics to be done in python please Question 1: Linear

Question 1: Linear Regression (Computational) Write a general linear regression code that can take up to 3 fitting parameters, (a0, a1 and a2). The functions fo, f1 and f2 that multiply these parameters are to be specified by the user. Your code should output the best values of the a's, as well as the associated covariance matrix. For your code, you can make use of the known matrix inversion formulas for 2x2 and 3x3 matrices. The code would read in a file containing data in three columns: x, . y, and Discuss the outline and design of your code. Apply your code to the following cases. Fitting Heat Flow The following table gives the temperature T along a metal rod whose ends are kept at fixed constant temperatures. The temperature is measured as a function of the distance x along the rod Temperature 14.6 18.5 36.6 30.859.260 6279499.9 Position 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 cm Because you are not given errors for each measurement, assume that the least-significant digit figure in T has been rounded off, and thus 0.05 . Neglect errors in x. a) b) c) Evaluate the goodness of fit using graphical techniques as well as the Use your code to compute a least-squares straight-line fit to the data (M#2) as well as a quadratic fit (1-3). Compute the covariance matrices for each fit. statistic, and discuss your findings

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!