Skip to contents

LinearProblem(sys, op) builds A u = b from a complete time independent system whose equations are affine in the unknowns: A is the Jacobian of the equations and b their constant part, both evaluated at the parameter values. solve() uses a QR factorization, and least squares for non square systems. LinearProblem(A, b) takes a numeric matrix and vector.

Usage

LinearProblem(sys, op = list(), ..., check_length = TRUE)

Arguments

sys

A complete System, or a numeric matrix A.

op

Operating point: parameter values (and optionally initial values of the unknowns), or the vector b for the matrix form.

...

Options stored with the problem.

check_length

Require a square system.

Value

A LinearProblem with fields A, b, u0 and p.

Examples

x <- Variable("x"); y <- Variable("y"); a <- Parameter("a")
sys <- complete(System(list(0 ~ 2 * x + y - a, 0 ~ x - y), name = "lin"))
prob <- LinearProblem(sys, list(a ~ 3))
prob$A; prob$b
#>      [,1] [,2]
#> [1,]    2    1
#> [2,]    1   -1
#> [1] 3 0
solve(prob)$u
#> x y 
#> 1 1