Ryacas is an R interface to the free yacas Computer Algebra System. Ryacas allows one to send unprocessed yacas strings and certain other R objects to yacas process from R and get back the result. It also has facilities for manipulating yacas strings and R expressions destined for yacas processing.

It can be used for arbitrary-precision arithmetic, symbolic math, ASCII pretty printing and translating R to TeX.

Install from GitHub

To build and install from Github using R 3.3.0 (or later) and the R devtools package 1.11.0 (or later) run this command from within R:

                         build_opts = c("--no-resave-data", "--no-manual"))

You can also install the package without vignettes if needed as follows:


Online info

For vignettes, overview, pointers to additional information, installation instructions and a sample session see http://mikldk.github.io/ryacas/.

Yacas documentation can be found at http://yacas.readthedocs.org/.

Contribute, issues, and support

Please use the issue tracker at https://github.com/mikldk/ryacas/issues if you want to notify us of an issue or need support. If you want to contribute, please either create an issue or make a pull request.

Brief examples

Below we show a few examples. We highly recommend reading the “Getting started” vignette (and the other vignettes) for a more thorough introduction to the package.

There are two interfaces: a high-level interface that makes yacas objects work similar to R objects, and a low-level interface where the user can write yacas code and get results as strings or as R expressions. Below, we demonstrate both.

Low-level interface

Returning strings with yac_str():

#> [1] "4*x"
#> [1] "(x-2)*(x+3)"
yac_str("D(x) x^2+x-6")
#> [1] "2*x+1"

Returning R expressions with yac_expr():

Using functions easier (using magrittr’s pipe, %>%):

Solving equations (removes the x== from yacas with the y_rmvars() function):

And output in TeX:

And arbitrary precision (see also the “Arbitrary-precision arithmetic” vignette):


The package contains the yacas distribution. The development of the yacas source code is available at https://github.com/grzegorzmazur/yacas/ . For more information on yacas see http://www.yacas.org/ or the documention directly at https://yacas.readthedocs.io/.

Mikkel Meyer Andersen, mikl at math dot aau dot dk
Rob Goedman, goedman at mac dot com
Gabor Grothendieck, ggrothendieck at gmail dot com
Søren Højsgaard, sorenh at math dot aau dot dk
Ayal Pinkus, apinkus at xs4all dot nl
Grzegorz Mazur, teoretyk at gmail dot com