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.

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
}
#> Solution 1:
#>   x =  2/3 
#>   y =  -10/3 
#> Solution 2:
#>   x =  2 
#>   y =  -2