ODE and physics-aware utilities for all Emmy-Viewers plugins.
ODE and physics-aware utilities for all Emmy-Viewers plugins.
(Evolve {f' :f' !state :atom :as opts})
Component that uses the supplied derivative function :f'
to evolve the state
value stored in :atom
.
On every time tick, the component will swap a new JS array representing the
flattened state value into :atom
under the :state
key.
Required arguments:
:f'
: a function of 2-arguments state
and output
, that populates
output
with the derivatives for each entry in state
when called
:atom
: atom holding a map with a key :state
populated with
the (potentially structured, unflattened) initial value for :f'
's state
argument
Optional arguments:
:epsilon
: - :epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-6.
:max-steps
: the maximum number of steps that the ODE solver will take
before erroring out. Defaults to 10000.
Component that uses the supplied derivative function `:f'` to evolve the state value stored in `:atom`. On every time tick, the component will swap a new JS array representing the flattened state value into `:atom` under the `:state` key. Required arguments: - `:f'`: a function of 2-arguments `state` and `output`, that populates `output` with the derivatives for each entry in `state` when called - `:atom`: atom holding a map with a key `:state` populated with the (potentially structured, unflattened) initial value for `:f'`'s `state` argument Optional arguments: - `:epsilon`: - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-6. - `:max-steps`: the maximum number of steps that the ODE solver will take before erroring out. Defaults to 10000.
(make-solver f' dimension {:keys [epsilon max-steps]})
Given
f'
, a function of 2-arguments state
and output
, that populates
output
with the derivatives for each entry in state
when called
dimension
, the number of entries in f'
's state
argument
and an options map with the following optional entries:
:epsilon
: - :epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-6.
:max-steps
: the maximum number of steps that the ODE solver will take
before erroring out. Defaults to 10000.
Given - `f'`, a function of 2-arguments `state` and `output`, that populates `output` with the derivatives for each entry in `state` when called - `dimension`, the number of entries in `f'`'s `state` argument and an options map with the following optional entries: - `:epsilon`: - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-6. - `:max-steps`: the maximum number of steps that the ODE solver will take before erroring out. Defaults to 10000. Returns an instance of an [odex-js](https://github.com/littleredcomputer/odex-js) [Solver](https://github.com/littleredcomputer/odex-js/blob/master/src/odex.ts#L41).
(monotonic-integrator f' initial-state)
(monotonic-integrator f' initial-state opts)
Given
f'
, a function of 2-arguments state
and output
, that populates
output
with the derivatives for each entry in state
when called
initial-state
, the (potentially structured, unflattened) initial value for
f'
's state
argument
and an options map with the following optional entries:
:epsilon
: - :epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-6.
:max-steps
: the maximum number of steps that the ODE solver will take
before erroring out. Defaults to 10000.
Returns a function of t
that returns the state evolved up from 0
to t
at
each call. Successive calls to t
must monotonically increase.
Call the returned function with no arguments when you're done to shut it down and reclaim stored resources.
Given - `f'`, a function of 2-arguments `state` and `output`, that populates `output` with the derivatives for each entry in `state` when called - `initial-state`, the (potentially structured, unflattened) initial value for `f'`'s `state` argument and an options map with the following optional entries: - `:epsilon`: - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-6. - `:max-steps`: the maximum number of steps that the ODE solver will take before erroring out. Defaults to 10000. Returns a function of `t` that returns the state evolved up from `0` to `t` at each call. Successive calls to `t` must monotonically increase. Call the returned function with no arguments when you're done to shut it down and reclaim stored resources.
(point-integrator f' dimension)
(point-integrator f' dimension opts)
Given
f'
, a function of 2-arguments state
and output
, that populates
output
with the derivatives for each entry in state
when called
dimension
, the number of entries in f'
's state
argument
and an options map with the following optional entries:
:epsilon
: - :epsilon
: error tolerance passed along
to odex-js. Defaults to 1e-6.
:max-steps
: the maximum number of steps that the ODE solver will take
before erroring out. Defaults to 10000.
Returns a function of:
initial-state
n-steps
, the number of steps to integratestep-size
, the distance for each stepemit
, a callback called with a JS array representing the updated state for
each integration step of size step-size
.This function can be used multiple times.
Given - `f'`, a function of 2-arguments `state` and `output`, that populates `output` with the derivatives for each entry in `state` when called - `dimension`, the number of entries in `f'`'s `state` argument and an options map with the following optional entries: - `:epsilon`: - `:epsilon`: error tolerance passed along to [odex-js](https://github.com/littleredcomputer/odex-js). Defaults to 1e-6. - `:max-steps`: the maximum number of steps that the ODE solver will take before erroring out. Defaults to 10000. Returns a function of: - `initial-state` - `n-steps`, the number of steps to integrate - `step-size`, the distance for each step - `emit`, a callback called with a JS array representing the updated state for each integration step of size `step-size`. This function can be used multiple times.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close