Simple Harmonic Motion

Introductory Notes

This notebook demonstrates the idea of simple harmonic motion using a ball-and-spring model.

Create the Graphics

\(Off[General::"spell1"]; 
<< Graphics`\)<< DynamicVisualizer`

ClearVisualizer[];

gSpring = 
      Graphics3D[{Thickness[0.03], 
          Line[Table[{0.2 Sin[u], 0.2 Cos[u], 
                1 - ((1.05 u)/(20 π))}, {u, 0, 20 π, 
                (π/8)}]]}];

radius = 0.4; gBall = Graphics3D[Sphere[radius, 16, 10]];

gAnchor = Graphics3D[Cuboid[{-.5, -.5, 0}]];

Create the Objects in Dynamic Visualizer

SetOptions[$DefaultModel3D, BoundingBox -> Off];

CreateObject[ Object3D["Spring"], gSpring, 
      InteractiveMovement -> False, RenderMode -> SmoothShaded, 
      Color -> LightBlue];

CreateObject[ Object3D["Ball"], gBall, 
      InteractiveMovement -> False, RenderMode -> SmoothShaded, 
      Location -> {0, 0, -radius}, Color -> Blue];

CreateObject[ Object3D["Anchor"], gAnchor, 
      InteractiveMovement -> False, RenderMode -> FlatShaded, 
      Diffuse -> 0.5, Color -> Orange, Location -> {0, 0, 1}];

Animate

amplitude = 0.5; anim = 
      Table[{DV`SetOptions[Object3D["Spring"], 
            Scale -> {1, 1, 1 - amplitude Sin[t]}, 
            Location -> {0, 0, amplitude Sin[t]}], 
          DV`SetOptions[Object3D["Ball"], 
            Location -> {0, 0, amplitude Sin[t] - radius}]}, {t, 0, 
          4 π, (π/10)}];

Visualize[anim];