| solve.yac_symbol {Ryacas} | R Documentation |
Solve a system of equations
Description
This generic function solves the equation $a x = b$ for $x$.
Usage
## S3 method for class 'yac_symbol'
solve(a, b, ...)
Arguments
a |
A |
b |
A |
... |
See details and examples. |
Details
When a is a matrix and b not provided,
this finds the inverse of a.
When a is a matrix and a vector b is provided, the
linear system of equations is solved.
Note that solving non-linear equations:
-
solve(a, b): find roots ofafor variableb, i.e. yacasSolve(a == 0, b) -
solve(a, b, v): find solutions toa == bfor variablev, i.e. yacasSolve(a == b, v)
This also works for a system of equations (when a is a vector)
Examples
A <- outer(0:3, 1:4, "-") + diag(2:5)
a <- 1:4
B <- ysym(A)
b <- ysym(a)
solve(A)
solve(B)
solve(A, a)
solve(B, b)
poly <- ysym("x^2 - x - 6")
solve(poly, "x") # Solve(poly == 0, x)
solve(poly, 3, "x") # Solve(poly == 3, x)
[Package Ryacas version 1.1.5 Index]