Skip to content

Commit 4b9fefa

Browse files
docs: document System constructors
1 parent 1ac7cbb commit 4b9fefa

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/systems/system.jl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,22 @@ function default_consolidate(costs, subcosts)
301301
return reduce(+, costs; init = 0.0) + reduce(+, subcosts; init = 0.0)
302302
end
303303

304+
"""
305+
$(TYPEDSIGNATURES)
306+
307+
Construct a system using the given equations `eqs`, independent variable `iv` (`nothing`)
308+
for time-independent systems, unknowns `dvs`, parameters `ps` and brownian variables
309+
`brownians`.
310+
311+
## Keyword Arguments
312+
313+
- `discover_from_metadata`: Whether to parse metadata of unknowns and parameters of the
314+
system to obtain defaults and/or guesses.
315+
- `checks`: Whether to perform sanity checks on the passed values.
316+
317+
All other keyword arguments are named identically to the corresponding fields in
318+
[`System`](@ref).
319+
"""
304320
function System(eqs::Vector{Equation}, iv, dvs, ps, brownians = [];
305321
constraints = Union{Equation, Inequality}[], noise_eqs = nothing, jumps = [],
306322
costs = BasicSymbolic[], consolidate = default_consolidate,
@@ -394,10 +410,23 @@ function System(eqs::Vector{Equation}, iv, dvs, ps, brownians = [];
394410
initializesystem, is_initializesystem; checks)
395411
end
396412

413+
"""
414+
$(TYPEDSIGNATURES)
415+
416+
Create a time-independent [`System`](@ref) with the given equations `eqs`, unknowns `dvs`
417+
and parameters `ps`.
418+
"""
397419
function System(eqs::Vector{Equation}, dvs, ps; kwargs...)
398420
System(eqs, nothing, dvs, ps; kwargs...)
399421
end
400422

423+
"""
424+
$(TYPEDSIGNATURES)
425+
426+
Create a time-dependent system with the given equations `eqs` and independent variable `iv`.
427+
Discover variables, parameters and brownians in the system by parsing the equations and
428+
other symbolic expressions passed to the system.
429+
"""
401430
function System(eqs::Vector{Equation}, iv; kwargs...)
402431
iv === nothing && return System(eqs; kwargs...)
403432

@@ -486,6 +515,13 @@ function System(eqs::Vector{Equation}, iv; kwargs...)
486515
eqs, iv, collect(allunknowns), collect(new_ps), collect(brownians); kwargs...)
487516
end
488517

518+
"""
519+
$(TYPEDSIGNATURES)
520+
521+
Create a time-independent system with the given equations `eqs`. Discover variables and
522+
parameters in the system by parsing the equations and other symbolic expressions passed to
523+
the system.
524+
"""
489525
function System(eqs::Vector{Equation}; kwargs...)
490526
eqs = collect(eqs)
491527

@@ -516,6 +552,11 @@ function System(eqs::Vector{Equation}; kwargs...)
516552
return System(eqs, nothing, collect(allunknowns), collect(new_ps); kwargs...)
517553
end
518554

555+
"""
556+
$(TYPEDSIGNATURES)
557+
558+
Create a `System` with a single equation `eq`.
559+
"""
519560
System(eq::Equation, args...; kwargs...) = System([eq], args...; kwargs...)
520561

521562
function gather_array_params(ps)

0 commit comments

Comments
 (0)