Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Animate-a-pendulum/Mathematica/animate-a-pendulum.math
Normal file
27
Task/Animate-a-pendulum/Mathematica/animate-a-pendulum.math
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
tmax = 10;
|
||||
g = 9.8;
|
||||
l = 1;
|
||||
pendulum = Module[
|
||||
{g, l},
|
||||
ParametricNDSolve[
|
||||
{
|
||||
y''[t] + g/l Sin[y[t]] == 0,
|
||||
y[0] == 0, y'[0] == 1
|
||||
},
|
||||
{y},
|
||||
{t, 0, tmax},
|
||||
{g, l}
|
||||
]
|
||||
];
|
||||
Animate[
|
||||
Graphics[
|
||||
Rotate[
|
||||
{Line[{{0, 0}, {0, -1}}], Disk[{0, -1}, .1]},
|
||||
Evaluate[y[g, l] /. pendulum][t],
|
||||
{0, 0}
|
||||
],
|
||||
PlotRange -> {{-l, l}, {-l - .5, 0}}
|
||||
],
|
||||
{t, 0, tmax},
|
||||
AnimationRate -> 1
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue