powered by
Simulates the 3-magnet pendulum experiment, starting at a specified position with a given start velocity.
pendulum( startpos = c(-2, 2), startvel = c(0, 0), src = rbind(c(0, 0), c(0.5, sqrt(0.75)), c(1, 0)), plot = TRUE )
the end position of the pendulum
2-element vecotor with the initial position
2-element vector with the initial velocity
\(n \times 2\) matrix with the positions of the magnets
logical. If TRUE, generates a plot with the trajectory of the pendulum.
TRUE
p <- par(mfrow=c(1,2)) pendulum(startpos=c(2.1,2)) pendulum(startpos=c(1.9,2)) par(p)
Run the code above in your browser using DataLab