﻿ Computational Physics代写 计算物理代写 - 数学代写, 物理代写

# Computational Physics代写 计算物理代写

2020-08-31 10:40 星期一 所属： 数学代写 浏览：20

## Activities for Meetings 10-11 9, Tues-Thurs 2/26-28/191

Computational Physics代写 Handout Fitting models to data, through the section“Outliers”.Fit to data with unknown  uncertainties.

### Reading Computational Physics代写

• Handout Fitting models to data, through the section“Outliers”.

### In-Class Activities Computational Physics代写

Completing all of the non-starred activities will count as A-level work. To receive credit, these activities must be checked off in class or office hours within three weeks. (by Thurs 3/28, skipping over Spring Break so really four weeks this time.)

##### 1.Polynomial fit to data. Computational Physics代写

Fit the data in the file txt to poly- nomials of various orders, and use the results to decide what model (whatorder polynomial) is justified for fitting this data. For this pur- pose, if you like you can simply copy code from the section “Nonlinear least-squares fitting” in the Fitting models to data handout, or you can use your own code. In any case, be sure to include the parts that print out the parameters with their uncertainties, and χ2.

##### 2.Fit to data with unknown  uncertainties.

The file txt has only two columns (x and y, but not yerr). Make some slight modifications to the program to deal with this kind of data with no uncertainties given. and again fit the data to polynomials of various ordersand decide what order polynomial is justified as a model for the data.Computational Physics代写 Here are the modifications you need to make to the program:

• Since this file does not have σj values, after reading the file create the array sigma (of the same length as the x and y arrays) filled with the value 1.0. Then proceed with the calculation as before.
• It does not make sense to plot these artificial σj = 1 values as error bars, since the data uncertainties might be much different from one. So, instead of an error bar plot you should plot the xj, yj data as points or symbols without error bars.
##### 3.Parameter guesses in nonlinear fits. Computational Physics代写

Redo the 5-parameter (gaus- sian + linear background) fit to the data in txt that is in the Fitting models to data handout (you can cut and paste the program from the handout). Then, change the parameter guesses to all ones and see what happens. This was OK for a linear model like the poly-nomial(which has only one minimum in χ2) but it doesn’t work here. Explore a bit how much the guesses can be changed while still success- fully finding the global minimum in χ2.

##### 4.Addinga

Fit the data in peak4.txt using one additional parameter, so the model is a gaussian plus a quadratic background. Determine whether or not using this additional parameter is justified.

##### 5.Fitasinewave  Computational Physics代写

The data in the file txt is oscillatory. First simply read the data and plot it. Based on the plot, decide on a likely model for the data. Write a program to fit your model to the data.

##### 6.Gaussian vs Lorentzian

(You may want to start by googling the nameof this ) The following two functions both describe peaks of height A and width w centered at x0, with constant additive back- ground B:

The first function fg(x) is the by-now familiar Gaussian peak. The second function fA(x) is called a Lorentzian peak – it occurs naturally in resonant phenomena such as optical transitions of atoms.Computational Physics代写

Fit the data in the two files gl1.txt and gl2.txt to see which type of peak best describes each data set. Note: Since these data sets do not have specified uncertainties, you should not expect to find the reported χ2 = 1. Nevertheless, is does make sense to compare χ2 between the two types of fit to help determine which function fits a data set better.