Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

How are derivatives reported on the balance sheet? Why?

Answered: 1 week ago

Question

3. Identify the methods used within each of the three approaches.

Answered: 1 week ago