solve.yac_symbol: Solve a system of equations

View source: R/yac-symbol.R

solve.yac_symbolR 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 yac_symbol

b

A yac_symbol or a value, see details and examples.

...

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 of a for variable b, i.e. yacas Solve(a == 0, b)

  • solve(a, b, v): find solutions to a == b for variable v, i.e. yacas Solve(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)


Ryacas documentation built on Jan. 17, 2023, 1:11 a.m.