Numerical Methods in Physics Camilla Westrin

0.4pt0pt 0pt0.5pt

Numerical Methods in Physics

Camilla Westrin (ayrin@acc.umu.se)

2 maj 2012

Numerical Methods in Physics Camilla Westrin

2 EXCERCISE 2

1 Excercise 1

1.1 Variables calculated for known object

Calculating moment of inertia around an axis through the tip of the top, perpendicular to the symmetry axis I_{1}, the moment of inertia around the symmetry axis I_{3}, the mass M and center of mass l for a homogenous cone with height h = 5 cm, top radius r = 5 cm and density ρ = 1g/cm^{3}.

M = Volume ∗ Density = \frac{π}{3} ∗ 5^{3} ∗ 1 = \frac{125π}{3} ≈ 130.8997

l = \frac{3}{4}h = \frac{15}{4} = 3.75

I_{1} = \frac{3M}{5} (\frac{r^{2}}{4} + h^{2}) = \frac{3 ∗ 125π}{15} (\frac{5^{2}}{4} + 5^{2}) ≈ 2454.3693

I_{3} = \frac{3}{10}Mr^{2} = \frac{3}{10} \frac{125π}{3} 5^{2} = \frac{9375π}{30} ≈ 981.7477

1.2 Results from test runs

Object  I_{1}  I_{3}  M  l
Analytic 2454.3693 981.7477 130.8997 3.75
cone.o 2454.369 981.7477 130.8997 3.75
top1.o 1215.005 482.5677 100.9551 3.0063
top2.o - - - -
top3.o 202.5644 12.30290 21.30722 2.9241
top4.o 177.4822 13.96901 24.83551 2.5006

2 Excercise 2

2.1 First order equations used

The six equations used are preceded by f[number]. The other three are substitutions used.

ϕ = y_{0}
f[0] = ϕ̇ = y_{1};
ψ = y_{2}
f[2] = ψ̇ = y_{3};
θ = y_{4}

Numerical Methods in Physics Camilla Westrin

3 EXCERCISE 3

f[4] = θ̇ = y_{5};

f[1] = ϕ̈ = \frac{I_{3}}{I_{1}} (\frac{y_{5}y_{1} cos(y_{4})}{sin(y_{4})}) + \frac{y_{3}y_{5}}{sin(y_{4})} − 2y_{5}y_{1} cot(y_{4})

f[3] = ψ̈ = y_{1}y_{5} sin(y_{4}) + 2y_{5}y_{1} \frac{cos^{2}(y_{4})}{sin(y_{4})} − \frac{I_{3}}{I_{1}} (\frac{y_{1}y_{5} cos^{2}(y_{4})}{sin(y_{4})} + y_{3}y_{5} cot(y_{4}))

f[5] = θ̈ = \frac{Mgl}{I_{1}} sin(y_{4}) + y_{1}^{2} sin(y_{4}) cos(y_{4}) − \frac{I_{3}}{I_{1}} (y_{3} + y_{1} cos(y_{4}))y_{1} sin(y_{4})

3 Excercise 3

3.1 Derivations for excercise 3

T (θ_{k}) = \frac{I_{3}}{2} [ \begin{matrix}s & 0 & 0 \\ 0 & s sin^{2} θ_{k} + cos^{2} θ_{k} & cos θ_{k} \\ 0 & cos θ_{k} & 1 \end{matrix} ]

Δk = [ \begin{matrix}(θ_{k+1} − θ_{k})/h \\ (ϕ_{k+1} − ϕ_{k})/h \\ (ψ_{k+1} − ψ_{k})/h \end{matrix} ]

T_{v} = [ \begin{matrix}Δ_{k}^{T} \frac{∂T}{∂θ} |_{θ_{k}}Δ_{k} + Mgl sin θ_{k} \\ 0 \\ 0 \end{matrix} ] =

\frac{I_{3}}{2} (k_{ϕ}^{2}(2s − 2) cos θ_{k} sin θ_{k} − k_{ϕ}k_{ψ} sin θ_{k} − k_{ψ}k_{ϕ} sin θ_{k} + Mgl sin θ_{k}) 0 0

T^{−1}(θ_{k}) = \frac{2}{I_{3}} [ \begin{matrix}1/s & 0 & 0 \\ 0 & \frac{1}{s sin^{2} θ_{k}} & −\frac{cos θ_{k}}{s sin^{2} θ_{k}} \\ 0 & −\frac{cos θ_{k}}{s sin^{2} θ_{k}} & −\frac{s sin^{2} θ_{k}+cos^{2} θ_{k}}{s sin^{2} θ_{k}} \end{matrix} ]

T (θ_{k})Δ_{k} = T (θ_{k−1})Δ_{k−1} + \frac{hT_{v}}{2}  (3.1.1)

As given in the intructions, we should multiply equation 3.1.1 with T^{−1} to produce the stepper, 3.1.2.

T^{−1}(θ_{k})T (θ_{k})Δ_{k} = T^{−1}(θ_{k})T (θ_{k−1})Δ_{k−1} + T^{−1}(θ_{k})\frac{hT_{v}}{2}  (3.1.2)

Written in matrix-form this gives:

Numerical Methods in Physics Camilla Westrin 3 EXCERCISE 3

[ \begin{matrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix} ] [ \begin{matrix}(θ_{k+1} − θ_{k})/h \\ (ϕ_{k+1} − ϕ_{k})/h \\ (ψ_{k+1} − ψ_{k})/h \end{matrix} ] = (3.1.3)

[ \begin{matrix}1 & 0 & 0 \\ 0 & \frac{s sin^{2} θ_{k−1}+cos^{2} θ_{k−1}}{s sin^{2} θ_{k}} − \frac{cos θ_{k} cos θ_{k−1}}{s sin^{2} θ_{k}} & \frac{cos θ_{k−1}−cos θ_{k}}{s sin^{2} θ_{k}} \\ 0 & \frac{(s sin^{2} θ_{k}+cos^{2} θ_{k}) cos θ_{k−1}−(s sin^{2} θ_{k−1}+cos^{2} θ_{k−1}) cos θ_{k}}{s sin^{2} θ_{k}} & \frac{s sin^{2} θ_{k}+cos^{2} θ_{k}−cos θ_{k} cos θ_{k−1}}{s sin^{2} θ_{k}} \end{matrix} ] [ \begin{matrix}(θ_{k} − θ_{k−1})/h \\ (ϕ_{k} − ϕ_{k−1})/h \\ (ψ_{k} − ψ_{k−1})/h \end{matrix} ] + (3.1.4)

\frac{h}{2s} [ \begin{matrix}(k_{ϕ}^{2}(2s − 2) cos θ_{k} sin θ_{k} − k_{ϕ}k_{ψ} sin θ_{k} − k_{ψ}k_{ϕ} sin θ_{k} + Mgl sin θ_{k}) \\ 0 \\ 0 \end{matrix} ]

Which can be further simplified as

[ \frac{θ_{k+1}−θ_{k}}{h} ; \frac{ϕ_{k+1}−ϕ_{k}}{h} ; \frac{ψ_{k+1}−ψ_{k}}{h} ] =

[ \frac{θ_{k}−θ_{k−1}}{h} \frac{\frac{ϕ_{k}−ϕ_{k−1}}{h} (s sin^{2} θ_{k−1}+cos^{2} θ_{k−1})+ \frac{ψ_{k}−ψ_{k−1}}{h} cos θ_{k−1}−cos θ_{k}( \frac{ϕ_{k}−ϕ_{k−1}}{h} cos θ_{k−1}+ \frac{ψ_{k}−ψ_{k−1}}{h})}{s sin^{2} θ_{k}} \frac{(s sin^{2} θ_{k}+cos^{2} θ_{k})( \frac{ϕ_{k}−ϕ_{k−1}}{h} cos θ_{k−1}+ \frac{ψ_{k}−ψ_{k−1}}{h})−cos θ_{k}( \frac{ϕ_{k}−ϕ_{k−1}}{h} (s sin^{2} θ_{k−1}+cos^{2} θ_{k−1})+ \frac{ψ_{k}−ψ_{k−1}}{h} cos θ_{k−1})}{s sin^{2} θ_{k}} ] +

\frac{h}{2s} [ \begin{matrix}k_{ϕ}^{2}(2s − 2) cos θ_{k} sin θ_{k} − k_{ϕ}k_{ψ} sin θ_{k} − k_{ψ}k_{ϕ} sin θ_{k} + Mgl sin θ_{k} \\ 0 \\ 0 \end{matrix} ]

We split this by row to get the following three equations

\frac{θ_{k+1} − θ_{k}}{h} = \frac{θ_{k} − θ_{k−1}}{h} + \frac{h}{2s}(k_{ϕ}^{2}(2s − 2) cos θ_{k} sin θ_{k} − k_{ϕ}k_{ψ} sin θ_{k} − k_{ψ}k_{ϕ} sin θ_{k} + Mgl sin θ_{k}) =

θ_{k} + \frac{h}{2s}((\frac{ϕ_{k+1} − ϕ_{k}}{h})^{2}(2s − 2) cos θ_{k} sin θ_{k} − 2\frac{ϕ_{k+1} − ϕ_{k}}{h} \frac{ψ_{k+1} − ψ_{k}}{h} sin θ_{k} + Mgl sin θ_{k}) ⇒

θ_{k+1} = 2θ_{k} − θ_{k−1} + \frac{1}{2s}((ϕ_{k+1} − ϕ_{k})^{2}(2s − 2) cos θ_{k} sin θ_{k} − 2(ϕ_{k+1} − ϕ_{k})(ψ_{k+1} − ψ_{k}) sin θ_{k}+

Mgl sin θ_{k}h^{2})

ϕ_{k+1} = \frac{\frac{ϕ_{k}−ϕ_{k−1}}{h} (s sin^{2} θ_{k−1} + cos^{2} θ_{k−1}) + \frac{ψ_{k}−ψ_{k−1}}{h} cos θ_{k−1}}{s sin^{2} θ_{k}} h−

\frac{cos θ_{k}(\frac{ϕ_{k}−ϕ_{k−1}}{h} cos θ_{k−1} + \frac{ψ_{k}−ψ_{k−1}}{h})}{s sin^{2} θ_{k}}h + ϕ_{k} =

\frac{(ϕ_{k} − ϕ_{k−1})(s sin^{2} θ_{k−1} + cos^{2} θ_{k−1}) + (ψ_{k} − ψ_{k−1}) cos θ_{k−1}}{s sin^{2} θ_{k}} −

\frac{cos θ_{k}((ϕ_{k} − ϕ_{k−1}) cos θ_{k−1} + (ψ_{k} − ψ_{k−1}))}{s sin^{2} θ_{k}} + ϕ_{k}

Numerical Methods in Physics Camilla Westrin

3 EXCERCISE 3

ψ_{k+1} = \frac{(s sin^{2} θ_{k} + cos^{2} θ_{k})(\frac{ϕ_{k}−ϕ_{k−1}}{h} cos θ_{k−1} + \frac{ψ_{k}−ψ_{k−1}}{h})}{s sin^{2} θ_{k}}h−

\frac{cos θ_{k}(\frac{ϕ_{k}−ϕ_{k−1}}{h} (s sin^{2} θ_{k−1} + cos^{2} θ_{k−1}) + \frac{ψ_{k}−ψ_{k−1}}{h} cos θ_{k−1})}{s sin^{2} θ_{k}}h + ψ_{k} =

\frac{(s sin^{2} θ_{k} + cos^{2} θ_{k})((ϕ_{k} − ϕ_{k−1}) cos θ_{k−1} + (ψ_{k} − ψ_{k−1}))}{s sin^{2} θ_{k}}−

\frac{cos θ_{k}((ϕ_{k} − ϕ_{k−1})(s sin^{2} θ_{k−1} + cos^{2} θ_{k−1}) + (ψ_{k} − ψ_{k−1}) cos θ_{k−1})}{s sin^{2} θ_{k}} + ψ_{k}