Ryacas
makes the yacas
computer algebra system available from within R
. The name yacas
is short for “Yet Another Computer Algebra System”. The yacas
program is developed by Ayal Pinkhuis (who is also the maintainer) and others, and is available at http://www.yacas.org/ for various platforms. There is a comprehensive documentation (300+ pages) of yacas
(also available at http://www.yacas.org/) and the documentation contains many examples.
## yacas_expression(x^2 + 2 * x + 2 * x + 4)
## yacas_expression(x^2 + 4 * x + 4)
## yacas_expression((x + 2)^2)
Or by using the corresponding R
functions directly:
## yacas_expression(x^2 + 4 * x + 4)
## yacas_expression((x + 2)^2)
Or course the result can be saved before calling the helper R
functions:
## yacas_expression(x^2 + 4 * x + 4)
## yacas_expression((x + 2)^2)
And getting results out:
## [1] "(x + 2)^2"
## [1] "\\left( x + 2\\right) ^{2}"
To include inline, e.g. \(x ^{2} + 2 x + 2 x + 4 = \left( x + 2\right) ^{2}\).
Sym()
## yacas_expression(x^2 + 4 * x + 4)
## yacas_expression((x + 2)^2)
## [1] "(x + 2)^2"
## [1] "\\left( x + 2\\right) ^{2}"
Sym()
## yacas_expression(x^2 + 2 * x + 2 * x + 4)
## yacas_expression(x^2 + 2 * x + 2 * x + 4)
## [1] "x ^{2} + 4 x + 4"