# solve_sys: Solves a system of non-linear equations In caracas: Computer Algebra

 solve_sys R Documentation

## Solves a system of non-linear equations

### Description

If called as `solve_sys(lhs, vars)` the roots are found. If called as `solve_sys(lhs, rhs, vars)` the solutions to `lhs = rhs` for `vars` are found.

### Usage

``````solve_sys(lhs, rhs, vars)
``````

### Arguments

 `lhs` Equation (or equations as row vector/1xn matrix) `rhs` Equation (or equations as row vector/1xn matrix) `vars` vector of variable names or symbols

### Value

A list with solutions (with class `caracas_solve_sys_sol` for compact printing), each element containing a named list of the variables' values.

### Examples

``````if (has_sympy()) {
x <- symbol('x')
exp1 <- 2*x + 2
exp2 <- x
solve_sys(cbind(exp1), cbind(exp2), x)

x <- symbol("x")
y <- symbol("y")
lhs <- cbind(3*x*y - y, x)
rhs <- cbind(-5*x, y+4)
sol <- solve_sys(lhs, rhs, list(x, y))
sol
}

``````

caracas documentation built on Oct. 17, 2023, 5:08 p.m.