heyoka.model.pendulum

Contents

heyoka.model.pendulum#

heyoka.model.pendulum(gconst: expression | str | numpy.single | float | numpy.longdouble = 1., length: expression | str | numpy.single | float | numpy.longdouble = 1.) list[tuple[expression, expression]]#

Produces the expression for the dynamics of the simple pendulum.

The gravitational constant is gconst, while the length of the pendulum is length. In the return value, the angle with respect to the downwards vertical is represented by the state variable x, while its time derivative is represented by the state variable v.

Parameters:
  • gconst – the gravitational constant.

  • length – the length of the pendulum.

Returns:

the dynamics of the simple pendulum.

Examples:
>>> from heyoka import model
>>> model.pendulum()
[(x, v), (v, -sin(x))]