Physics 151
Damped Oscillations

Clear["Global`*"]; SetDirectory[NotebookDirectory[]];

x[t_, γ_] := B Exp[p[γ] t]

p[γ_] := (-γ/2) + Sqrt[(γ^2)/4 - ((ω0)^2)]

A[t_, γ_] := B Exp[-γ t/2]

ω0 = 2π;

t12toγ[t12_] := 2 Log[2]/t12

Initial Conditions -- set B = 10.0.

B = 10.0;

x[t, γ]

x[t, 0.2]

Manipulate[Plot[{Re[x[t, t12toγ[t12]]], A[t, t12toγ[t12]], -A[t, t12toγ[t12]]}, {t, 0, 20}, PlotRange->{-10, 10}, PlotPoints -> 200,ImageSize->Scaled[0.8]],
{t12, 20, 1, -1, Appearance -> "Open"}]

Plot[{Re[x[t, 0.5]], Re[x[t, 2.0]], Re[x[t, 8.0]]}, {t, 0, 10}, PlotRange->{-10, 10}, ImageSize->600, PlotStyle->{Red, Green, Blue}, PlotLegends -> {"γ = 0.5", "γ = 2.0","γ = 8.0"}, LabelStyle->Larger ]

Block[{γ = 2 Log[2]/5},
fig03 = Plot[{Re[x[t, γ]], A[t, γ], -A[t, γ]}, {t, 0, 20}, PlotRange->{-10, 10}, ImageSize->600,
LabelStyle->Larger, AxesLabel->{"t (s)", "x (cm)"}, PlotLabel -> "(Subscript[t, 1/2]) = 5 seconds"]
]

Export["Ch14-damped-fig-1.pdf", fig03]