Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lorentz attractor with Polymath + Roassal viz
sigma := 10.0.
r := 28.0.
b := 8.0/3.0.
dt := 0.005.
system := ExplicitSystem
block:[:v :t | |dx dy dz x y z|
x := v at: 1. y := v at: 2. z := v at: 3.
dx := sigma * (y - x).
dy := r * x - y - (x * z).
dz := (-1 * b * z + (x * y)).
{dx. dy. dz}.
].
stepper := RungeKuttaStepper onSystem: system.
solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt.
state := #(10.0 10.0 10.0).
values := (0.0 to: 100.0 by: dt) collect:[:t |
state := stepper doStep: state time:t stepSize: dt].
b := RTGrapher new.
ds := RTData new.
ds dotShape ellipse size: 1; color: (Color blue).
ds points: values.
ds x: [:v | v at: 1]; y: [:v| v at: 2].
b add: ds.
b build.
b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment