pendulum: 3-magnet pendulum experiment

View source: R/fractals.R

pendulumR Documentation

3-magnet pendulum experiment

Description

Simulates the 3-magnet pendulum experiment, starting at a specified position with a given start velocity.

Usage

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
)

Arguments

startpos

2-element vecotor with the initial position

startvel

2-element vector with the initial velocity

src

n \times 2 matrix with the positions of the magnets

plot

logical. If TRUE, generates a plot with the trajectory of the pendulum.

Value

the end position of the pendulum

Examples

p <- par(mfrow=c(1,2))
pendulum(startpos=c(2.1,2))
pendulum(startpos=c(1.9,2))
par(p)

geostats documentation built on Jan. 7, 2023, 5:32 p.m.

Related to pendulum in geostats...