resonance

Paste this into Try F# with Impact

open Impact; origin (50.0, 100.0) 

k <- 1.0; m <- 100.0

t <- 0.0

v <- 0.0; p <- 40.0  


while t < 150.0 do

  dot (t,p) red

  a <- -p * k / m

  v <- v + a * 1.0

  p <- p + v * 1.0

  t <- t + 1.0 

Comments