Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser...

36
Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis to determine the order of magnitude of several physical quantities. a) determine the pressure at the center of the earth. Remove@"Global`"D << "MMHTools`DimTools`" Needs@"Miscellaneous`PhysicalConstants`"D The symbols 8c, kB, , g, G, me, amu, Me, Ms, Na, ε0, μ0, e, σ, Rgas< have been assigned SI unit specifiers TableForm@ Thread@8constantsymbols, symboldefs, symbUnits ê constantsymbols<DD c speed of light Meter Second kB Boltzmann's constant Joule Kelvin Planck's constantê2π Joule Second g acceleration due to gravity Meter Second 2 G Gravitational constant Meter 2 Newton Kilogram 2 me mass of electron Kilogram amu mass of proton Kilogram Me mass of Earth Kilogram Ms mass of Sun Kilogram Na Avogadro's number 1 Mole ε0 permittivity of vacuum Ampere Second Meter Volt μ0 permeability of vacuum π Second Volt Ampere Meter e electron charge Coulomb σ radiation constant Watt Kelvin 4 Meter 2 Rgas molar gas constant Joule Kelvin Mole Let d=Radius of earth, r denity of earth body, and G is the gravitional constant AbbasiN93_graded_FINAL.nb 1 Printed by Mathematica for Students

Transcript of Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser...

Page 1: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Physics 229& 100 Homework #9Name: Nasser Abbasi

à 1. Use dimensional reasoning and the tools described in Dimensional Analysis to determine the order of magnitude of several physical quantities.a) determine the pressure at the center of the earth.

Remove@"Global` ∗" D<< "MMHTools`DimTools`"

Needs@"Miscellaneous`PhysicalConstants`" D

The symbols 8c, kB, —, g, G, me, amu, Me, Ms, Na, ε0, µ0, e, σ, Rgas <have been assigned SI unit specifiers

TableForm @Thread @8constantsymbols, symboldefs, symbUnits ê constantsymbols <DD

c speed of light Meter�������������Second

kB Boltzmann's constant Joule�������������Kelvin

— Planck's constant ê2π Joule Second

g acceleration due to gravity Meter���������������Second 2

G Gravitational constant Meter 2 Newton��������������������������Kilogram 2

me mass of electron Kilogram

amu mass of proton KilogramMe mass of Earth Kilogram

Ms mass of Sun Kilogram

Na Avogadro's number 1���������Mole

ε0 permittivity of vacuum Ampere Second��������������������������Meter Volt

µ0 permeability of vacuum π Second Volt�������������������������Ampere Meter

e electron charge Coulomb

σ radiation constant Watt���������������������������Kelvin 4 Meter 2

Rgas molar gas constant Joule����������������������Kelvin Mole

Let d=Radius of earth, r denity of earth body, and G is the gravitional constant

AbbasiN93_graded_FINAL.nb 1

Printed by Mathematica for Students

Page 2: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

dimanal A9ρ ikjj

Kilogram�������������������������

Meter 3

y{zz, d HMeter L, ReduceUnits @ToSymbolsUnits @GDD=,

8Kilogram, Meter, Second <,Newton�������������������Meter 2

êê ReduceUnits E

8d2 Gρ2, 8<<

Hence the order of magnitude of pressure at center of earth is

First @%Dd2 Gρ2

à b) Cooking times for meat are typically given in units such as minutes/pound. This is a fiction devised for the numerically challenged. Using dimensional reasoning, how do you expect the cooking time of a turkey to scale with the mass?

Cooking time should depend on specific heat of turkey cv (amount of heat to raise its temp by one degree), thermal

conductivity of turkey k (how easily heat can flow within the turkey from one spot to another) and size of turkey L

params = 8cv HJoule ê HMeter 3 Kelvin LL,

k HWatt ê HMeter Kelvin LL, L Meter < êê ReduceUnits

9 cv Kilogram������������������������������������������������������Kelvin Meter Second 2 ,

k Kilogram Meter��������������������������������������������

Kelvin Second 3 , L Meter =

AbbasiN93_graded_FINAL.nb 2

Printed by Mathematica for Students

Page 3: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

dimanal @params, 8Kilogram, Meter, Second <, Second D

9 cv L 2�������������

k, 8<=

So cooking time depends on the square of the charaterstic length of the turkey. But we are asked to find how cooking

time depend on the mass.

Since mass = Volume * density. Taking the density to be uniform and the same among all turkies, we see that the

mass is propertional to the volume of the turkey

Hence mass ~ r L3 where r is the density

i.e. I massÅÅÅÅÅÅÅÅÅÅÅÅr

M 1ÅÅÅÅ3 ~ L

But cooking time ~ cvÅÅÅÅÅÅÅk L2

therefore cooking time is ~ I kÅÅÅÅÅÅÅCv massÅÅÅÅÅÅÅÅÅÅÅÅ

rM 2ÅÅÅÅ3

In otherwords, cooking time is ~ M2ÅÅÅÅ3

à c) What is the speed of sound in a monotomic gas ?

monatomic gas is one in which atoms are not bound to each other.

Ask the question: What does the speed of sound in such a gas depend on? Answer: Density of gas, Temp. of gas,

Pressure P

params =

8T HKelvin L, ρ HKilogram ê Meter 3L, P HNewton ê Meter 2L< êê ReduceUnits

9Kelvin T,Kilogram ��������������������������

Meter 3 ,Kilogram P

������������������������������������Meter Second 2 =

AbbasiN93_graded_FINAL.nb 3

Printed by Mathematica for Students

Page 4: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

dimanal @params, 8Kilogram, Meter, Second <, Meter êSecond D

9è!!!!P���������è!!!!ρ

, 8Kelvin T <=

So sound speed ~ è!!!!P�������è!!!!ρ

* f[T] where f[T] is some function of the temprature of the gass. It is a scalar function, so a

f[T] should have some non-dimensional value as a result. I did some research on this and found that for monotomic

gas this value is about 1.3 and f @tD =$%%%%%%%%CpÅÅÅÅÅÅÅÅCv. where Cp is the specific heat of the gas at constant pressure, and Cv is

the specific heat of the gas at constant volume

AbbasiN93_graded_FINAL.nb 4

Printed by Mathematica for Students

Page 5: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

à d) Determine the relation between the speed of waves in deep water ( like the ocean) and the wavelength of the waves. (Hint: what is the restoring force for big waves in the ocean?)

Speed of a wave C = Wave Length (l) * frequency (f)

i.e. C = l f

But 2 pf = w

And if we model the wave going up and down as a mass/spring system, with stiffness K, then this leads to the

standard formula that w="#######KÅÅÅÅÅÅm where K is the stiffness of the wave as it goes up and down, and M is the mass of each

wave.

and we know that from the mass/spring model that

restoring Force = K * displacement

Here the displacement is the average wave hight.

For deep water waves, it is gravity that causes a wave to fall down again after it goes up. Hence the restoring Force is

the weight of the wave

M g = K * wave height

K= M gÅÅÅÅÅÅÅÅÅÅh hence w="########kÅÅÅÅÅÅÅM ="######g

ÅÅÅÅh

So f = wÅÅÅÅÅÅÅÅ2 p ="######gÅÅÅÅh 1ÅÅÅÅÅÅÅÅ2 p

so C = l f

C= l "######gÅÅÅÅh 1ÅÅÅÅÅÅÅÅ2 p

But 2ph = l (since one full cycle over the circle of radius h gives the length of the circumeference, which is the wave

length).

So C = "########glÅÅÅÅÅÅÅÅ2 p

AbbasiN93_graded_FINAL.nb 5

Printed by Mathematica for Students

Page 6: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

à e) Black holes have a characteristic scale known as the event horizon. Use dimensional reasoning to estimate its size.

AbbasiN93_graded_FINAL.nb 6

Printed by Mathematica for Students

Page 7: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

What does event horizon depends on? The event horizon is the distance from the black hole where light does not

escape (escape velocity equals the speed of light). Mass of the black hole must be involved, and the universal

gravtional constant as well. Therefore, I expect that the size must involve G, Mass, and c

params =

9mHKilogram L, Gikjjjj Meter 2 Newton������������������������������������

Kilogram 2

y{zzzz, c HMeter êSecond L= êê ReduceUnits

9Kilogram m,G Meter 3

��������������������������������������������Kilogram Second 2 ,

c Meter��������������������Second

=

AbbasiN93_graded_FINAL.nb 7

Printed by Mathematica for Students

Page 8: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

dimanal @params, 8Kilogram, Meter, Second <, Meter D

9 Gm��������c2 , 8<=

Therefore event horizon ~ Gm������c2

à 2. Boundary value problem : bound states of a quantum particle of mass m in a gravitational field on a hard surface. The Schrodinger equation is

-Ñ2ÄÄÄÄÄÄÄÄÄ2 m

y '' @xD + m g xy@xD ä E y@xD . Because the particle is on a hard,

impenetrable surface, the boundary condition at x=0 is y[0]=0. The other boundary condition is that y[x] is square integrable, i.e. Ÿ0

•yy* ‚ x = 1. The boundary value

problem has solutions only for special values of the energy E. Find the 4 lowest values of E and the associated wave function y[x]. a) Use dimanal from MMHTools`DimTools` to determine the natural units of length and energy for this problem. Perform a change of variables ( using Change Variables from MMHTools`DETools`) to express the Schrödinger equation in terms of dimensionless variables.

Remove@"Global` ∗" D;

<< "MMHTools`DimTools`"

<< "MMHTools`DETools`"

<< Miscellaneous`PhysicalConstants`

The symbols 8c, kB, —, g, G, me, amu, Me, Ms, Na, ε0, µ0, e, σ, Rgas <have been assigned SI unit specifiers

Make symbols for the dimensionless quantities for ease of reading

Needs@"Utilities`Notation`" D;

DynamicSymbolize @f_, k_ D : =

Symbolize @NotationBoxTag @SubscriptBox @f, k DDDDynamicSymbolize @"x", "r" D;

DynamicSymbolize @" ψ", "r" D;

Now defined the ODE

AbbasiN93_graded_FINAL.nb 8

Printed by Mathematica for Students

Page 9: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

ode = −—2

���������2 m

ψ '' @xD + m g x ψ@xD En ψ@xD

g m xψ@xD −—2 ψ′′@xD����������������������

2 m En ψ@xD

The parameters involved in the ODE are m,g, Ñ and E

condp = 8m Kilogram, g , —< êê ToSymbolsUnits êê ReduceUnits

9Kilogram m,g Meter���������������������Second 2 ,

Kilogram Meter 2 —����������������������������������������������

Second=

Find what is the length x is propertional to (this is the independent variable)

dimanal @condp, 8Kilogram, Meter, Second, Coulomb <, Meter D

9 —2ê3���������������������g1ê3 m2ê3 , 8<=

mainTerm = First @%D—2ê3

���������������������g1ê3 m2ê3

Hence Dx= xr( —2ê3���������������g1ê3 m2ê3 M where xr is the constant of propertionality

Do a change of variable to change x in the ODE to the above

ode1 = ChangeVariable @ode, x → x r HmainTerm L, ψ, ψ, x, x r D1����2

g2ê3 m1ê3—

2ê3 H2 x r ψ@x r D − ψ′′@x r DL En ψ@x r D

Now change the energy E to be dimensionless

AbbasiN93_graded_FINAL.nb 9

Printed by Mathematica for Students

Page 10: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

dimanal @condp,

8Kilogram, Meter, Second, Coulomb <, ReduceUnits @Joule DD8g2ê3 m1ê3 —2ê3, 8<<

mainTerm = First @%Dg2ê3 m1ê3 —2ê3

So E~ er * g2ê3 m1ê3 —2ê3

ode2 = ChangeVariable @ode1, En → λ HmainTerm L , ψ, ψr , x r , x r Dg2ê3 m1ê3

—2ê3 H−2 Hx r − λL ψr @x r D + ψr

′′@x r DL 0

We see from the above that we get g2ê3 m1ê3 —2ê3 Times expression of the reduced ODE ==0. Hence we can divide

both sides by g2ê3 m1ê3 —2ê3 to remove it, we get

ode2 = ode2 ê. mainTerm → 1

−2 Hx r − λL ψr @x r D + ψr′′@x r D 0

AbbasiN93_graded_FINAL.nb 10

Printed by Mathematica for Students

Page 11: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

ode2 = Simplify @ode2D2 Hx r − λL ψr @x r D ψr

′′@x r D

The above represents the ODE in its dimensionless form. l is now the eigenvalue of the ODE

AbbasiN93_graded_FINAL.nb 11

Printed by Mathematica for Students

Page 12: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

à b) Use finite differences to estimate the first few eigenvalues, and plot the first 4 eigenfunctions. ( use finitedifEVP from the Boundary Value Problems notebook; either copy and paste into this notebook, or execute the relevant lines in the browser. ) Explain how you deal with the boundary condition at •.

Needs@"LinearAlgebra`MatrixManipulation`" D;

finitedifEVP @de_, bc_, xRange_, lam_, yvar_, xvar_,

npts_, verbose_ D : = Block @8fdsub, bcrules, n, evals,

evecs, sortvals, mat, fe, fs, h, elimb1, elimb2, B1, B2 <,

H∗ check input ∗LIf @MatchQ@de, XX_ YY_D, Null,

Print @" input DE must be an equation" D; Goto @bail DD;

If @FreeQ@de, lam D, Print @"Error: no ", lam, " in de " D;

Goto @bail D, Null D;

If @Head@lam D === Symbol, Null, Print @"eigenvalue parameter must be a simple Symbol" D; Goto @bail DD;

If @FreeQ@bc, yvar @xRange@@1DDD, Infinity D &&

FreeQ@bc, yvar ' @xRange@@1DDD, Infinity D, Print @" lower boundary condition seems wrong " D; Goto @bail D, Null D;

If @FreeQ@bc, yvar @xRange@@2DDD, Infinity D &&

FreeQ@bc, yvar ' @xRange@@2DDD, Infinity D, Print @" upper boundary condition seems wrong " D; Goto @bail D, Null D;

H∗ ∗LH∗ define lattice spacing ∗Lh = H1.000 L HxRange@@2DD − xRange@@1DDL ê Hnpts − 1L;

H∗ define finite difference rules ∗Lfdyvar = ToExpression @"fd" <> SymbolName@yvar DD;

fdsub = 8yvar @xvar D → fdyvar @nD,

yvar ' @xvar D → Hfdyvar @n + 1D − fdyvar @n − 1DL ê H2 hL,

yvar '' @xvar D → Hfdyvar @n + 1D − 2 fdyvar @nD + fdyvar @n − 1DL ê h^2 <;

fdeq = de ê. fdsub;

fdeq = fdeq ê. xvar → H1.000 L ∗ xRange@@1DD + Hn − 1L h;

If @verbose, Print @"finite dif equations = ", fdeq D, Null D;

H∗ evaluate boundary conditions ∗Lbceqs = bc êê. 8yvar @xRange@@1DDD → fdyvar @1D,

yvar @xRange@@2DDD → fdyvar @npts D,

yvar ' @xRange@@1DDD → Hfdyvar @2D − fdyvar @1DL ê h,

yvar ' @xRange@@2DDD → Hfdyvar @npts D − fdyvar @npts − 1DL ê h<;

bceqs = Sort @bceqs D;

If @verbose, Print @"boundary condition eqs = ", bceqs D, Null D;

H∗ evaluate equations in the interior region ∗Lelimb1 = First @Solve @bceqs, fdyvar @1DDD;

H∗ rules to eliminate end point variables ∗Lelimb2 = First @Solve @bceqs, fdyvar @npts DDD;

interioreqs = Table @fdeq, 8n, 2, npts − 1<D;

AbbasiN93_graded_FINAL.nb 12

Printed by Mathematica for Students

Page 13: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

If @verbose, 8matall, rhs < = LinearEquationsToMatrices @Append@Prepend @interioreqs, bceqs @@1DDD, bceqs @@2DDD,

Table @fdyvar @i D, 8i, 1, npts <DD;

Print @"all eqs mat = ", MatrixForm @matall DD, Null D;

B1 = 1; B2 = npts;

eqs = interioreqs;

H∗ if the endpoints don' t contain lam, eliminate them ∗LIf @FreeQ@elimb1, lam D, eqs = interioreqs ê. elimb1;

B1 = 2, eqs = PrependTo @interioreqs, bceqs @@1DDDD;

If @FreeQ@elimb2, lam D, eqs = eqs ê. elimb2;

B2 = npts − 1, AppendTo @eqs, bceqs @@2DDDD;

H∗ construct matrix version of de ∗L8mat, rhs < =

LinearEquationsToMatrices @eqs, Table @fdyvar @i D, 8i, B1, B2 <DD;

If @verbose, Print @"mat = ", MatrixForm @matDD, Null D;

If @verbose, Print @"rhs = ", rhs D, Null D;

diagcoeffs = DiagonalMatrix @Table @−1 êCoefficient @mat@@i, i DD, lam D, 8i, 1, Length @matD<DD;

mat2 = Hdiagcoeffs.mat L ê. lam → 0;

8evals, evecs < = Eigensystem @mat2D;

H∗ sort eigenvalues

and eigenvectors with smallest first , i.e.

lowest eigenvalue is evals @@1DD & corresponding

eigenvector is evecs @@1DD ∗L8evals, evecs < = Transpose @Sort @Transpose @8evals, evecs <DDD;

H∗ fix the end points ∗Loffset = B1 − B2 + npts − 1;

Which @offset 0, Null,

offset 1 && B1 1,

Do@fe = Hfdyvar @npts D ê. elimb2 L ê.

fdyvar @qn_D : > evecs @@i, qn − offset DD;

AppendTo@evecs @@i DD, fe D, 8i, 1, npts − 1<D,

offset 1 && B1 2,

Do@fs =

Hfdyvar @1D ê. elimb1 L ê. fdyvar @qn_D : > evecs @@i, qn − offset DD;

PrependTo @evecs @@i DD, fs D, 8i, 1, npts − 1<D,

True,

Do@8fs, fe < = 8fdyvar @1D ê. elimb1, fdyvar @npts D ê. elimb2 <;

8fs, fe < = 8fs, fe < ê. fdyvar @qn_D : > evecs @@i, qn − offset + 1DD;

evecs @@i DD = Prepend @AppendTo@evecs @@i DD, fe D, fs D,

8i, 1, npts − 2<DD;

H∗ add x values to evecs so that

evecs contains 8x,y < pairs for plotting ∗L

AbbasiN93_graded_FINAL.nb 13

Printed by Mathematica for Students

Page 14: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

xv = Table @xRange@@1DD + Hi − 1L h, 8i, 1, npts <D;

evecs2 =

Table @Transpose @8xv, evecs @@i DD<D, 8i, 1, Length @evecs D<D;

Label @bail D;

8evals, evecs2 <D

— General::spell1 : Possible spelling error: new

symbol name "evals" is similar to existing symbol "bvals". More…— General::spell1 : Possible spelling error: new symbol

name "offset" is similar to existing symbol "Offset". More…

I used y[xFarWay]ã0 as the upper boundary condition. Becuase that should be far enough to approximate infinity

for this problem. The square integrable B.C. tells us that the solution should be zero far away.

xFarEnough = 100;

8evc, evcs < = finitedifEVP @ode2,

8ψr @0D 0, ψr @xFarEnough D 0<, 80, xFarEnough <, λ, ψr , x r , 4, False D— General::spell : Possible spelling error: new symbol

name "evcs" is similar to existing symbols 8evc, evecs <. More…

8833.3342, 66.6676 <,

8880, 0 <, 833.3333, 1. <, 866.6667, 0.0000135 <, 8100., 0 <<,

880, 0 <, 833.3333, −0.0000135 <, 866.6667, 1. <, 8100., 0 <<<<

evcs êê TableForm

00

33.33331.

66.66670.0000135

100.0

00

33.3333−0.0000135

66.66671.

100.0

AbbasiN93_graded_FINAL.nb 14

Printed by Mathematica for Students

Page 15: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

evc êê TableForm

33.3342

66.6676

à c) Solve the same equation using the shooting method. The shooting method also requires a finite interval. Recall that the shooting method can be unstable for large values of xr, so you may need to experiment with the appropriate form of the boundary conditon at the right hand boundary.

ψp0 = 1;

ode2

2 Hx r − λL ψr @x r D ψr′′@x r D

Solve using shooting method by looking for solution that makes y goes to zero far away. I used x=100 value to

represent far away or infinity.

AbbasiN93_graded_FINAL.nb 15

Printed by Mathematica for Students

Page 16: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

ψAtFar @ψp0_ ?NumericQ, eigenValue_ ?NumericQ D : =

ψr @1D ê. NDSolve @8ode2 ê. λ → eigenValue, ψr @0D 0, ψr ' @0D ψp0<,

ψr , 8x r , 0, xFarEnough <D êê First

Plot @ψAtFar @ψp0, eigenValue D, 8eigenValue, 1, 100 <, FrameLabel →

8" λ", " ψr @100D", "Showing dependency of solution on eigenvalue",

None<, Frame → True D;

0 20 40 60 80 100λ

-0.2

0

0.2

0.4

0.6

0.8

ψr@

00

1D

Showing dependency of solution on eigenvalue

The above shows where y(x) will be zero as a function of the eigenvalue l. Now use FindRoot to find the smallest 4

eigenvalues

FindRoot @ψAtFar @ψp0, λD, 8λ, 5 <D8λ → 5.43261 <

FindRoot @ψAtFar @ψp0, λD, 8λ, 20 <D8λ → 20.2399 <

FindRoot @ψAtFar @ψp0, λD, 8λ, 45 <D8λ → 44.9136 <

AbbasiN93_graded_FINAL.nb 16

Printed by Mathematica for Students

Page 17: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

FindRoot @ψAtFar @ψp0, λD, 8λ, 80 <D8λ → 79.4571 <

à d) This problem is somewhat unusual because an exact analytical solution can be found. Use DSolve to find analytic expressions for the eigenfucntions, and use FindRoot to numerically estimate the eigenvalues. Hint: solve the problem without imposing the boundary conditions. The solution will be a linear combination of two functions. Argue that one of them diverges at x-> •, so cannot be part of the solution. Then find the values of er which satisfy the boundary condition at xr=0.

sol = ψr @x r D ê. Flatten @DSolve @ode2, ψr @x r D, x r DD

AiryAi A 2 x r − 2 λ�����������������������

22ê3 E C@1D + AiryBi A 2 x r − 2 λ�����������������������

22ê3 E C@2D

Now I have 2 solutions being added togother to give a general solution. From the boundary condition that tells us

Ÿ0

¶yy* „ x = 1 it implies that solution is zero at zero, and also zero at far away. So I plot each of the above solutions,

then see which solution blow up as x gets large. Then I discard this solution since it would not lead to the boundary

condition given.

Plot @AiryAi @xD, 8x, 0, 10 <, PlotRange → All D;

2 4 6 8 10

0.05

0.1

0.15

0.2

0.25

0.3

0.35

So the above tells me that I need to keep the solution associated with AiryAi, which is the solution that is associated

with C[1]. Now look the second solution

AbbasiN93_graded_FINAL.nb 17

Printed by Mathematica for Students

Page 18: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Plot @AiryBi @xD, 8x, 0, 10 <, PlotRange → All D;

2 4 6 8 10

1×108

2×108

3×108

4×108

We see that AiryBi blows up, hence C[2] must be zero to avoid this solution. Hence solution is

sol = sol ê. first_ + second_ → first

— General::spell1 : Possible spelling error: new

symbol name "first" is similar to existing symbol "First". More…

AiryAi A 2 x r − 2 λ�����������������������

22ê3 E C@1D

Since C[1] is a constant, I can set it to 1

sol = sol ê. C @1D → 1

AiryAi A 2 x r − 2 λ�����������������������

22ê3 E

So the above now is the solution for y. there is an eigenvalue l that the solution depends on. Now find l which

makes this solution go to zero at xr = 0

sol = sol ê. x r → 0

AiryAi @−21ê3 λD

AbbasiN93_graded_FINAL.nb 18

Printed by Mathematica for Students

Page 19: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Plot @sol, 8λ, 0, 10 <D;

2 4 6 8 10

-0.4

-0.2

0.2

0.4

We now can find few l's which will make the solution y be zero at zero bu using FindRoot

FindRoot @sol, 8λ, 2 <D8λ → 1.85576 <

FindRoot @sol, 8λ, 5 <D8λ → 5.38661 <

AbbasiN93_graded_FINAL.nb 19

Printed by Mathematica for Students

Page 20: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

FindRoot @sol, 8λ, 6.5 <D8λ → 6.30526 <

Ok, problem completed.

à 3. Find a representation in terms of Fourier series for the periodic function with period 1 which is generated by semicircles as shown in the Figure below. Make a plot which compares the function and the series approximation.

Since the function is periodic, it can be expanded by Fourier series, since a fourier series approximates periodic

functions only.

Plot the above function

Remove@"Global` ∗" DNeeds@"Graphics`Colors`" D;

<< Graphics`Animation`

r = .5; y0 = .5; x0 = 0.5;

fMain @x_ D : = If Ax <= 0., 0, base = Floor @xD;

newX = x − base; N A−"########################################r 2 − HnewX− x0L2 + y0EE;

fOnePeriod @x_ D : = Piecewise A9 80, x ≤ 0<, 9NA−"################################

r 2 − Hx − x0L2 + y0 E, 0 ≤ x < 1=, 80 , 1 ≤ x<=E

AbbasiN93_graded_FINAL.nb 20

Printed by Mathematica for Students

Page 21: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Plot @fMain @xD, 8x, 0, 3 <,

AxesOrigin → 80, 0 <, AspectRatio → Automatic,

PlotLabel −> "f @xD over many periods", ImageSize → 500D;

0.5 1 1.5 2 2.5

0.10.20.30.40.5

f @xD over many periods

AbbasiN93_graded_FINAL.nb 21

Printed by Mathematica for Students

Page 22: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Plot @fOnePeriod @xD, 8x, 0, 3 <,

AxesOrigin → 80, 0 <, AspectRatio → Automatic,

PlotLabel −> "f @xD over one period", ImageSize → 500D;

0.5 1 1.5 2 2.5

0.10.20.30.40.5

f @xD over one period

generate a list of the a[n] and b[n].

maxN= 10;

H∗10 terms is more than enough to get very good approximation ∗Lfrom = 0;

to = 1;

period = 1;

H∗Always use the period of the function we want to approximate ∗L

a0 =1

����������������period�������������

2

NIntegrate @fOnePeriod @xD, 8x, from, to <D;

a = ChopANATable A 1

����������������period�������������

2

‡from

to

CosA n π x����������������

period�������������

2

E fOnePeriod @xD �x, 8n, 1, maxN <EEE;

b = ChopANATable A 1����������������

period�������������

2

‡from

to

Sin A n π x����������������

period�������������

2

E fOnePeriod @xD �x,

8n, 1, maxN <EEE;

xseries @x_, maxN_ D : =

1����2 a0 +„

n=1

maxNikjjjjj a@@nDD CosA n π x

����������������period�������������

2

E + b@@nDD Sin A n π x����������������

period�������������

2

E y{zzzzz;

Now plot the approximation over one period of the function

AbbasiN93_graded_FINAL.nb 22

Printed by Mathematica for Students

Page 23: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

Do@Plot @Evaluate @8xseries @x, n D, fMain @xD<D,

8x, 0, 1 <, AxesOrigin → 80, 0 <,

AspectRatio → Automatic, PlotRange → 880, 1 <, 80, .5 <<,

ImageSize → 300, PlotStyle → 8Black, Red <,

PlotLabel → "n =" <> ToString @n − 1DD, 8n, 1, maxN <D

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=0

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=1

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=2

AbbasiN93_graded_FINAL.nb 23

Printed by Mathematica for Students

Page 24: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=3

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=4

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=5

AbbasiN93_graded_FINAL.nb 24

Printed by Mathematica for Students

Page 25: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=6

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=7

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=8

AbbasiN93_graded_FINAL.nb 25

Printed by Mathematica for Students

Page 26: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.2 0.4 0.6 0.8 1

0.1

0.2

0.3

0.4

0.5n=9

Now plot the approximation over many periods

Do@Plot @Evaluate @8xseries @x, n D, fMain @xD<D,

8x, 0, 3 <, AxesOrigin → 80, 0 <,

AspectRatio → Automatic, PlotRange → 880, 3 <, 80, 1 <<,

ImageSize → 400, PlotStyle → 8Black, Red <,

PlotLabel → "n =" <> ToString @n − 1DD, 8n, 1, maxN <D

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=0

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=1

AbbasiN93_graded_FINAL.nb 26

Printed by Mathematica for Students

Page 27: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=2

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=3

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=4

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=5

AbbasiN93_graded_FINAL.nb 27

Printed by Mathematica for Students

Page 28: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=6

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=7

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=8

AbbasiN93_graded_FINAL.nb 28

Printed by Mathematica for Students

Page 29: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1n=9

Function for animation

AnimateToClosedGroup @graphicslist_, animationdisplaytime_ D : =

HNotebookWrite @EvaluationNotebook @D,

CellGroupData @Table @Cell @GraphicsData @"PostScript",

DisplayString @graphicslist @@i DDDD, "Graphics" D,

8i, Length @graphicslist D<D, Closed D, After D;

SelectionMove @EvaluationNotebook @D, Previous, CellGroup D;

SelectionAnimate @EvaluationNotebook @D,

Length @graphicslist D ∗ animationdisplaytime,

AnimationDisplayTime → animationdisplaytime DLthese below are animations.

plotlist = Table @Show@Plot @Evaluate @8xseries @x, n D, fMain @xD<D,

8x, 0, 1 <, AxesOrigin → 80, 0 <, AspectRatio → Automatic,

PlotRange → 880, 1 <, 80, .6 <<, DisplayFunction → Identity,

ImageSize → 400, PlotStyle → 8Black, Red <,

PlotLabel → "n =" <> ToString @nDDD, 8n, 1, 10, 1 <D;

AnimateToClosedGroup @plotlist, .5 D

AbbasiN93_graded_FINAL.nb 29

Printed by Mathematica for Students

Page 30: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

0.2 0.4 0.6 0.8

0.1

0.2

0.3

0.4

0.5

n=1

Below is animation of the whole function

plotlist = Table @Show@Plot @Evaluate @8xseries @x, n D, fMain @xD<D,

8x, 0, 3 <, AxesOrigin → 80, 0 <, AspectRatio → Automatic,

PlotRange → 880, 3 <, 80, .6 <<, DisplayFunction → Identity,

ImageSize → 600, PlotStyle → 8Black, Red <,

PlotLabel → "n =" <> ToString @n − 1DDD, 8n, 1, 10, 1 <D;

AnimateToClosedGroup @plotlist, .5 D

0.5 1 1.5

0.1

0.2

0.3

0.4

0.5

n=0

AbbasiN93_graded_FINAL.nb 30

Printed by Mathematica for Students

Page 31: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

à 4. A triangle function is zero for »x»>a, and has magnitude L at x=0 as shown in the figure.

à Calculate the Fourier transform of this function.

Since the function is not periodic, it can not be approximated by Fourier series since a fourier series approximates

periodic functions only. We need to use fourier transform.

Remove@"Global` ∗" D;

Do a sketch to make sure I got the function definition ok first. Pick some values for 'a' and 'L'

a = 3;

L = 1;

f @x_ D : = Piecewise A9 80, x < −a<, 80, x > a<, 9L + J L

����aN x, −a ≤ x < 0=, 9L −

L����a x, 0 ≤ x < a==E

Plot @f @xD, 8x, −4, 4 <, AxesOrigin → 80, 0 <D;

-4 -2 2 4

0.2

0.4

0.6

0.8

1

It looks Ok, now write the fourier transform

AbbasiN93_graded_FINAL.nb 31

Printed by Mathematica for Students

Page 32: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

g@ω_D : =1

��������2 π

‡−a

a

f @xD �−� ω x �x

Plot @Evaluate @g@ωDD, 8ω, −10, 10 <,

PlotRange → All, AxesLabel → 8" ω", "F @ωD" <D;

-10 -5 5 10ω

0.1

0.2

0.3

0.4

F@ωD

AbbasiN93_graded_FINAL.nb 32

Printed by Mathematica for Students

Page 33: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

à 5(grads). The wave function for the electron in the ground state of hydrogen is

y1HrL =�−rêa0

����������������è!!!!π a03ê2

, where a0 is a unit of length (Bohr radius) and r is the spherical

position coordinate. a) Verify that this wave function is normalized.

à b) y1HrL lives in 3 dimensional space. The Fourier transform y1HkL= 1ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄH2 pL3ê2

Ÿ „‰ k”◊x”÷

y1HrL d3 x lives in 3 dimensional k space; y1HkL represents the amplitude to have a momentum p=Ñ k. Choose a coordinate system with the z axis aligned along k

”, and

perform the integration.

à c) verify that y1HkL is normalized. y1HkLy1*HkL is the probability density of k. What is

the most probable value of the magnitude of k?

à 6. Make a plot of the prime interest rate as a function of time from 1949 to the present. The data can be found at http://www.federalreserve.gov/releases/h15/data.htm ( go to Bank prime loan and click on Monthly). Use your browser , and "save as" to save a copy of the file on your local hard drive. Use Drop to remove the header information. You will have to convert data records such as 01/1949 , which are strings, into numbers. Use decimal years , so the string 01/1949 should be represented as 1949.08. Process the data using pattern matching, Take, Drop, and StringTake . ToExpression will convert strings into numbers.

Remove@"Global` ∗" Dlocaldata =

"E:\\nabbasi\\data\\nabbasi_web_Page\\my_courses\\U CI_COURSES\\

CREDIT_COURSES\\fall_2006\\PHYS_100_comp_physics\\H Ws\\HW9";

data = Import @localdata <> "\\H15_PRIME_NA.txt", "Lines" D;

Dimensions @data D8703<

Find which line number the header goes to, by trial and error

data @@8DDDATE , PRIMENA

AbbasiN93_graded_FINAL.nb 33

Printed by Mathematica for Students

Page 34: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

data @@9DD01ê1949, 2.00

So I need to remove the first 8 lines

data = Drop @data, 8 D;

AbbasiN93_graded_FINAL.nb 34

Printed by Mathematica for Students

Page 35: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

data @@1DD01ê1949, 2.00

Ok, now data has only rows of actual data to use. Now convert date such as 01/1949 to 1949.08

cleanData = 8<;

This function below parses ONE line. It is called by the main loop. It takes one line and returns a list of 2 entries.

One for the date in correct decimal format, and the second entry is the interest rate. all converted to numbers.

processLine @line_ D : = Module @8date, interest, month, year <,

8from, to < = Flatten @StringPosition @line, "," DD;

H∗find where the comma is ∗Ldate = StringTake @line, 81, from − 1<D;

interest = StringTake @line, 8from + 1, StringLength @line D<D;

8from, to < = Flatten @StringPosition @date, " ê" DD;

H∗find where the slash is ∗Lmonth = StringTake @date, 81, from − 1<D;

year = StringTake @date, 8from + 1, StringLength @date D<D;

H∗now convert to numbers ∗Lmonth = ToExpression @month D ê 12;

date = ToExpression @year D + month;

N@8date, ToExpression @interest D<DD;

This is the main program below. It called the above function in a loop to process all lines

Do@AppendTo@cleanData, processLine @data @@nDDDD, 8n, 1, Length @data D<D;

Now plot it

AbbasiN93_graded_FINAL.nb 35

Printed by Mathematica for Students

Page 36: Physics 229& 100 Homework #9 Name: Nasser Abbasi · Physics 229& 100 Homework #9 Name: Nasser Abbasi à 1. Use dimensional reasoning and the tools described in Dimensional Analysis

ListPlot @cleanData, AxesLabel → 8"time", "interest rate" <,

PlotLabel −> "prime interest rate as a function of time from

1949 to the present", ImageSize → 600, PlotJoined → True D;

1960 1970 1980

5

10

15

20

interest rateprime interest rate as a function of time from 1949

AbbasiN93_graded_FINAL.nb 36

Printed by Mathematica for Students