Implement Double Pendulum with Fetching System Information in Python

A nice relaxing double pendulum simulation using ASCII, able to simulate multiple pendulums at once, and provide tracing of pendulums as well as providing some system information. If you spot any bugs or features that need adding (especially with the specs), just open an issue :)

Double Pendulum implementation in Python

Features

  • As mentioned, able to simulate multiple pendulums at once.
  • Able to specify the weight and mass of pendulums to create different butterfly effects.
  • Uses equations from here.
  • If -s is used, it grabs system specs and displays them.(hi r/unixporn)
  • Obviously a lot could be done to it (see below the Args), Any contributions are appreciated)

Quickstart:

Dependencies: Python 3.2+,curses (standard on UNIX) or relevent windows port, psutils if you want to use -s

Github

  • Clone using https://github.com/Nekurone/double-pendulum-ascii.git or download the zip.
  • Extract if necessary and head inside the folder.
  • python3 pendulum.py [args]

Pip

  • python3 -m pip install double-pendulum (or pip install double-pendulum)
  • double-pendulum [args]

Args

Visuals

--help (-h)

Spits out a fairly standard argparse help message. Note this is printed out when the program is run anyway.Double Pendulum implementation in Python

type: None, default: None setting in example: -h

--trace (-t)

Enables 'tracing', a faint line behind the pendulums that fades.Double Pendulum implementation in Python

type: bool, default: off, setting in example: -t

--traceDrop (-tD)

Controls the rate at which the trace from -t fades. Higher is faster fading.Double Pendulum implementation in Python

type: float, default: 1.0, setting in example: -t -tD 0.5

--specs (-t)

Enables showing system info, note this feature is still a WIP, any bugs or issues just let me know.Double Pendulum implementation in Python

type: bool, default: off, setting in example: -s

Maths and Pendulum Settings

--pendulum (-p)

Number of pendulums to simulate at once. Combine with the gravity settings and some speed settings for some really pretty visuals.Double Pendulum implementation in Python

type: int, default: 1, setting in example: -p 300

--speed (-sP)

Multiplier for speed of simulation. Around 0.5-1.5 is a good range Double Pendulum implementation in Python

type: float, default: 1.0, setting in example: -sP 3.0

--gravity(-g)

Controls the strength of gravity, note, this directly affects the speed of the simulation. So slowing down is recommended.Double Pendulum implementation in Python

type: float, default: 9.81, setting in example: -g 1

--mass (-m)

Controls the mass of the pendulums, useful mostly for butterfly effects Double Pendulum implementation in Python

type: float, default: 100.0, setting in example: -m 300 -sP 0.2

--length (-l)

Controls the length of the arms of the pendulums, useful mostly for butterfly effects Double Pendulum implementation in Python

type: float, default: 250.0, setting in example: -l 150 -sP 0.3

Download Details:
 

Author: Nekurone

Official Website: https://github.com/Nekurone/double-pendulum-ascii

2 Likes5.10 GEEK