fancy math for physics - kbcheney · tools have beautiful and powerful uses in physics and are well...

49
FANCY MATH FOR PHYSICS and other odd items in Electricity and Magnetism [PICTURE] Ken Cheney October 15, 1993 Second Edition Version 1.216 E d A E x x + E y y + E z z x y z or E d A E V

Upload: trinhtruc

Post on 30-Apr-2018

214 views

Category:

Documents


1 download

TRANSCRIPT

FANCY MATH FORPHYSICS

and other odd items in Electricity and Magnetism

[PICTURE]

Ken Cheney

October 15, 1993

Second Edition Version 1.216

⌠⌡ E dA ≈

∂Ex

∂x+

∂Ey

∂y+

∂Ez

∂z

∆x∆y∆z

or

⌠⌡ E dA ≈ ∇ E ∆V

Table of Contents

I. INTRODUCTION ......................................................................................................... 1

II. OPERATORS ETC. ................................................................................................... 3A. Unit Vectors ........................................................................................................... 3B. Dot or Scalar Products, Inner Product for Math Types ........................................ 3C. : The Dell Operator ........................................................................................ 4D. : The Divergence Operator ............................................................................. 5

III. GAUSS’ LAW .......................................................................................................... 7A. Flux and Integrals, Gauss’ Theorem or The Divergence Theorem ....................... 7B. Gauss’ Law ............................................................................................................ 8

IV. E FIELD AND POTENTIAL ................................................................................... 9

V. CROSS PRODUCTS .................................................................................................. 11A. : Cross Product ............................................................................................. 11B. : Divergence ................................................................................................. 11

VI. STOKE’S THEOREM AND AMPERE’S LAW ..................................................... 13

VII. COMBINATIONS OF s ........................................................................................ 15

VIII. COMPLEX NUMBERS ........................................................................................... 17A. ................................................................................................................... 17B. ................................................................................................................... 18C. Magnitudes ............................................................................................................ 19D. Angle Unit Vectors ................................................................................................ 19E. Calculating the Angles For Complex Numbers ..................................................... 19

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC ....................................................... 20A. LRC circuit ............................................................................................................ 20B. "Mass on Spring" equivalent to LRC circuit ......................................................... 21C. Complex Frequencies ............................................................................................ 22D. Critical Damping ................................................................................................... 23

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASSON SPRING ...................................................................................................................... 25

A. Complex Solution for LRC Circuit ....................................................................... 25B. Complex Solution for Mass on Spring .................................................................. 27C. Full Width Half Maximum, Q, and Energy ........................................................... 28

XI. ELECTROMAGNETIC WAVES .............................................................................. 31A. Maxwell’s Equations ............................................................................................. 31B. Traveling Waves .................................................................................................... 31C. A Traveling Wave Solution of Maxwell’s Equations ............................................ 32D. Characteristics of Electromagnetic Waves ............................................................ 34E. Wave Guide - An Application .............................................................................. 37

XII. SERIES APPROXIMATIONS .................................................................................. 39A. Introduction ........................................................................................................... 39B. Taylor Series .......................................................................................................... 39C. Maclaurin’s Series ................................................................................................. 41

∇∇

A B∇ × E

z = re iθ

Cos(iα)

XIII. LEAST SQUARES CURVE FITTING ................................................................... 42A. Introduction ........................................................................................................... 42B. Solution For Linear Equations ............................................................................... 43C. Solution For Non Linear Equations ....................................................................... 45

I. INTRODUCTION

How deep to go in teaching any part of physics is often debated.

A good case can be made for the "less is more" approach where time is taken to explore a fewtopics thoroughly so the student can be confident of their mastery of the subject.

On the other hand, physics, and the math needed to work with physics, are full of tools that arequite strange at first and second sight.

Furthermore, much of the elegance of physical laws is best seen through elegant math, such asvector calculus and complex variables.

My feeling is that there is little harm and a great deal of good in discussing more advancedmethods lightly as we go along.

At the very least when students meet these tools in their math classes they will know that thetools have beautiful and powerful uses in physics and are well worth mastering.

I wouldn’t expect most freshman or sophomores to become skilled, confident users of these tools(in fact I haven’t told enough to make that possible) but I hope they will begin to appreciate theuses that can be made of these ideas.

I have not written a complete text by any means but have simply discussed the topics that I likethat are generally omitted. Where the math or physics is commonly covered I have notmentioned it.

Much of this approach was inspired by the Feynman Lectures. Anyone interested or frustratedshould, of course, consult Feynman himself!

C:\KEN\WP\HANDOUTS\FNCYMATH\FNCYMATH.DOC Ken Cheney 1.216--May 25, 2002

This page is intentionally left blank.

I. INTRODUCTION - 2

II. OPERATORS ETC.

A. Unit VectorsVectors are powerful because they contain all the information about an item in one piece,perhaps magnitude and direction.

However when we must actually do a calculation it is often desirable to separate out themagnitudes in each of the rectangular directions. i.e. the x, y, and z components of themagnitude.

If our original vector is then the decomposed vector is:

respectively carry the direction and [PICTURE]magnitude information about the x componentof .

is called a unit vector. It is in the x directionand has a magnitude of one, hence "unit vector".

on the other hand has no direction but gives

the magnitude of in the x direction.

B. Dot or Scalar Products, Inner Product for Math Types

This comes up in such cases as where the work done can be interpreted as thecomponent of the force along the distance moved times the distance moved.

E

E = iEx + jEy + kEz Equation 1

i and Ex

E

i

Ex

E

A B ≡ | A ||B | cos(θAB) Equation 2

≡ dot or scaler product

θAB ≡ the angle between A and B

Work ≡ F x

II. OPERATORS ETC. - 3

Dot products and unit vectors:

This looks dreadful but "nature" comes to our rescue. Notice from Equation 2:

Therefor all the mixed products (e.g. ) equal zero and all the same (e.g. ) products equal1, finally:

A remarkably elegant result.

A more general approach would be to use Equation 3 as the definition of the scalar or dotproduct but this does not have the physical appeal of Equation 2.

If there are more than three dimensions the x, y, and z subscripts are usually replaced by etc. ThenEquation 3 becomes:

Notice that for every value of there is a value of . This is rather like a function so the idea can be

generalized for functions as:

We won’t use this here but it is a good way of finding out how much functions have in common or forfinding the elements of a series expansion.

C. : The Dell Operator

The operator is defined as:

Sort of a 3D derivative, not the only possibility but the most common.

A B ≡ (iAx + jAy + kAz) (iBx + jBy + kBz)

≡ i iAxBx + i jAxBy + i kAxBz + . . .

i i = 1 × 1 × cos(0) = 1 and i j = 1 × 1 × cos(90°) = 0

i j i i

A B = AxBx + AyBy + AzBz Equation 3

x1,x2,x3,xi

∑i = 1n Axi

Bxi

xi Axi

f(x),g(x)

⌠⌡ f(x)g(x)dx

∇∇

∇ ≡ i∂

∂x+ j

∂∂y

+ k∂∂z

Equation4

II. OPERATORS ETC. - 4

D. : The Divergence OperatorUsing Equations 4 and 5:

Notice that:

1. is a scalar, rather a nice surprise from this maze of vectors. This is not the onlyway to take derivatives of a vector.

2. and are "operators" and doesn’t produce anything until they operates on afunction.

An operator is an extension of the idea of a function such as sin or log. Sin or log aren’tanything themselves, they have to be given a number to work on such as or log(50.5).

Similarly an operator isn’t anything by itself but must be given a function to operate on.

You have met operators before in the form of derivatives ( ) and integrals ( ) but they haven’t

wandered around by themselves looking for something on which to operate.

For example let . Using Equation 5 gives:

∇ E =∂Ex

∂x+

∂Ey

∂y+

∂Ez

∂zEquation 5

≡ divergence of E

≡ div E

∇ E

∇ ∇

sin(30°)

d

dx∫ dx

E = i10x + j2y 2

∇ E =∂(10x)

∂x+

∂(2y 2)∂y

= 10 + 4y

II. OPERATORS ETC. - 5

This page is intentionally left blank.

II. OPERATORS ETC. - 6

III. GAUSS’ LAW

A. Flux and Integrals, Gauss’ Theorem or The Divergence Theorem

Suppose we are interested in the flux, through a closed surface:

where is a field of some kind and is a vector representing the surface area, normal to thesurface.

Consider a small rectangular volume with sides [PICTURE]

The "left", "right" etc. refer to the sides of thevolume. There are sign differences because the

s point in opposite directions on oppositesides of the volume.

You might well worry that the s etc. are not constant across the area elements but we plan togo to zero volume so any average will work fine in the limit.

Since the volume is small we can use:

Of course there are higher order terms but they have higher powers of and will becomeinsignificant when we take a small volume.

E A

⌠⌡ E dA

E A

∆x , ∆y , and ∆z

⌠⌡ E dA = ⌠

⌡{ Exdydz + Eydxdz + Ezdxdy}

≈ (Exright− Ex left

)∆y∆z

+ (Eyfront− Eyback

)∆x∆z

+ (Eztop− Ezbottom

)∆x∆y

dA

Ex

Exright≈ Ex left

+ ∆x∂Ex

∂x

∆x

III. GAUSS’ LAW - 7

Putting the last approximation in the equation above we find all the E s cancel and we have only:

We can integrate over a finite volume and get:

B. Gauss’ LawIn integral form Gauss’ Law is:

Let be the charge per unit volume.

Then for our little volume:

Using this along with Equation 6 in Equation 8 gives the differential form of Gauss’ Law:

⌠⌡ E dA ≈

∂Ex

∂x+

∂Ey

∂y+

∂Ez

∂z

∆x∆y∆z

or

⌠⌡ E dA ≈ ∇ E ∆V Equation 6

Gauss’ Theorem, Divergence Theorem

⌠⌡surface

E dA = ⌠⌡volume

∇ EdV Equation 7

⌠⌡ E dA =

qε0

Equation 8

ρ

q = ρ∆V

Gauss’ Law ∇ E =ρε0

Equation 9

III. GAUSS’ LAW - 8

IV. E FIELD ANDPOTENTIAL

Recall that the potential V(r) is the energy per coulomb we get taking the charge from r toinfinity. The energy depends on the force, the force depends on the electric field so we expectthat there is a connection between the field and the potential:

E is the electrical field producing the potential, dx is the distance moved. The minus sign arisesbecause as we go away from the charge producing the potential, located at x=0 here, the energywe get going the rest of the way to infinity decreases, hence dV(x) < 0.

Solving for E gives:

If the field is three dimensional what we have just found is the x component of . Evidently itself will be given by:

dV(x) = −Edx

E = −dVdx

E E

E = −[iEx + jEy + kEz]

= −i∂V∂x

+ j∂V∂y

+ k∂V∂z

= −i

∂∂x

+ j∂

∂y+ k

∂∂z

V

E = −∇ V Equation 9

IV. E FIELD AND POTENTIAL - 9

EXAMPLE: Let’s find the E field around a point charge.We already know that:

Then:

Where

Looking at the x part of :

where is the angle between and the x axis.

Combining all the parts we have:

PROBLEM: Do the example above for the field around an infinite charged wire.

EXPLAIN the results!

V(r) =kqr

1r

= (x 2 + y 2 + z 2)−1

2

E = −∇ V

= −i

∂∂x

+ j∂

∂y+ k

∂∂z

kqr

= −i

∂∂x

+ j∂

∂y+ k

∂∂z

kqu

−1

2

u = x 2 + y 2 + z 2 = r 2

E

Ex = −∂V∂x

= −∂

kqu−1

2

∂x= −kq

∂u−1

2

∂u∂u∂x

= (−kq)−

12

u−3

2

(2x) =kqx

r 3=

kq

r 2

xr

=| E | cos θrx

θrx r

E = −∇ V =

kq

r 2

(i cos θrx + j cos θry + k cos θrz)

= iEx + jEy + kEz

IV. E FIELD AND POTENTIAL - 10

V. CROSS PRODUCTS

A. : Cross Product

1. Definition

The cross product : is defined as a vector of magnitude:

is the angle from to .

lies along a line perpendicular to both and .The direction of along that line is given by a "right hand rule":Curl the fingers of your right hand the way an arrow from to would go. Yourthumb now points in the direction of .

2. Axis and unit vectors

A normal "right handed" set of x, y, z axis are arranged so

But .

And since the angle is zero.

3. Torque

Perhaps the most familiar cross product is torque where is the lever arm and is theforce.

4. "Right Hand Screws"

Normal bolts and screws move in the direction of if they are rotated clockwise. This can beregarded as a right handed motion: if the fingers of the right hand are curled to match thedirection of rotation then the thumb points in the direction of motion.

B. : DivergenceThis becomes a little messy, but follow along:

A B

A B|C | ≡ |A | |B | sin θAB Equation 1

A BθAB

C A BC

A BC

i × j = k

j × i = −k

i × i = 0

Τ = l × F l F

C

∇ × E

V. CROSS PRODUCTS - 11

First look at the part. We can see from Equation 1 that this is zero since the angle is zero.

The moral is that the direct products such as disappear while half the mixed products (e.g) get minus signs.

Remembering the six remaining terms would seem to be very tricky, but there is a neatmnemonic which makes it quite possible:

This determinant is most easily expanded in minors:

∇ × E ≡i

∂∂x

+ j∂

∂y+ k

∂∂z

× (iEx + jEy + kEz)

= i × i∂Ex

∂x+ i × j

∂Ey

∂x+ j × i

∂Ex

∂y+ . . .

= 0∂Ex

∂x+ k

∂Ey

∂x− k

∂Ex

∂y+ . . .

i × i

i × ij × i

∇ × E =

i∂

∂xEx

j∂

∂yEy

k∂∂zEz

Equation 2

∇ × E = i

∂∂yEy

∂∂zEz

− j

∂∂xEx

∂∂zEz

+ k

∂∂xEx

∂∂yEy

= i

∂Ez

∂y−

∂Ey

∂z

− j

∂Ez

∂x−

∂Ex

∂z

+ k

∂Ey

∂x−

∂Ex

∂y

V. CROSS PRODUCTS - 12

VI. STOKE’S THEOREMAND AMPERE’S LAW

Consider a line integral around a closed loop in the x y plane:

Use a small rectangular loop with sides dx and dy. Number the sides 1, 2, 3, 4 with side 1 beingthe bottom dx, side 2 being the right dy, side 3 being the top dx and side 4 being the left dy.

Let be some average along side 1. Then moving counter clockwise:

In (a) the minus arises because we are moving in the negative direction on sides three and four.

In (b) is a first approximation to . Since we are working with dx, i.e.

very small distances, this should be a good approximation.

Now we can factor out dxdy=dA and find:

Relation (a) follows from Equation 3 above which defines .

⌠⌡ B ⋅ dl = ⌠

⌡boundaryB ⋅ dl

Bx1Bx

⌠⌡ B ⋅ dl = ⌠

⌡{ Bx1dx − Bx3

dx} + { By2dy − By4

dy} (a)

= ⌠⌡

∂Bx

∂y

dy

dx +

∂By

∂x

dx

dy (b)

∂Bx

∂y

dy

{ Bx1dx − Bx3

dx}

⌠⌡ B ⋅ dl = ⌠

∂By

∂x−

∂Bx

∂y

dxdy

= ⌠⌡(∇ × B)zdA (a)

= ⌠⌡(∇ × B) ⋅ dA (b)

∇ × B

VI. STOKE’S THEOREM AND AMPERE’S LAW - 13

To see relation (b) notice that dA is in the x y plane. The vector representing dA ( ) is normalto the surface, hence is in the z direction. Therefor taking the dot produce of with multiplies the z component of times dA.

Similar reasoning will hold for any orientation. We can add up many very small rectangles tobuild up any arbitrary shape and conclude that:

From Ampere’s Law in integral form:

Where is the current per unit area.

For a very small volume:

dA(∇ × B) dA

(∇ × B)

⌠⌡ B ⋅ dl = ⌠

⌡(∇ × B) ⋅ dA Stoke’s Theorem

⌠⌡ B ⋅ dl = µ0i

⌠⌡(∇ × B) ⋅ dA = µ0

⌠⌡ j ⋅ dA

j

∇ × B = µ0j

Ampere’s Law, differential form

VI. STOKE’S THEOREM AND AMPERE’S LAW - 14

VII. COMBINATIONS OFs

Here are a few handy relations:

A.

B.

C.

D.

E.

F.

G.

H.

∇ ⋅ (∇ T) = ∇ 2T = a scaler field

∇ × (∇ T) = 0

∇(∇ ⋅ h ) = a vector field

∇ ⋅ (∇ × h ) = 0

∇ × (∇ × h ) = ∇(∇ ⋅ h ) − ∇ 2h

(∇ ⋅ ∇) h = ∇ 2h = a vector field

∫closed surface C ⋅ dA = ∫volume inside ∇ ⋅ CdV

∫boundary C ⋅ ds = ∫surface(∇ × C) ⋅ dA

VII. COMBINATIONS OF s - 15∇

This page is intentionally left blank.

VII. COMBINATIONS OF s - 16∇

VIII. COMPLEX NUMBERS

Feynman discusses complex numbers and their uses in volume I chapters 22-24.

Consider a complex number

. Equation 1

N.B. About notation for complex numbers: There is no standard notation to indicate that avariable is complex. Often it is clear from the context what is meant but in AC circuit theory thesame symbols are used at times for real quantities and at times for complex quantities. Feynmanuses a hat ( ) to indicate complex quantities. Since he invented the most powerful idea ofnotation of the twentieth century (Feynman Diagrams) I’ll go along with his suggestion.

It is easy to picture as a vector in a two [PICTURE]dimensional space with real numbers along thex axis and imaginary numbers along the y axis.

This representation suggests that if z has amagnitude r and is the angle between the real(x) axis and z then:

Equation 2.

A.

Equation 3.

This last step is usually a bit of a jar.

z

z = x + iy

z

z

θ

z = r cos(θ) + ir sin(θ)

z = reiθ

z = re iθ

VIII. COMPLEX NUMBERS - 17

Let’s look at the series expressions for the functions:

B. We can also go in reverse from trig functions with complex arguments to e s.

Let , then using equations 2 and 3:

Recall that cosine is even and sine is odd:

See the sections below "Complex Frequencies", and "Critical Damping" for a pretty andsurprising application of this relationship.

cos(θ) = 1 −12!

θ2 +14!

θ4 −16!

θ6 + . . .

sin(θ) = θ −13!

θ3 +15!

θ5 −17!

θ7 + . . .

eθ = 1 + θ +12!

θ2 +13!

θ3 +14!

θ4 +15!

θ5 +16!

θ6

e iθ = 1 + iθ −12!

θ2 − i13!

θ3 +14!

θ4 + i15!

θ5 −16!

θ6

= cos(θ) + i sin(θ) !!

Cos(iα)

θ = iα

e iθ = e−α = cos(iα) + i sin(iα)

e−iθ = eα = cos(iα) − i sin(iα)

e−α + eα = 2 cos(iα)

eα − e−α = −2i sin(iα)

cos(iα) =eα + e−α

2≡ cosh(α)

sin(iα) = i eα − e−α

2≡ i sinh(α)

cos(θ) = cos(−θ)

sin(θ) = −sin(−θ)

cos(iα)

VIII. COMPLEX NUMBERS - 18

C. Magnitudes

A nice feature of is that it separates out the magnitude and "direction" of the vector.

Clearly the magnitude is r and is given by:

If we wanted to write this in terms of z we could use:

Where:

D. Angle Unit Vectors

If the r in is the magnitude then the rest of the expression must give the "direction" andbe of unit magnitude; a "unit vector". We can check this by calculating the magnitude of :

You could also check by finding the magnitude of the other representation of , that is:

E. Calculating the Angles For Complex NumbersIf then the angle between and the x axis is given by:

z = reiθ

r = √ x 2 + y 2

r = √z z * ≡ √ (x + iy) (x − iy) = √ x 2 − ixy + ixy + y 2 = √ x 2 + y 2

z * ≡ the complex conjugate of z Equation 4

≡ zwith every i changed to -i

z = re (iθ)

e iθ

| e iθ |=√ (e iθ) (e iθ)* = √ (e iθ) (e−iθ) = √e 0 = 1

e iθ

cos(θ) + i sin(θ)

z = x + i y θ z

θ = tan−1

yx

= tan−1

imaginaryreal

VIII. COMPLEX NUMBERS - 19

IX. LINEARDIFFERENTIAL

EQUATIONS: LRC

The point of all this is supposed to be to help us solve differential equations that are interesting inphysics. You might well ask how reasonable this can be since we never observe complexnumbers on a balance or meter.

The answer is that the procedure is much like calculating the mass of a bridge. We never expectto find a bridge with a negative mass but we don’t hesitate to use negative numbers in thecalculation. Of course we should be suspicious if the negative numbers are still there at the end.

In a similar way we can fairly freely use complex numbers to calculate physical quantities but weare only interested in real answers.

Linear differential equations will not mix the real and imaginary parts of , we can thenuse the nice properties of the representation to do the calculus and simply use the realpart at the end. Non linear equations would mix the real and imaginary parts.

A. LRC circuitSuppose we have a LRC circuit with an initial charge on the capacitor but no initial current.We will go around the circuit with the initial direction of the current, first through L, then R, thenC:

Equation 5

q is the charge on the capacitor. If I is the current (we certainly don’t want to use i!) then

since the charge on the capacitor is decreasing with positive current if we go around the loopwith the current. This changes the originally negative L and R terms to positive!

Suppose we try:

z = x + iyz = re iθ

q0

VL + VR + VC = 0

Ld 2q

dt2+ R

dqdt

+qC

= 0

dq

dt= −I

q = q0e(b − iω)t

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC - 20

then the derivations are quite trivial:

Notice that all the equations have in common, when we substitute them in Equation 5 the swill all cancel. Then equation 5 becomes:

In one step our differential equation has become algebra! This bit of magic was the motivationfor all our work here, to turn calculus into algebra by using e s.

Doing the algebra, noticing that the real and imaginary parts must each equal zero separately,gives:

Finally:

We get the last part by simply keeping the real part of .

B. "Mass on Spring" equivalent to LRC circuitWe get an equation functionally identical to Equation 5 for a mass m oscillating on a springwhich has a restoring force when stretched a distance x. There is a resistance forcepromotional to the velocity .

Newton’s Second Law gives:

dqdt

= (b − iω)q

d 2q

dt2= (b − iω)2q

q q q

(b − iω)2L + (b − iω)R +1C

= 0

b = −R2L

ω =√1LC−

R2L

2

=√ω02 −

R2L

2

ω0 ≡√ 1LC

= the natural frequency, for R = 0

q = q0e − R

2L+ iω

t= q0e

− R

2Lte iωt

q real = q0e− R

2Ltcos(ωt)

e iωt

Fspring = −kxFfriction = −Rv

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC - 21

Equation 6

Clearly equations 5 and 6 are the same functions, hence must have the same solutions. Using thevariables from Equation 6:

C. Complex FrequenciesWe found above that for LRC circuits or for a mass on a spring with damping that the charge orposition were given by:

At first this seems innocent enough until we realize that the values of k, m and R are quitearbitrary, it is easy to produce an imaginary !

Before panicking let’s use the expression for the cosine with an imaginary argument we foundabove. For the moment let’s consider the case where is indeed imaginary and write it in termsof a real variable .

F = ma

F friction + Fspring = ma

−Rv − kx = ma

−Rdxdt

− kx = md 2x

dt2

md 2x

dt2+ R

dxdt

+ kx = 0

x = x0e− R

2mtcos(ωt)

ω =√km

R2m

2

=√ω02 −

R2m

2

ω =√ 1LC

R2L

2

or

ω =√km −

R2m

2

ω

ωω′

ω ≡ iω′ ≡ i√km −

R2m

2

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC - 22

The math is the same but it is probably easier to visualize what might happen in the "mass onspring" situation. If R is very small we expect slowly damped oscillations. If R is infinite thenthere is no movement, hence no oscillations. If R is very big, sticky tar perhaps, then the masswill return very slowly to equilibrium and not oscillate at all. Now, will the math produce whatwe believe must happen?

There is no cosine term so this will not oscillate.

is always greater than so both exponents are negative and q will decrease with time as

expected.

A happy miracle has occurred: the imaginary frequency just produces an expediential decay withtime.

D. Critical DampingFor damped oscillations we are often interested in returning to equilibrium as fast as possible.Examples are shock absorbers on a car, damping of a balance, and damping of oscillations in anelectronic circuit such as one to produce square waves with no ringing. Ringing is the unwantedoscillation at the natural frequency produced by a transient such as a square wave.

Looking at the equations for damped harmonic motion above we see that for real the speed ofdecay increases with increasing R.

For imaginary there are two terms in equation ??. The exponent of the second is more

negative, hence will decay the fastest. The other exponent, is negative but smaller.

We want the value of R that makes this term as large as possible to make the decay as fast aspossible. To make as small as possible, we make R as small as permitted.

To be sure whether we should increase or decrease R to decrease we can find the slope by taking the

derivative with respect to R:

for any ω q = q0e− R

2mtcos(ωt)

for ω imaginary = q0e− R

2mtcos(iω′t)

= q0e− R

2mt

eω′t + e−ω′t

2

=q0

2 e

R

2m− ω′ t

+ e−

R

2m+ ω′ t

R

2mω′

ω

ωR

2m− ω′

ω′R

2m− ω′

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC - 23

The negative slope means that R should be as small as possible.

The conclusion is that for small R (oscillating with real ) we want R larger and for big R (nooscillations, imaginary ) we want R smaller. These converge to setting to zero:

This condition produces the fastest damping, critical damping. There will be no oscillations butsimply a fast decay to zero.

ddR

R2m

− ω′

=d

dR

R2m

R2m

2

−km

1/2

=1

2m−

12

2

R

2m

1

2m

R

2m

2− k

m

1/2

=1

2m

1 −R

2m

R

2m

2− k

m

1/2

< 0

since R

2m >

R2m

2

−km

1/2

ωω ω

km

=

R2m

2

IX. LINEAR DIFFERENTIAL EQUATIONS: LRC - 24

X. LINEAR DIFFERENTIALEQUATIONS: DRIVEN LRC

CIRCUIT AND MASS ONSPRING

A. Complex Solution for LRC CircuitLet’s add an AC voltage source V to the LRC circuit solved above. Conservation of energy orKirchoff’s law gives:

Equation 7

Where:

Equation 8

is to account for a possible phase difference between the voltage and current. It would seemmore logical to include the with the current but this is the way it is usually done.

We hope to emulate Ohm’s Law and get, finally, a relation of the form:

We are not going to try to solve this in general but only for the "steady state". That is, only forthe conditions after any initial transients have died out.

When the circuit is first turned on there will be transient currents such as we found for the LRCcircuit but these currents will dissipate because of the resistance in the circuit. In the long runthe only currents left will be those supported by V. V will supply energy to these currents as fastas the resistor dissipates the energy as heat.

Since these steady state currents are powered by V it is reasonable that they will have the samefrequency as V, that is the above not the we found for the RLC circuit.

We will go around the circuit with the increasing current. Equation 7 becomes:

To get everything in terms of current use:

We might worry about an initial charge but it will have dissipated by the time we reach thesteady state.

VL + VR + VC + V = 0

V = V0 cos(ωt + δ)

δδ

V = I Z

ω ω

−LdIdt

− IR +qC

= −V

q = −⌠⌡ Idt

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 25

Now we have, dropping the universal minus sign:

Equation 9

To solve this with the aid of complex variables let’s try:

Using these expressions in Equation 9 and eliminating the common gives:

Then:

and for the magnitudes:

LdIdt

+ IR +1C

⌠⌡ Idt = V

V = V0ei(ωt + δ)

I = I0eiωt

d Id t

= iωI

d 2I

d t2= −ω2I

e iωt

iωLI0 + I0R +1

iωCI0 = V0e

I0R + i

ωL −

1ωC

= V0eiδ

I0Z = V0eiδ Equation 10

Z = R + iωL −

1ωC

Equation 11

Z ≡| Z |=√ZZ* =√ R2 +ωL −

1ωC

2

Equation 12

δ = tan−1

ωL − 1/ωCR

Equation 13

I0Z = V0 Equation 14

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 26

B. Complex Solution for Mass on Spring

The minus sign in front of R in Equation 4 is to help get us into the proper quadrant. Notice fromEquation 3 that the imaginary part is always negative, therefor is always negative. For lowfrequencies, small , the real part is positive so is negative and near zero.

For resonance, , .

For large both the real and imaginary parts are negative, therefor we are in the third quadrantand .

Now: ma + Rv + kx = F cos(ωt) Equation 1

We expect: x = x0 cos(ωt + δ)

Let: cos(ωt) → e iωt cos(ωt + δ) →e i(ωt + δ)

then: x = x0ei(ωt + δ) v =

dxdt

= iωx a =dvdt

= −ω2x

substuting into Equation 1 and eliminating the common e iω gives:

x0eiδ(−mω2 + iωR + k) = F

or x0eiδ =

F /ω(k /ω −mω) +iR

= z

Then x0 = √zz * =F /ω

√R2 + (k /ω −mω)2=

F /ωZ

Equation 2

Z = √R2 + (k /ω −mω)2

To find δ let q = (k /ω −mω)

Then x0eiδ =

F /ωq + iR

To separate real and imaginary parts:

x0eiδ =

F /ωq + iR

⋅q − iRq − iR

=

F /ωq 2 + R2

(q − iR) Equation 3

Finally, we can find δ. Canceling the common parts, {}, gives:

δ = tan−1(imaginary / real ) = tan−1

−Rq

= tan−1

−Rk /ω −mω

= tan−1

−Rω/mω0

2 − ω2

Equation 4

δω δ

ω0 = ω δ = −π/2

ωδ → −π

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 27

C. Full Width Half Maximum, Q, and Energy1. Full Width Half MaximumUsually V is a given voltage source and the current results from V and Z:

The maximum will occur when for the minimum Z, . The frequency that makes

this happen is just the resonant frequency, for the RC circuit.

The smaller the R the larger the current at resonance. For the mechanical equivalent the smallerthe friction the greater the motion at resonance.

We are often interested in the shape of this response curve, versus . If the curve is narrowthe system will only respond strongly to a narrow range of frequencies, excellent for a tunerdesigned to receive a specific station competing with other stations with nearby frequencies. Onthe other hand this very selective response is bad if we are trying to receive a signal but don’tknow the frequency, talking to ETs for instance.

To predict just how narrow the response will be we need some measure of width:

FWHM Full Width Half Maximumthe width of the response curve measuredat a current equal to half the maximumcurrent

By itself the FWHM can be misleading. A value of 100 Hz would imply a broad response if = 200 Hz but would be very sharp if was 1 GHz. To tell how sharp the resonance is we reallyneed to know FWHM / .

We will find an expression for FWHM / in terms of L, R, C, and .

Let be the frequencies that give half maximum intensity. There are two s but for reasonablynarrow resonance

I0 =V0

Z=

V0

√R2 + ωL − 1

ωC

2Equation 15

ωL − 1

ωC= 0I0

ω0

I0 ω

ω0

ω0

ω0

ω0 ω0

ω ω

ω = ω0 ± FWHM / 2

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 28

From equation 15:

We see that the smaller the resistance, and, all else being equal, the higher the frequency thesharper the resonance.

Time keeping devices have gone successfully from pendulums and balance wheels to tuningforks, to quartz crystals, to electrons in atoms. Each step has had lower inter damping (R) andhigher frequencies.

2. QElectronics types measure the "Quality" of an oscillator by the Q:

Z(ω) =2Z(ω0)

√ R2 +ωL −

1ωC

2

= 2R

squaring ωL −

1ωC

2

= 3R2

and ωL −1

ωC= R√ 3

recall ω0 =√ 1LC

divide by L to use this ω −1

ωLC =

R√ 3L

ω −ω0

2

ω=

R√ 3L

using ω = ω0 +FWHM

2

ω −ω2 − 2ω ×FWHM

2+ FWHM

4

2

ω=

R√ 3L

dropping the small FWHM2

FWHM ω

=R√ 3Lω

Equation 16

Q ≡VL

VR

=ωLI0

I0R=

ωLR

= √ 3ω

FWHM

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 29

The definition is convenient because the voltages are easy to measure.

Clearly the bigger the; Q the sharper the resonance.

3. Fractional Energy Lost Per CycleHow many cycles an oscillator will go through before the amplitude becomes negligible can beestimated by:

Then:

4. To Summarize:A "good" oscillator has a big Q, a narrow resonance, and a small energy loss per cycle.

This is achieved by a small R and / or a high frequency.

Energy stored Energy lost per cycle

=1

2I0

2L

⌠⌡0

2πω

IVR dt

⌠⌡ IVR dt = ⌠

⌡(I0 cos(ωt)) (I0 cos(ωt)R) dt

= I02R ⌠

⌡ cos(ωt)2 dt

since for a complete cycle the integral of cos2 = the integral of sin2

= I02R ⌠

⌡12

(cos(ωt)2 + sin(ωt)2)dt

=I02R ⌠

⌡0

2πω 1

2dt = I0

2R12

2πω

Energy stored Energy lost per cycle

=1

2I0

2L1

2I0

2R2πω

=ωL2πR

=Q2π

X. LINEAR DIFFERENTIAL EQUATIONS: DRIVEN LRC CIRCUIT AND MASS ON SPRING - 30

XI. ELECTROMAGNETICWAVES

A. Maxwell’s Equations

MAXWELL’S EQUATIONS

Faraday’s Law says that a changing magnetic field produces an electric field, in turn Ampere’sLaw suggests that the changing electric field would produce a magnetic field. Perhaps the fieldscan lift themselves by their own boot straps?

B. Traveling WavesSo that we can recognize the solution when we find it let’s examine a traveling wave a little.Let:

Gauss’ Law ⌠⌡ E dS =

qε0

or ∇ E =ρε0

Gauss’ Law for magnetism

⌠⌡ B dS = 0 or ∇ B = 0

Faraday’s Law ⌠⌡ E dl = −

∂ΦB

∂t or ∇ E = −

∂B∂t

Ampere’s Law, extended

⌠⌡ B dl = µ0i + µ0ε0

∂ΦE

∂t or ∇ B = µ0j + µ0ε0

∂E∂t

Where

ΦB ≡ ⌠⌡ B dS and ΦE ≡ ⌠

⌡ E dS

ρ ≡ charge density, i.e. charge per unit volume

j ≡ current density, i.e. current per unit area

E = E(u )

u ≡ x − vt

XI. ELECTROMAGNETIC WAVES - 31

Look at a particular spot on the "wave", say . As t increases then x must also increaseto keep a constant . This x is the location of that particular spot on the wave. To find thevelocity of that spot take the derivative of :

We have not used any properties of the function so our result holds for any function at all.

Any function of the form is a traveling wave moving in the x direction with avelocity v.

if u=x+vt then the wave is moving in the - x direction.

C. A Traveling Wave Solution of Maxwell’s Equations

Let’s examine a simple case, vacuum, where and are zero.

We will eliminate B between Faraday’s Law and Ampere’s Law, then see if we can solve for E.Multiply Faraday’s Law by then use Ampere’s Law to eliminate the resulting .

The transformation of the is a "well known" identity, we will trust it is correct.

using Gauss’ Law and the fact that we are in a vacuum.

is usually abbreviated as , then:

We don’t lose any generality by rotating the axis to line up with the velocity of the wave. IfE=E(u)=E(x-vt) then

E0 ≡ E(u0)u0

u0

du0

dt=

d (x − vt)dt

; 0 =dxdt

− v ; dxdt

= v

E(u )

E(x − vt)

∇ ∇ B

∇ (∇ E) = ∇ ×−

∂B∂t

= −∂∂t

(∇ B) = −∂∂t

µ0ε0

∂E∂t

∇( ∇ E) − (∇ ∇) E = −µ0ε0

∂2E

∂t2

∇ ∇

∇ E = ρ/ε0 = 0

∇ 2∇ ∇

The Wave Equation ∇ 2E = µ0ε0

∂2E

∂t2

∇ 2 =∂2

∂x 2

and the wave equation becomes

∂2E

∂x 2= µ0ε0

∂2E

∂t2

XI. ELECTROMAGNETIC WAVES - 32

Using u=x-vt:

Substituting these expressions into the wave equation just above gives:

Happily the that we don’t know cancels out and we have:

Therefor: Any E that is a function of (x-vt) is a solution of the wave equation with the velocitygiven above. To evaluate the velocity:

This is, of course, just the velocity of light, c!

∂E∂x

=∂E∂u

∂u∂x

=∂E∂u

≡ E ′

∂2E

∂x 2=

∂2E

∂u 2≡ E ′′

∂E∂t

=∂E∂u

∂u∂t

=∂E∂u

(−v) = −vE ′

∂2E

∂t2= v 2E ′′

E ′′ = µ0ε0v2E ′′

E ′′

v =√ 1µ0ε0

v =√ 1µ0ε0

=√ 1

1.25 × 10−6H /m 8.85 × 10−12F /m= 3.01 × 108m /s

XI. ELECTROMAGNETIC WAVES - 33

D. Characteristics of Electromagnetic WavesTo find out what limits there are on solutions of the wave equation let’s try the special case:

. Light with the electric field in only one direction is called polarized.

Using Faraday’s Law with the :

Letting u=x-ct:

Therefor is perpendicular to and the magnitude of B is equal to E/c.

Also, E and B are in phase.

E = jEy(x − ct)

E = jEy(x − ct)

∇ E = ∇ jEy(x − ct) = −∂B∂t

=

i∂

∂xEx

j∂

∂yEy

k∂∂zEz

=

i∂

∂x0

j∂

∂yEy

k∂∂z0

since Ey(x − ct) doesn’t depend on y or z

=

i∂/∂x

0

j0Ey

k00

= k ∂/∂x

0

0Ey

= k∂Ey

∂x

then

k∂Ey

∂x= −

∂B∂t

k∂Ey

∂u ∂u∂x

= −∂B∂u

∂u∂t

k∂Ey

∂u= c

∂B∂u

Integrating

⌠⌡ k

∂Ey

∂udu = ⌠

⌡ c∂B∂u

du

kEy = cB + C

we don’t care about constents, they are not part of the traveling wave, so:

kEy = cB

B E

XI. ELECTROMAGNETIC WAVES - 34

We could make the same argument for or any perpendicular to the velocity.

What about an along the velocity?

?

Therefor can have no component along the velocity. This is a transverse wave. Waves on aguitar string or surface waves in water are transverse. Sound waves are longitudinal, theparticles move the same direction that the wave travels.

If the electric field is in just one direction, of the many directions allowed perpendicular to thevelocity, then the wave is said to be polarized.

E = kEz(x − ct) E

E

E = iEx(x − ct)

∇ E =

i∂

∂xEx

j∂

∂yEy

k∂∂zEz

=

i∂

∂xEx

j∂

∂y0

k∂∂z0

since Ex(x − ct) doesn’t depend on y or z

=

i∂/∂xEx

j00

k00

= 0

E

XI. ELECTROMAGNETIC WAVES - 35

[PICTURE]

To summarize what we have found about Electromagnetic Waves:

ELECTROMAGNETIC WAVES

1. Any electric field of the form E=E(x-vt) will produce an electromagnetic wave satisfying

the wave equation.

To also satisfy Faraday’s Law:

2. The electric field is perpendicular to the magnetic field.

3. The electric and magnetic fields are perpendicular to the velocity: A transverse wave.

4. The magnitudes are related by E=cB

5. The electric field and magnetic field are in phase.

Traveling Waves, Frequency, and Wave Number

Above we saw that E(x-vt) is a traveling wave. Often we see an expression such as. Are these the same?

So is indeed equivalent to E=E(x-vt). What are k and ?

is useful for periodic waves, say with a period of : E(u)=E(u+ ).

Of course this suggests the familiar .

You might wonder why we should give so much thought to these special cases. There areseveral reasons. First, they are mathematically easy, we can actually easily deal with thecalculus and results. Second, almost everything oscillates with this motion to a firstapproximation, Simple Harmonic Motion. Third, we can build any periodic shape out of sineand cosine functions to any desired accuracy by a Fourier Series.

Let be the wavelength of the wave, then when x changes by , the argument u changes by .

Similarly, if is the period of the wave then when t changes by u changes by .

E = E(kx − ωt)

E(kx − ωt) = E k

x −

ωk

t

= E [k(x − vt)]

where v =ωk

E = E(kx − ωt) ω

E = E(kx − ωt) 2π 2π

cos(kx − ωt) and sin(kx − ωt)

λ λ 2πkλ = 2π

k =2πλ

≡ The wave number

Τ Τ 2π

XI. ELECTROMAGNETIC WAVES - 36

Waves are usually specified by period, wave length, or frequency, but there are some fieldswhere the wave number are a convenient size and are used to specify the particular wave.

E. Wave Guide - An Application1. Uses and Solution of the Wave EquationElectromagnetic energy or signals are transmitted by wires, coax cables, wave guides, and in freespace. In the microwave region over relatively short distances wave guides work very well. Inthe visible region fiber optics work as wave guides for intercontinental distances, with a fewrepeaters.

A wave guide for microwaves is a hollow conducting tube, it looks like a piece of plumbing.We can analyze a simple version consisting of just two parallel conducting plates.

Let the wave travel in the x direction. The electric field will be in the y direction and the platesmaking up the wave guide will be in the xy plane at z=0 and z=a.

Since there can be no tangential electric field at a conducting surface the electric field must go tozero at the plates. We can accomplish this by using:

The goes to zero at z=0 and z=a. There are different modes for different values of n: 1,

2, 3, . . .

The different modes don’t seem to matter generally for microwaves but can be very importantfor sending pulses over fiber optics.

The produces a traveling wave in the x direction just as we have been discussing.

Let’s see what restrictions the wave equation places on this wave:

Since there are no y terms

ωΤ =2π

ω =2πΤ

≡ Frequency

E = jEy sin

2πa

z

Cos(kx − ωt)

sin

2πa

z

cos(kx − ωt)

∇ 2E = µ0ε0

∂2E

∂t2=

1

c 2 ∂2E

∂t2

∇ 2 =∂2

∂x 2+

∂2

∂z 2

XI. ELECTROMAGNETIC WAVES - 37

Notice that the second derivatives just replicate the sine and cosine, with minuses and the squaresof the coefficients of z, x, and t. Canceling out the common gives:

Solving for k and gives:

At first these look quite innocent but on closer inspection there are three strange features: k canbe imaginary, v is a function of k (hence ), and v is faster than light!

2. Imaginary Wave Number

k becomes imaginary when using we see that this happens when. Evidently something peculiar happens when the wave length in the x direction becomes

less than the width in the z direction.

To investigate the effect of an imaginary wave number k it will be easiest to define:

Then, for k imaginary or k’ real:

We see that the imaginary wave number means that the wave is not a traveling wave but is nowdecaying as it goes in the x direction.

This means that for , or too small, or n too big, or a too small there is no traveling wavethrough the wave guide.

Then∂2E

∂x 2= −k 2

jEy sin

2πa

z

Cos(kx − ωt)

∂2E

∂z 2= −

2πa

2

jEy sin

2πa

z

Cos(kx − ωt)

∂2E

∂t2= −ω2

jEy sin

2πa

z

Cos(kx − ωt)

−E

k 2 +

2πa

2

=ω2

c 2

ω

k =√ ω2

c 2−

2πa

2

and ω =c√ k 2 +

2πa

2

then v =ωk

= c√ k 2 +

2πa

2

k= c√1 +

2πka

2

λ

ω/c = 2π/a ω =2πν =2πc /λλ = a

k ≡ i k ′

k ′ ≡ √

2πa

2

−ω2

c 2

cos(kx − ωt) = Real e i(kx − ωt) = e ikxe iωt = e−k ′xe iωt

= e−k ′x cos(ωt)

λ > a ω

XI. ELECTROMAGNETIC WAVES - 38

This is not a unique result but is quite common with waves, even the probability waves that let uscalculate the probabilities of finding particles. There are areas that particles cannot reachclassically, too much energy required, according to Quantum Mechanics however there is a finitebut decreasing probability of finding the particles in these forbidden regions.

XII. SERIESAPPROXIMATIONS

A. IntroductionOften in Physics or Math we want to observe the effect of a small change in conditions. Thischange may be too small to calculate directly, or the calculation may be too complicated toreveal the interesting results of the change. Often both problems can be alleviated by using aseries approximation to the complete function. We will start by deriving a powerful seriesexpansion, Taylor’s Series, then a slight simplification, Maclaurin’s series, and finally a verysimple, useful form, the Binomial expansion.

B. Taylor Series1. NotationLet

notice that is a variable while is a constant.

x = a + ε

a is a constant

y = y(x) = y(a + ε)

y ′ ≡dydx

, y ′′ ≡d 2y

dx 2, yn ≡

dn y

dxn

ya ′ ≡

dydx

a

≡ y ′evaluated at x=a or ε = 0

y ′ ya ′

XII. SERIES APPROXIMATIONS - 39

2. Derivation of Taylor Series

Suppose that is a constant, i.e. the third derivative of y has no x terms, the fourth derivativewould be zero.

To find the value of evaluate Equation 1 for .

Combining Equations 1 and 2 we find:

Viewed geometrically this tells us that at is what it was at , plus times thederivative, a linear increase.

By similar reasoning:

Finally!

If is not constant we can see by induction that:

y ′′′

y ′′′ =d 3y

dx 3=

d

d2y

dx2

dx=

d y ′′dx

hence y ′′ = ⌠⌡ y ′′′ dx = ⌠

⌡ y ′′′ dε = C1 + εy ′′′ Equation 1

since dx = dε and y ′′′ is a constant

C1 x = a or ε = 0

ya ′′ = C1 + 0 ⋅ y ′′′ Equation 2

y ′′ = ya ′′ + εy ′′′ Equation 3

y ′′ x = a + ε x = a ε

y ′ = ⌠⌡ y ′′dx = ⌠

⌡(ya ′′ + εy ′′′) dε = C2 + εya ′′ +12

ε2y ′′′

By setting ε to zero again we find C2 = ya ′

then y ′ = ya ′ + εya ′′ +12

ε2y ′′′ Equation 3

y = ⌠⌡

ya ′ + εya ′′ +12

ε2y ′′′dx = C3 + εya ′ +

12

ε2ya ′′ +12

13

ε3y ′′′

and, as before, C3 = yaso:

y = ya + εya ′ +12

ε2ya ′′ +12

13

ε3y ′′′

y ′′′

Talor Series y = ya + εya ′ +12!

ε2ya ′′ +13!

ε3ya ′′′ + . . .1n !

εn yan + . . . Equation 4

XII. SERIES APPROXIMATIONS - 40

3. Use of Taylor Series

a. Ln(1+ )

Let x=1+ , a=1. Then for small :

C. Maclaurin’s Series1. Derivation:

Maclaurin’s Series is obtained from Taylor’s series by setting a=0 or x= , i.e. expanding aroundzero rather than an arbitrary point. The series looks much the same:

The notation is explained above under the Taylor Series.

2. Uses of the Maclaurin Series

a.

ε

ε ε

y = ln(x), y ′ =1x

, y ′′ = −1

x 2

For x=a=1 ya = ln(1) = 0, ya ′ = 1, ya ′′ = −1

From Equation 4 y = ya + εya ′ +12!

ε2ya ′′ +13

!ε3ya ′′′

= 0 + ε ⋅ 1 +12!

ε2 ⋅ (−1) + . . .

ln(1 + ε) ≈ ε

ε

Maclaurin’s Series

y = y(ε) = y0 + εy0′ +12!

ε2y0′′ +13!

ε3y0′′′ + . . .1n !

εn y0n + . . .

Equation 5

Sin(ε)

y = sin(x), y ′ = cos(x), y ′′ = − sin(x

y0 = 0, y0′ = 1, y0′′ = 0

y = y(ε) = y0 + εy0′ +12!

ε2y0′′ +13!

ε3y0′′′ + . . .1n !

εn y0n + . . .

sin(ε) = 0 + ε ⋅ 1 +12

ε2 ⋅ 0 + . . .

for small ε sin(ε) ≈ ε

XII. SERIES APPROXIMATIONS - 41

b.

Therefor for small angles the cosine is almost constant while the sine equals the angle, inradians of course.

Notice that the sin is explicitly odd (sin(-x)=-sin(x)) while cos is explicitly even(cos(-x)=cos(x)).

c.

XIII. LEAST SQUARESCURVE FITTING

A. IntroductionGeneral Problem

Cos(ε)

y = cos(x), y ′ = − sin(x), y ′′ = − cos(x), y ′′′ = sin(x), y 4 = cos(x)

y0 = 1, y0′ = 0, y0′′ = −1, y0′′′ = 0, y04 = 1

y = y(ε) = y0 + εy0′ +12!

ε2y0′′ +13!

ε3y0′′′ + . . .1n !

εn y0n + . . .

cos(ε) = 1 + ε ⋅ 0 +12

ε2 ⋅ (−1) +13!

ε3 ⋅ 0 +14!

ε4 ⋅ 1 + . . .

= 1 −12

ε2 +14!

ε4+ . . .

≈ 1

ex

y = ex, y ′ = ex, . . .

y0 = 1, y0′ = 1, . . .

y = y(ε) = y0 + εy0′ +12!

ε2y0′′ +13!

ε3y0′′′ + . . .1n !

εn y0n + . . .

ex = 1 + x ⋅ 1 +12

x 2 ⋅ 1 + . . .

= 1 + x +12

x 2 +13!

x 3 + . . .

XIII. LEAST SQUARES CURVE FITTING - 42

In Physics you often have a theory and some experimental data which may agree with the theoryor conflict with the theory. Most theories are somewhat flexible so you want to see how close tothe real data you can get the theory by adjusting suitable parameters.

Suppose that the experimental data consists of x, y pairs:

and that the theory gives y as a function of x with the adjustable parameters A, B, C, . . .:

The mission of a least squares curve fit is to find the parameters (A, B, C, and D) that make thetheoretical y as close as possible to the experimental y for each x.

The usual definition of the "best fit" is to minimize the sum of the squares of the differencesbetween the theoretical y and the experimental y for each point, , Chi squared:

You could try billions of A, B, C, and Ds trying to find the best fit but with some calculus thereis a more efficient way, as we will see below.

Weighing

Often data points are not all created equal, they have different accuracies represented by differentstandard deviations of the mean, . It is logical to give more weight to the best data, that withthe smallest . If this is done we are producing a "Weighted Least Squares Curve Fit". Inpractice this is easy, we just include the in the Chi squared:

Now unreliable points with large will contribute only a little to the sum and, hence, the valueof the optimum parameters.

Possible Complications

You may wonder why we didn’t worry about the errors in the x direction, either in the data or inthe lack of fit in the x direction. Usually it is hoped that the x measurements are significantlymore accurate than the y measurements so it will be safe to ignore problems in the x direction.As far as I can tell there seems to be no general agreement as to how to handle this more generalcase.

We will show below how to include weighing including the standard deviation of the mean in thex direction. There seems to be little agreement on this either. This method was suggested byDon Skelton of CIT.

B. Solution For Linear EquationsThis means linear in the parameters A, B, . . . The function is not linear, we will come back to such functions later under "Non Linear Equations". For nowwe want a linear equation, say:

x1, y1 x2, y2 . . . xn, yn

y(x) = A + Bx + C Cos(Dx)

Χ2

Χ2 ≡ ∑i = 1

n

(y(xi) − yi)2

σm, i

σm, i

σm, i

Weighted Least Squares Χ2 ≡ ∑i = 1

n

y(xi) − yi

σm, i

2

Equation 1

σm, i

y(x) = A + Bx + C Cos(Dx)

XIII. LEAST SQUARES CURVE FITTING - 43

Any functions of x, are ok, the expression just must be linear in the parameters A, B, C, . . .

Now Equation 1 becomes:

Let:

If it is an unweighted least squares the is 1.

Multiplying out the on the right gives:

Now do the summations term by term: A, B, and C don’t depend on i so they come out of thesummations:

We know the s and the s for each so we can actually do all the summations, i.e. the sare just known numbers. The only unknowns now are the optimum A, B, and C, i.e. those thatminimize .

If A is the only variable, i.e. for fixed B and C, it is easy to minimize . is just a parabola as

a function of A and the slope equals zero at the minimum.

The means that we only vary A.

For every B, C pair we can find the A that minimizes , this gives a surface in A, B, C space.

If we do this for B and C as the variables we get three surfaces which meet at a point, theoptimum A, B, C.

y(x) = A + Bx + Cx 2

or more generally: y(x) = A f1(x) + B f2(x) + C f3(x) + . . .

f1(x)

Χ2 ≡ ∑i = 1

n

y(xi) − yi

σm, i

2

= ∑i = 1

n

A f1(xi) + B f2(xi) + C f3(xi) − yi

σm, i

2

f1 ≡ f1(xi)/σm, i, yw ≡yi

σm, i

σm, i

()2

Χ2 = ∑[A2f12 + B2f2

2 + C 2f32 + yw

2 + 2(AB f1f2 + AC f1f3 + BC f2f3 − A f1yw − B f2yw − C f3yw)]

Χ2 = A2 ∑ f12 + B2 ∑ f2

2 + C 2 ∑ f32 + ∑ yw

2 + 2(AB ∑ f1f2 + AC ∑ f1f3 + BC ∑ f2f3 − A ∑ f1yw − B ∑ f2yw − C ∑ f3yw)

f(x) yw xi ∑

Χ2

Χ2 Χ2

∂Χ2

∂A

∂∂A

Χ2

XIII. LEAST SQUARES CURVE FITTING - 44

Solving these equations simultaneously for A, B, and C gives our optimum.

Since there are now just three linear equations in three unknowns they are quite solvable.

In fact the equations are so symmetric that we can generalize to n equations in n unknowns onsight.

C. Solution For Non Linear EquationsThis approach was suggested by William Bennett, Jr. in his marvelous book "Scientific andEngineering Problem-Solving with the Computer.

We now want to solve for the optimum parameters, A, B, C, . . . when they occur in a non linearfashion in the expression for y, e.g.:

We will need to store and manipulate the parameters as elements of an array, so we will expressthe equation above as:

1. Linearization of the equation in the parametersThe plan used above for linear parameters won’t work because now the parameters don’tseparate out neatly. Since we don’t know what functions may be required we can’t predictwhere the parameters will be.

If we can guess values for the parameters that are reasonably close to the optimum values thenwe can write an approximate function that is linear in small changes in the parameters.

We will approximate the y(x) by a Taylor expansion around the current best guess, . If therewas only one parameter, A, say then the expansion would look like:

Now we have a linear problem in rather than a non linear problem in A.

This is not as obscure as it looks. We can actually evaluate and

Since this is an approximation the solution will only be approximately correct. However, thecloser we get to the correct solution the better the approximation and the better our solution!.

For several parameters, A(1), A(2), . . ., we will have:

∂Χ2

∂A= 2(A ∑ f1

2 + B ∑ f1f2 + C ∑ f1f3 − ∑ f1yw) = 0

∂Χ2

∂B= 2(A ∑ f1f2 + B ∑ f2

2 + C ∑ f2f3 − ∑ f2yw) = 0

∂Χ2

∂C= 2(A ∑ f1f3 + B ∑ f2f3 + C ∑ f3

2 − ∑ f3yw) = 0

y(x) = A + BeCx cos(Dx + E)

y(x) = A(1) + A(2)eA(3)x cos(A(4)x + A(5))

A(1)optimum = A(1)current guess + ε(1)

Ag

y(A) = y(Ag + ε) ≈ y(Ag) + ε

∂y∂A

Ag

ε

∂y

∂A Ag

y(Ag)

XIII. LEAST SQUARES CURVE FITTING - 45

Let:

The:

Now Equation 1 becomes:

What we have achieved is changing the non-linear problem of solving for the best A(1) etc. to alinear approximation, that of finding the best corrections to the current A s, i.e. the s. We havetraded a solvable approximation for an hopeless exact solution.

yoptimum = y(A(1)optimum + A(2)optimum + ...)

= y(A(1)g,A(2)g, . . .)

+ ε(1)

∂y∂A(1)

A(1)g

+ ε(2)

∂y∂A(2)

A(2)g

+ . . .

yg ≡ y(A(1)g,A(2)g, ...)

D(1) ≡

∂y∂A(1)

evaluated at the current guesses

yoptimum = yg + ε(1)D(1) + ε(2)D(2) + ...

Weighted Least Squares Χ2 ≡ ∑i = 1

n

y(xi) − yi

σm, i

2

= ∑i = 1

n

y(xi) − (yg + ε(1)D(1) + ε(2)D(2) + ...)σm, i

2

ε

XIII. LEAST SQUARES CURVE FITTING - 46