ODE and physics-aware plotting functions using MathBox
.
ODE and physics-aware plotting functions using `MathBox`.
(Comet {:keys [dimensions path color size length items]
:or {items 1 dimensions 3 color 3182847 length 16 size 10}})
Boring, old version that we need to fix.
Boring, old version that we need to fix.
(Comet* {:keys [atom state->xyz length items size opacity color z-order z-index
z-bias]
:or {size 10
opacity 1.0
state->xyz in->out
color 3182847
length 16
z-index 0
z-bias 0}})
Point that trails its historical positions out behind it in a glowing tail.
Required arguments:
:atom
: atom holding a JS array representing some state. :state->xyz
will
transform this into xyz coordinates to draw.Optional arguments:
:state->xyz
: function from the contents of :atom
to [x y z]
coordinates.
:length
: the length of the comet tail. Defaults to 16.
:size
: size of the comet. Defaults to 10.
:opacity
: opacity of the leading point of the comet. Defaults to 1.0.
:color
: color of each curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the comet.
:z-index
: zIndex of the comet. Defaults to 0.
:z-bias
: zBias of the comet. Defaults to 0.
Point that trails its historical positions out behind it in a glowing tail. Required arguments: - `:atom`: atom holding a JS array representing some state. `:state->xyz` will transform this into xyz coordinates to draw. Optional arguments: - `:state->xyz`: function from the contents of `:atom` to `[x y z]` coordinates. - `:length`: the length of the comet tail. Defaults to 16. - `:size`: size of the comet. Defaults to 10. - `:opacity`: opacity of the leading point of the comet. Defaults to 1.0. - `:color`: color of each curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the comet. - `:z-index`: zIndex of the comet. Defaults to 0. - `:z-bias`: zBias of the comet. Defaults to 0.
(ODECurve _)
Component that plots a curve by integrating a system of ordinary differential
equations represented by f'
forward from the initial input state
initial-state
for steps
steps of dt
each.
Required arguments:
:f'
: function of the form (fn [[y0 y1 ...]] [<y0'> <y1'> ...])
that
returns a vector of the derivatives of each input variable.
:initial-state
: the initial input vector to :f'
.
Optional arguments:
:state->xyz
: function of the form (fn [[y0 y1 ...]] [<x> <y> <z>])
,
responsible for transforming each integrated state into a 3D point. Defaults
to identity
.
:steps
: the number of :dt
-spaced steps for the integrator to take.
Defaults to 1000.
:dt
: the distance of each evenly spaced step taken by the integrator.
Defaults to 3e-2.
:epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-5.
:width
: width of the curve. Defaults to 4.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a curve by integrating a system of ordinary differential equations represented by `f'` forward from the initial input state `initial-state` for `steps` steps of `dt` each. Required arguments: - `:f'`: function of the form `(fn [[y0 y1 ...]] [<y0'> <y1'> ...])` that returns a vector of the derivatives of each input variable. - `:initial-state`: the initial input vector to `:f'`. Optional arguments: - `:state->xyz`: function of the form `(fn [[y0 y1 ...]] [<x> <y> <z>])`, responsible for transforming each integrated state into a 3D point. Defaults to `identity`. - `:steps`: the number of `:dt`-spaced steps for the integrator to take. Defaults to 1000. - `:dt`: the distance of each evenly spaced step taken by the integrator. Defaults to 3e-2. - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-5. - `:width`: width of the curve. Defaults to 4. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(PhasePortrait {:keys [f' initial-state x-idx v-idx steps dt epsilon arrow-size
width start? end? opacity color z-order z-index z-bias]
:or {v-idx 2
start? false
color 3182847
end? true
dt 0.03
z-bias 0
steps 10
width 2
z-index 0
opacity 1
epsilon 1.0E-5
arrow-size 5
x-idx 1}})
In-progress attempt at a proper phase portrait component.
PhasePortrait
plots a curve at each point on a grid by integrating a
system of ordinary differential equations represented by f'
forward from the
initial input state initial-state
for steps
steps of dt
each.
Each point is initialized by swapping out :x-idx
and :v-idx
in
:initial-state
with the $(x, \vdot{x})$ coordinates of the phase portrait.
NOTE that this is kind of weird, and only works for second-order ODEs that
have been transformed. It might be that we want to allow this, but also just
call :f
if the user doesn't supply :v-idx
, for more general ODEs.
Required arguments:
:f'
: function of the form (fn [[y0 y1 ...]] [<y0'> <y1'> ...])
that
returns a vector of the derivatives of each input variable.
:initial-state
: the initial input vector to :f'
.
Optional arguments:
:x-idx
: index of the coordinate position in the state. Defaults to 1.
:v-idx
index of the derivative of :x-idx
in the state. Defaults to 2.
:steps
: the number of :dt
-spaced steps for the integrator to take.
Defaults to 10.
:dt
: the distance of each evenly spaced step taken by the integrator.
Defaults to 3e-2.
:epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-5.
:width
: width of each curve. Defaults to 2.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
true
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 5.
:opacity
: opacity of each curve. Defaults to 1.0.
:color
: color of each curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the phase portrait.
:z-index
: zIndex of the phase portrait. Defaults to 0.
:z-bias
: zBias of the phase portrait. Defaults to 0.
In-progress attempt at a proper phase portrait component. [[PhasePortrait]] plots a curve at each point on a grid by integrating a system of ordinary differential equations represented by `f'` forward from the initial input state `initial-state` for `steps` steps of `dt` each. Each point is initialized by swapping out `:x-idx` and `:v-idx` in `:initial-state` with the $(x, \vdot{x})$ coordinates of the phase portrait. NOTE that this is kind of weird, and only works for second-order ODEs that have been transformed. It might be that we want to allow this, but also just call `:f` if the user doesn't supply `:v-idx`, for more general ODEs. Required arguments: - `:f'`: function of the form `(fn [[y0 y1 ...]] [<y0'> <y1'> ...])` that returns a vector of the derivatives of each input variable. - `:initial-state`: the initial input vector to `:f'`. Optional arguments: - `:x-idx`: index of the coordinate position in the state. Defaults to 1. - `:v-idx` index of the derivative of `:x-idx` in the state. Defaults to 2. - `:steps`: the number of `:dt`-spaced steps for the integrator to take. Defaults to 10. - `:dt`: the distance of each evenly spaced step taken by the integrator. Defaults to 3e-2. - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-5. - `:width`: width of each curve. Defaults to 2. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `true`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 5. - `:opacity`: opacity of each curve. Defaults to 1.0. - `:color`: color of each curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the phase portrait. - `:z-index`: zIndex of the phase portrait. Defaults to 0. - `:z-bias`: zBias of the phase portrait. Defaults to 0.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close