Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \[Theta][t_, \[Theta]0_, \[Theta]d0_] := (-(\[Theta]0^2/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2]) - \[Theta]d0^2/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2] ) Cos[
- 2 Pi t +
- ArcTan[-(\[Theta]0/Sqrt[\[Theta]0^2 + \[Theta]d0^2]), \[Theta]d0/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2]]];
- \[Theta]d[
- t_, \[Theta]0_, \[Theta]d0_] := -(-(\[Theta]0^2/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2]) - \[Theta]d0^2/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2]) Sin[
- 2 Pi t +
- ArcTan[-(\[Theta]0/Sqrt[\[Theta]0^2 + \[Theta]d0^2]), \[Theta]d0/
- Sqrt[\[Theta]0^2 + \[Theta]d0^2]]];
- n = 100;
- p0s = RandomVariate[
- MultinormalDistribution[{0, 0}, DiagonalMatrix[{0.05, 0.001}]],
- n];
- p0s = Sort[p0s]; cols =
- ColorData["DarkRainbow"] /@ (Range[1/n, 1, 1/n]);
- frame[t_] := (Show[
- Graphics[
- {
- PointSize[Medium],
- Point[{0, 0}],
- Opacity[0.7],
- Table[
- {
- cols[[i]],
- With[{p = {Sin[\[Theta][t, p0s[[i, 1]],
- p0s[[i, 2]]]], -Cos[\[Theta][t, p0s[[i, 1]],
- p0s[[i, 2]]]]},
- p2 = {Sin[\[Theta][t, p0s[[i, 1]], p0s[[i, 2]]]],
- 1 + \[Theta]d[t, p0s[[i, 1]], p0s[[i, 2]]]}},
- {
- {Black, Opacity[0.1], Line[{p, p2}]},
- {Black, Opacity[0.1], Line[{{0, 0}, p}]},
- Point[p],
- Point[p2]
- }
- ]
- },
- {i, n}
- ],
- {White, Rectangle[{-0.2, 0.15}, {0.2, 0.25}]},
- Text[Style["position", Medium], {0, 0.2}],
- Rotate[Text[Style["momentum", Medium], {0, 0.2}],
- Pi/2, {0, 1}],
- Scale[
- Inset[
- Histogram[
- Table[Sin[\[Theta][t, p0s[[i, 1]], p0s[[i, 2]]]], {i, n}],
- {0.05},
- "PDF", PlotRange -> {{-1, 1}, {0, 10}},
- ChartStyle -> Directive[cols[[3]], Opacity[0.5]],
- Axes -> None]
- ,
- {0, 0}, {Center, Bottom}, {2, Automatic}
- ],
- {1, 0.5}
- ],
- Rotate[
- Scale[
- Inset[
- Histogram[
- Table[\[Theta]d[t, p0s[[i, 1]], p0s[[i, 2]]], {i, n}],
- {0.05},
- "PDF", PlotRange -> {{-1, 1}, {0, 10}},
- ChartStyle -> Directive[cols[[3]], Opacity[0.5]],
- Axes -> None]
- ,
- {0, 0}, {Center, Bottom}, {2, Automatic}
- ],
- {1, 0.5}
- ],
- Pi/2,
- {0, 1}
- ]
- },
- PlotRange -> {{-1, 1}, {-1.1, 1.5}}
- ]]);
- Manipulate[
- frame[t],
- {t, 0, 1}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement