Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a python script Exercise 3 : Fitting with more than one parameter ( polynomial ) In the file polynomial _ data.txt you can
I need a python script
Exercise : Fitting with more than one parameter polynomial
In the file polynomialdata.txt you can find measurements of the variable between the range and
a Bin these measurements as a histogram with bins and calculate the uncertainty on the number of measurements in each bin using the Poisson distribution. Plot this histogram with error bars.
b Use the leastsquares method scipy.optimize.curvefit to fit a polynomial of first, second, third and fourth degree to the histogram bins, taking the value to be the centre of each histogram bin and the value to be the number of measurements. Plot the resulting polynomial fits overlaid on the histogram.
c For each fit, calculate the uncertainties on the parameters using the covariance matrix returned by the scipy.optimize.curvefit method.
d Use the optimal fitting parameters to calculate the for the different fits and plot it as a function of the degrees of the polynomial.
e What do you think was the degree of the polynomial used to generate the data?
polynomialdata.txt
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