parameters
Stable function · Variable classification
Tier: stable · Kind: function · Topic: Variable classification
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
parameter_names, parameters | parameters | not exported | not exported | not exported |
Note: spelling differs from the §2 rule: julia=parameter_names (expected parameters); multiple spellings exported by: julia
Julia
Exported as parameter_names and parameters. Both names refer to the same operation.
parameter_names
parameter_names(model::Model)
parameter_names(model::Model) -> Vector{String}
Deprecated alias of parameters
(API_SPEC.md §8 item 6). Kept exported
for the same namespace reason as unknown_names
.
parameters
parameters(model::Model)
parameters(x::Union{EarthSciAST.RhsProgram, EarthSciAST.TileProgram})
parameters(lp::EarthSciAST.LaneProgram)
parameters(model::Model) -> Vector{String}
Every parameter declared by model, sorted lexicographically. The union of
brownian_parameters
, discrete_parameters
,
sampled_parameters
and constant_parameters
, which partition
it.
The canonical cross-binding name; see unknowns
for why the
parameter_names
alias stays exported alongside it.
parameters(prog) -> Vector{ParamSlot}
The entries of a vector p (API_SPEC §5.8): sorted flattened parameter names,
the positional order the compiled program indexes, each with its default.
Build a vector with parameter_vector
; rhs! also takes the Problem’s
NamedTuple prob.p.
Example (inspect)
model = doc.models["Decay"]
@assert sort(collect(keys(model.variables))) == ["N", "half_life", "lambda"]
# The two declared kinds...
@assert unknowns(model) == ["N", "half_life"]
@assert parameters(model) == ["lambda"]
# ...and what each unknown is, derived from the equations.
@assert ode_states(model) == ["N"] # has a D(N)/dt equation
@assert observed_unknowns(model) == ["half_life"] # defined explicitly
@assert algebraic_unknowns(model) == String[] # none solved implicitly
defs = observed_definitions(model)
@assert to_ascii(defs["half_life"]) == "log(2) / lambda"
TypeScript
function parameters(model: Model): string[]
Names of every variable declared parameter, sorted.
Example (inspect)
const doc = loadPath(fixture('decay.esm'))
assert.deepEqual(Object.keys(doc.models ?? {}), ['Decay'])
const model = doc.models!.Decay
assert.ok(!('ref' in model)) // narrows away an unresolved `{ ref }` mount
// The document declares only `unknown` and `parameter`; everything else is derived.
assert.deepEqual(Object.keys(model.variables), ['N', 'lambda', 'half_life'])
assert.deepEqual(unknowns(model), ['N', 'half_life'])
assert.deepEqual(parameters(model), ['lambda'])
// N has a time derivative; half_life is defined by an explicit equation.
assert.deepEqual(odeStates(model), ['N'])
assert.deepEqual(observedUnknowns(model), ['half_life'])
assert.deepEqual(algebraicUnknowns(model), [])
assert.equal(isOdeState(model, 'N'), true)
assert.deepEqual(constantParameters(model), ['lambda'])
assert.equal(systemKind(model), 'ode')
// Each observed's defining expression:
const defs = observedDefinitions(model)
assert.equal(toAscii(defs.get('half_life')!), 'log(2) / lambda')
Python
Python does not export this function.
Rust
Rust does not export this function.
Go
Go does not export this function.