Jump to content

File talk:Standing waves on a string.gif

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

I generated this in Mathematica. Here's the code for anyone who wants to improve it.

f = .5*Sin[n*t]*Sin[n*x]/n;
point = Graphics[Point[{{0, 0}, {Pi, 0}}]];
range = .51;
animation =
 Table[GraphicsGrid[{{Show[{Plot[f /. n -> 1, {x, 0, Pi},
        PlotRange -> range, Axes -> False], point}],
     Show[{Plot[f /. n -> 2, {x, 0, Pi}, PlotRange -> range,
        Axes -> False], p}]},
    {Show[{Plot[f /. n -> 3, {x, 0, Pi}, PlotRange -> range,
        Axes -> False], point}],
     Show[{Plot[f /. n -> 4, {x, 0, Pi}, PlotRange -> range,
        Axes -> False], p}]},
    {Show[{Plot[f /. n -> 5, {x, 0, Pi}, PlotRange -> range,
        Axes -> False], point}],
     Show[{Plot[f /. n -> 6, {x, 0, Pi}, PlotRange -> range,
        Axes -> False], p}]}
    }], {t, 0, 2*Pi, .1}];
Export["anim.gif", animation, AnimationRate -> 10]
SystemOpen["anim.gif"]

Start a discussion