













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Dr. Donald G. Luttermoser East Tennessee State University
Version 4.
Abstract
These class notes are designed for use of the instructor and students of the course PHYS-4007/5007: Computational Physics taught by Dr. Donald Luttermoser at East Tennessee State University.
VI–2 PHYS-4007/5007: Computational Physics
d) Then solving for y, we get
y = y 1 + y^2 −^ y^1 x 2 − x 1 (x − x 1 ) = y 1 + m (x − x 1 ). (VI-2)
e) There may be times where you need a regularly spaced grid of data points (i.e., xj − xi = constant, where j − i =
a) Suppose that the data on either side of the unknown point we are interested in is not following a linear distribution, but instead, is following a curved path. Then a straight line is not the best representation of your data.
b) In such cases, it is better to fit to a polynomial instead of a straight line. This leads us to an interpolation scheme developed by Lagrange.
c) One can fit an (n − 1)-order polynomial,
fi(x) ' a 0 + a 1 x + a 2 x^2 + · · · + an− 1 xn−^1 , (x ' xi)., (VI-3) to n values of the function f (x) evaluated at points xi.
d) The formula is written as the sum of polynomials
f (x) ' f 1 λ 1 (x) + f 2 λ 2 (x) + · · · + fnλn(x) , (VI-4)
Donald G. Luttermoser, ETSU VI–
where λi(x) =
∏n j( 6 =i)=
x − xj xi − xj
x − x 1 xi − x 1
x − x 2 xi − x 2
x − xn xi − xn
and note that (^) ∞ ∑ i=
λi = 1. (VI-6)
e) For 3 points, Eq. (VI-4) provides a second-degree poly- nomial, while for eight points, it gives a seventh-order polynomial. It is easy to see that for 2 points, Lagrange interpolation just reduces to the linear interpolation de- scribed above.
f) The Lagrange interpolation has no constraints that the data be evenly spaced.
g) The difference between the value of the polynomial eval- uated at some x and that of the actual function is equal to the remainder : R ≈ (x − x 1 )(x − x 2 ) · · · (x − xn) n! f (n)(ζ) , (VI-7) where ζ lies somewhere in the interval of interpolation, but is otherwise undetermined.
h) Lagrangian interpolation is typically used to fit only local data, though it can be use to fit the data globally. How- ever, there are better ways to fit nonlinear global data =⇒ polynomial least square fitting (which we are not going to have time to cover in this class).
Donald G. Luttermoser, ETSU VI–
by approximating them from the second derivatives:
f (^) i(3) ' f^
(2) i+1 −^ f^
(2) i xi+1 − xi
i) In practice, it is better to use a cubic spline routine sup- plied by the programming language (e.g., SPLINE in IDL) or math library.
B. Data Fitting: Gaussian Distributions.
b) Physically, it is useful because it seems to describe the distribution of random observations for most experiments.
c) In spectra, it describes the shape of many spectral lines.
VI–6 PHYS-4007/5007: Computational Physics
-3σ -2σ σ 0 σ 2 σ 3 σ x - μ
PG
(x,
μ, σ)
PG (max)
‘μ’
Γ
σ
P.E.
Figure VI–1: The Gaussian distribution function.
tion is defined by
PG(x, μ, σ) =
σ
2 π exp
−^1 2
( (^) x − μ σ
) 2 (^). (VI-13)
a) It is a continuous function describing the probability that from a parent distribution with a mean μ and a standard deviation σ, the value of the random observation would be x.
b) The probability function is properly defined such that the probability dPG(x, μ, σ) that the value of a random ob- servation will fall within the interval dx around x is given by dPG(x, μ, σ) = PG(x, μ, σ) dx. (VI-14)
c) Gaussian distributions are bell shaped and characterized by the full-width-at-half-maximum (FWHM), which is gen- erally called the half-width Γ =⇒ the range of x between
VI–8 PHYS-4007/5007: Computational Physics
b) Often, the shapes of these lines, in either wavelength, fre- quency, or energy space, follow a Gaussian shape.
c) If a spectral line has a rest (also called “lab”) wavelength λ◦, we can describe a line profile, φ(∆λ), such that it is normalized over the entire profile: ∫ (^) +∞ −∞ φ(∆λ)^ d∆λ^ = 1^ ,^ (VI-21) where ∆λ = λ − λ◦ (VI-22) and λ represents the wavelength at a specific point along the profile. i) In practice (i.e., computer programming), one does not carry the integration from −∞ to +∞, but in- stead, just carries the integration across the line profile (i.e., ±(∆λ)max ≈ 3 σ to 5σ).
ii) Also note that
φ(∆λ) d∆λ = −φ(ν) dν , (VI-23)
where ν (= c/λ) is the frequency of the line profile.
d) If an object that is emitting a spectrum is moving with respect to the observer, the “rest” wavelength (i.e., line center) gets shifted via the Doppler effect: ∆λ λ◦
λ − λ◦ λ◦
vr c = z , (VI-24)
Donald G. Luttermoser, ETSU VI–
where here λ is the observed line center, λ◦ is the line center as measured in the lab, vr is the radial velocity of the moving object, c is the speed of light in the vacuum, and z is a parameter called the redshift. i) If a line is redshifted, λ > λ◦ and vr > 0 =⇒ the object is moving away from us.
ii) If a line is blueshifted, λ < λ◦ and vr < 0 =⇒ the object is moving toward us.
iii) Note that Eq. (VI-24) is valid only when vr c (i.e., the motion is nonrelativistic).
e) We also can write a more general expression for the red- shift, z = ∆λ λ◦
√ √^ 1 +^ vr/c 1 − vr/c
where, here, we have included the relativistic (i.e., vr < ∼ c) correction for the Doppler Effect. i) Rewriting this relativistic formula, we can express velocity as a function of redshift: vr c =
(z + 1)^2 − 1 (z + 1)^2 + 1.^ (VI-26)
ii) You will note that there is no way a velocity cal- culated from the relativistic form of the Doppler effect can exceed the of light =⇒ the special theory of relativity is not violated!
f) If an absorption/emission line has a Gaussian distribu- tion, its profile function follows the form
φ(∆λ) =
π ∆λG^ exp
− ∆λ
2 ∆λ^2 G
(^) (VI-27)
Donald G. Luttermoser, ETSU VI–
convolved with the Gaussian of the spectrograph.
c) Spectrographs with ∆λ 1 / 2 < 1 ˚A (1 ˚A = 10−^10 m) are said to be high-resolution or high-dispersion spectrographs.
d) Spectrographs with ∆λ 1 / 2 > 1 ˚A are said to be low- resolution or low-dispersion spectrographs.
e) ∆λ 1 / 2 effectively determines whether two spectral lines separated by ∆λ can be split into individual lines. i) If ∆λ < ∆λ 1 / 2 , the two spectral lines will appear as one in a spectrum.
ii) If ∆λ > ∆λ 1 / 2 , the two spectral lines will appear as two individual lines.
b) As such, Gaussian profiles are often referred to as Doppler broadening of a spectral line.
c) Since the particles are following a Maxwellian distribution in velocity space, they have a Gaussian distribution in wavelength or frequency space, where the Gaussian (or Doppler) width is equal to the thermal Doppler width
∆λG = ∆λD = ∆λth = λ◦
√ 2 kT /mβ c
VI–12 PHYS-4007/5007: Computational Physics
where k = 1. 38062 × 10 −^23 J/K is Boltzmann’s constant, T is the temperature of the gas, c is the speed of light, and mβ is the mass of the radiating particle.
d) As a result of this, one can determine the temperature of a gas by measuring the half-width of a line arising from a gas (after, of course, one has subtracted off the instrument profile).
e) In practice, life isn’t quite this easy as is shown in the Astrophysics course (ASTR-3415).
Result = GAUSSFIT(X, Y [, A] [, ESTIMATES=array] [, NTERMS=integer(3 to 6)])
(Note that the square brackets ‘[ ]’ here means optional parameters.) i) X: An n-element vector of independent variables (data).
ii) Y: A vector of dependent variables (same vector length as X).
VI–14 PHYS-4007/5007: Computational Physics
f (x) = A 0 e−z^2 /^2.
Note that this last value just fits the data to a Gaussian profile.
b) Result = GAUSSINT(X) evaluates the integral of the Gaus- sian probability function and returns the result. The Gaussian integral is defined as:
GAUSSINT(X) ≡
2 π
∫ (^) x −∞ e
−t^2 / (^2) dt.
If X is double precision, the result is double precision, oth- erwise the argument is converted to floating-poin and the result is floating point. The result has the same structure as the input argument, X.
C. Data Fitting: The Method of Least Squares.
b) The data will contain errors in their measurement, as such, we will need to calculate a goodness of fit.
c) Let’s say that y = f (x) in a linear sense, then
y = a 1 + a 2 x , (VI-32)
then, our task is the figure out a 1 (i.e., the y-intercept), a 2 (i.e., the slope), and their uncertainties from the data.
Donald G. Luttermoser, ETSU VI–
Note that some authors use the y = A + Bx notation and others use y = b + mx notation. These, of course, are all the same equation with a 1 = A = b (i.e., y-intercepts) in the three equations and a 2 = B = m (i.e., the slopes).
d) The method of least-squares also is called linear regres- sion.
b) The χ^2 is determined with
χ^2 ≡ ∑N i=
( (^) ∆y i σi
∑N i=
yi^ −^ f^ (xi) σi
2
∑N i=
1 σ i^2 (yi − a 1 − a 2 xi)^2
(^) , (VI-33)
where N represents the total number of data measure- ments.
c) The best fit to the assumed functional dependence will occur when χ^2 is at a minimum: ∂χ^2 ∂am = 0, (m = 1, M), (VI-34)
where M is the maximum number of terms in our poly- nomial fit.
Donald G. Luttermoser, ETSU VI–
∑^ N i=
x^2 i σ i^2
∑N i=
yi σ i^2
∑N i=
xi σ^2 i
∑N i=
xiyi σ^2 i
= SxxSy^ −^ SxSxy ∆
a 2 =
∣∣ ∣∣ ∣∣
∑(1/σ 2 i )^
∑(y ∑ i/σ^ i^2 ) (xi/σ^2 i ) ∑(xiyi/σ^2 i )
∣∣ ∣∣ ∣∣
= 1 ∆
∑^ N i=
σ i^2
∑N i=
xiyi σ^2 i
∑N i=
xi σ^2 i
∑N i=
yi σ^2 i
= SSxy^ −^ SxSy ∆
∣∣ ∣∣ ∣∣
∑(1/σ 2 i )^
∑(x ∑ i/σ^2 i^ ) (xi/σ i^2 ) ∑(x^2 i /σ i^2 )
∣∣ ∣∣ ∣∣
=
∑N i=
σ^2 i
∑N i=
x^2 i σ i^2
∑^ N i=
xi σ i^2
2
= SSxx − S x^2 (VI-41)
b) Note that there also can be uncertainties in our indepen- dent variable xi. i) For example, yi might be displacement measure- ments and xi the times the measurements are made.
ii) Since the time measurement also has an uncer- tainty, σi(xi), we have 2 uncertainties to worry about.
iii) σi(xi) is referred to as the experimental error.
VI–18 PHYS-4007/5007: Computational Physics
c) As such, the σi’s in Eqs. (VI-39) through (VI-41) are the combination of these 2 uncertainties which is found with
σ i^2 = σ i^2 (xi) + σ i^2 (yi). (VI-42)
σ a^21 = Sxx ∆ , σ^2 a 2 =
ρ(a 1 , a 2 ) = cov(a 1 , a 2 ) σa 1 σa 2
cov(a 1 , a 2 ) = −Sx ∆
a) Here cov(a 1 , a 2 ) is the covariance of a 1 and a 2 and vanishes if a 1 and a 2 are independent.
b) The correlation coefficient ρ(a 1 , a 2 ) lies in the range − 1 ≤ ρ ≤ 1. i) Positive ρ indicates that the errors in a 1 and a 2 are likely to have the same sign.
ii) Negative ρ indicate opposite signs.