Skip to contents

add_accumulations(sys) adds, for every unknown x, a variable accumulation_x with D(accumulation_x) ~ x and initial value 0. With a list of formulas acc ~ expr (or pairs), it adds D(acc) ~ expr for each.

Usage

add_accumulations(sys, vars = unknowns(sys))

Arguments

sys

A System.

vars

Unknowns to accumulate, or a list of formulas acc ~ expr.

Value

The extended System.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t)
sys <- add_accumulations(System(list(D(x) ~ -x), t, name = "s"))
equations(sys)
#> [[1]]
#> Derivative(x(t), t) ~ -x(t) 
#> 
#> [[2]]
#> Derivative(accumulation_x(t), t) ~ x(t) 
#>