The Symbol interface to yacas.
Sym(...)
Expr(x)
An R character string or object that can be coerced to a character string.
An R expression.
Sym
returns a "Sym"
object and Expr
returns an
"Expr"
object.
An object of class "Sym"
is internally a yacas character string. An
object of class "Expr"
is internally an R expression. One can combine
such objects using the Math and Ops R operators (see help(Math) and
help(Ops) for a list). Also there are methods for a number of R generics:
as.character.Sym
, as.expression.Sym
, determinant.Sym
,
deriv.Sym
and print.Sym
and yacas-oriented functions: Clear,
Conjugate, Expand, Factor, Factorial, I, Identity, Infinity, Integrate,
Inverse, InverseTaylor, Limit, List, N, Newton, Pi, Precision, PrettyForm,
PrettyPrinter, Set, Simplify, Solve, Subst, Taylor, TeXForm, Transpose,
Ver and "%Where%" all of which have the same meaning as the corresponding yacas
commands. Try vignette("Rycas-Sym")
for many examples.
Get Sym
objects with getSyms()
.
Currently the only Expr
methods implemented are
as.character.Expr, deriv.Expr, Math.Expr, Ops.Expr and print.Expr.
x <- Sym("x")
x*x
#> yacas_expression(x^2)
Integrate(x*x, x)
#> yacas_expression(x^3/3)
Sym("%") %Where% list(x = 10)
#> yacas_expression(1000/3)
acos(Sym("1/2"))
#> yacas_expression(pi/3)
y <- Exprq(x)
y*y
#> yacas_expression(y^2)
deriv(y*y, y)
#> yacas_expression(2 * y)
Exprq(acos(1/2))
#> yacas_expression(pi/3)