Ryacas (google code name ryacas) is an R package that allows R users to access the yacas computer algebra system from within R. It can be used for computer algebra, exact arithmetic, ASCII pretty printing and R to TeX output. R, yacas and Ryacas are all free software packages distributed under the
... [More] GPL. Samples of Ryacas are in this sample session, in this message regarding calculus and in the package vignette. Ryacas is available on CRAN now.
Since developing Ryacas a new java version of yacas was developed and a fork of it called Mathpiper is under development. To take advantage of this activity, the Ryacas development is moving to Mathpiper and the new project, rMathpiper, can be found at http://rmathpiper.googlecode.com. Also see the STATUS section below.
Readers should also note the availability of the rSymPy CRAN project which interfaces to the jython version of the sympy computer algebra system.
Below on this page are sections on:
NEWSTECHNOLOGYSOURCE REPOSITORYSTATUSR INTERFACESAMPLE SESSIONMORE INFORMATIONTEAMINSTALLATIONChoosing a PlatformWindows InstallationUNIX/Linux/Mac InstallationTROUBLESHOOTINGUNIX/Linux Troubleshooting
NEWSIn addition to the NEWS items below see the NEWS file that comes with Ryacas. It is more focused on changes in the package itself than the news listed here.
February 5, 2010. A new version, Ryacas 0.2-10, has been added to the repository and uploaded to CRAN. It is a bug fix version.
October 21, 2009. The java version of yacas project appears to have moved to Mathpiper of the Mathrider project. See announcement here. The STATUS section below has been updated accordingly.
October 21, 2009. YacasCE (google translation) for the pocket PC (Windows mobile) is available.
August 23, 2009. It seems that a new release of the XML package has again broken Ryacas. Use XML 2.5.3 or XML 1.9.0 with Ryacas instead.
July 13/09. It may be that the problem between Ryacas 0.2-9 and XML 2.3-0 (mentioned in news item for Mar 12/09) is resolved by simply using the new release of the XML package, XML 2.5-3 instead of the older versions of the XML package. Will need to check a bit more to be sure.
Mar 12/09. Just found an incompatibility between Ryacas 0.2-9 and XML 2.3-0. Until this is fixed use Ryacas 0.2-7 and XML 1.96-0. If you are having difficulty with this try the rSymPy package instead.
Mar 9/09. UNIX/Linux Installation section further down on this page has been rewritten.
Mar 3/09. Ryacas 0.2-9 is now available on CRAN. Primary change is to require XML 2.1-0 or higher and some fixes to the documentation to pass R CMD CHECK on R 2.9.0. Note that Ryacas seems to work once again with the latest version the XML package, XML 2.1-0. It also worked with XML 1.96-0 but versions of the XML package after XML 1.96-0 but before XML 2.1-0 did not work with Ryacas.
Dec 21/08. Added Troubleshooting instructions on how to use XML 1.96-0 with Ryacas even if you have a newer version of XML installed at the same time.
Nov 16/08. In Troubleshooting section below, Ryacas works with XML package version 1.96-0 but not with XML package version 1.98-1.
May 07/08. In Troubleshooting section below added a tip about deleting .yacCon .
Feb 04/08. Gregor Gorjanc's blog has an article on how to use Ryacas via Sweave in LyX.
Oct 17/07. Added an item to the troubleshooting section that Ryacas 0.2-7 has only been tested with yacas 1.0.63. Windows users of Ryacas 0.2-7 will automatically get yacas 1.0.63 if they use the Ryacas yacasInstall() command to install yacas but users on Mac and UNIX platforms currently need to be aware of this so they install yacas 1.0.63 and not a different version of yacas. The SystemRequirements: line of the Ryacas DESCRIPTION file indicates that yacas 1.0.63 or greater should be used; however, versions greater than 1.0.63 have not been tested and so might not work with Ryacas 0.2-7.
Oct 15/07. Reorganized multiple Installation and multiple Troubleshooting sections (end of this page) into a single section for each with subsections.
Sep 9/07. Version 0.2-7 of Ryacas uploaded to CRAN. Changes include socket timing improvement in yacas.R suggested by Petr Savicky, a new Encoding: line in DESCRIPTION file to handle R 2.6.0 warnings and several other minor changes to handle R 2.6.0 compatability.
Aug 19/07. dep=TRUE is the default for install.packages so instructions have been simplified.
May 13/07. The install.packages('Ryacas', dep = TRUE) command for installing Ryacas on Mac is now the same as on UNIX so the installation sections for Mac and UNIX have been combined into one below.
May 12/07. Ryacas 0.2-6 now on CRAN. Bug fix version. See NEWS.
May 5/07. In Links section to right added new link to CRAN. (Removed links to Omegahat and Ryacas Yahoo group since Ryacas distribution is now via CRAN.)
May 1/07. Ryacas has been uploaded to CRAN. (Previously it was on Omegahat.) Also Ryacas is upgraded to 0.2-5 to accomodate changes in R that were made with R 2.5.0. Earlier versions of R will not work with this version of Ryacas. Note that yacas.exe is no longer included with Ryacas but for Windows users only there does exist a yacasInstall() command that can be issued without arguments from within R to download and install yacas.
Jan 17/06. Added Wikipedia CAS Comparison to Links section on right.
Jan 9/06. The Downloads tab above contains yacas 1.0.63 source code in a .tar.gz file as well as the Windows yacas 1.0.63 binaries in a .zip file. yacas.exe and scripts.dat have been removed from the svn repository in preparation for CRAN -- as CRAN packages cannot have binaries in their source :(
Dec 28/06. Added a note for installing Ryacas under Gentoo on this page in the UNIX TROUBLESHOOTING section below.
Dec 23/06. The Sample Session formerly on this page has been moved to the Wiki. See Wiki tab above.
Dec 6/06. The two vignettes are now combined into one. Click on Ryacas - vignette in Links section to right.
Nov 19/06. The very latest (development) version (to become 0.2-4) is available via svn from the Source tab at top of this page. It is expected that this version will become eventually be available from CRAN. Until then use Ryacas 0.2-3 as in following news items. Anyone who would like to test the development version out, any feedback (to the developers listed under TEAM) would be appreciated.
Nov 19/06. Ryacas 0.2-3 is now available for download from Omegahat via the install.packages command (or the Ryacas on Omegahat - Download links)
Nov 16/06. Ryacas 0.2-3 is available from google groups (see Ryacas on google groups - Download link to right). Note that google groups has the annoying habit of translating dashes in filenames to spaces so after downloading the file you will have to change the name so that any spaces are replaced with dashes.
TECHNOLOGYRyacas is written in R. It uses a recursive decent R-to-yacas translator and an XML-based OpenMath yacas-to-R translator. yacas is run as a second process and communicates via a socket interface with R. The design allows for the future possibility of running Ryacas on a low powered client connected to a high power remote yacas compute server over the internet.
SOURCE REPOSITORYThe svn repository on this site (click on Source tab above) contains the source code to Ryacas and generated PDF file for the vignette.
On Windows, yacas.exe and scripts.dat are included in the Ryacas 0.2-3 distribution but not in the Ryacas 0.2-4 or later distributions; however, in those Windows versions not having yacas.exe and scripts.dat there is a yacasInstall() command in Ryacas which allows one to easily fetch and install them from the internet by simply issuing the command yacasInstall() from within R.
STATUSRyacas.The Ryacas package was developed several years ago and development has largely stopped (although a bug fix version was issued Feb 5, 2010) and now effort goes into the rMathpiper and rSymPy projects.
Yacas. Regarding yacas itself (as opposed to Ryacas), the original developer behind yacas appears to have left the yacas project. Just before he left he rewrote yacas in Java. Currently Alberto González Palomo continues to make improvements to the C version yacas although there have been no recent releases.
MathpiperIDE. The java version of yacas was adopted by the MathpiperIDE project in 2008 (which had been called Mathrider at the time and though the name has since been changed) and Ted Kosan has indicated that under the MathpiperIDE/Mathrider project he has forked the java version of yacas and he and Howard "Sherm" Ostrowsky have made 2,700 svn commits (from March 2008 to October 2009) of which about half were for Mathpiper (and the rest for Mathrider). The new name Mathpiper is used to distinguish it from the apparently unmaintained yacas.jar prior to the fork. (The original version of the java version of yacas is available on the yacas site).
Mathpiper. Mathpiper is located at http://mathpiper.googlecode.com. The mathpiper.jar file is located in the mathrider/jars directory in the !MathPiperIDE (formerly Mathrider) distribution which can be found at http://mathrider.org. The javadocs can be found here. One can launch the GUI console like this:
java -jar mathpiper.jarOne can launch the text console like this:
java -cp mathpiper.jar org.mathpiper.ui.text.consoles.Consoleand one can launch the help application like this:
java -cp mathpiper.jar org.mathpiper.ui.gui.help.FunctionTreePanelOne significant new feature in Mathpiper is the ability to emit R code using the following command (which puts Mathpiper in a mode such that all code emitted is R):
PrettyPrinter("RForm")This new feature was added to Mathpiper version 0.76t .
R INTERFACEThere are 8 interfaces. All except runYacas are built on top of yacas.character:
yacas.character. Pass a raw yacas character string to yacas function. e.g. yacas('x*x') yacas.expression. Pass an R expression to yacas function. e.g. yacas(expression(x*x)) yacas.function. Pass an R function name which defines a one-line R function. e.g. f yacas.formula. Pass an R formula object whose right hand side will be regarded as an expression to pass to yacas.expression. e.g. yacas(~ x*x) Sym object. These objects are internally yacas strings. They can be combined with arithmetic operators The print method calls yacas. e.g. x Expr object. These objects are internally R expressions. They can be combined with artithmetic operators. e.g. x yacmode() which places the session in a mode where one can directly type in yacas commands. runYacas(). Shells out to a yacas session.
SAMPLE SESSIONClick on Wiki tab above and then click on Sample Session. For a sample session illustrating calculus computations look here .
MORE INFORMATIONThe R commands
package?Ryacaswill display pointers to the help commands, vignette, home page, demos and THANKS, WISHLIST and NEWS files. These files, including pdf versions of the vignette, can also be found in the Source repository by clicking on the Source tab above.
TEAMRob Goedman, goedman at mac dot com Gabor Grothendieck, ggrothendieck at gmail dot com Søren Højsgaard, Soren.Hojsgaard at agrsci dot dk Ayal Pinkus, apinkus at xs4all dot nl Contact Gabor if you need assistance or Rob if its Mac-related.
INSTALLATIONChoosing a PlatformRyacas 0.2-4 and later on Windows contains a command, yacasInstall(), that is issued without arguments that will automatically download and install yacas for you, so Ryacas is particularly easy to install on Windows. Also there are a few extra commands available on Windows: yacasFile and yacasCheck that are not available on Ryacas in other operating systems. Thus if you have a choice of platforms you may wish to use Windows.
The development of Ryacas was primarily done on Windows and Mac so next best choice would be Mac.
We have had reports of successful use on UNIX too; however, because there has not been recent development on that platform some troubleshooting of the installation may be necessary on UNIX. There is a UNIX troubleshooting section below just in case.
Windows InstallationNote: On Vista you may need to run R as Administrator (right click R icon and choose Run As Administrator) while installing Ryacas depending on your configuration.
Issue these three commands in R. They will install Ryacas from CRAN, load it and download yacas from the internet into R_HOME\library\Ryacas\yacdir (where R_HOME refers to your R installation folder:
yacasInstall()Old: This is no longer needed but at one time it was necessary to ensure that a certain version of the XML package was used.
Replace the commented out library command with something like:
library(XML, lib = file.path(Sys.getenv("R_LIBS_USER"), "../2.7"))or possibly just this:
library(XML, lib = "~/R/win-library/2.7")if you don't have XML 1.96-0 installed under your current version of R but do have it under an installation of R 2.7 on the same machine.
UNIX/Linux/Mac Installation Install GSL Download "http://ryacas.googlecode.com/files/yacas-1.0.63.tar.gz" and extract. wget http://ryacas.googlecode.com/files/yacas-1.0.63.tar.gz
tar zvxf yacas-1.0.63.tar.gz Follow the instructions in section C in yacas-1.0.63/INSTALL, where in the confuguration step, be sure to include the option "--enable-server": ./configure --enable-server Install Ryacas. i.e. from within R issue this command: install.packages("Ryacas")or, alternately, from the shell enter:
R CMD INSTALL Ryacas_1.0.63.tar.gzTROUBLESHOOTINGMost installation problems are caused by one of these:
using an old version of Ryacas. Ensure you are using he latest version of Ryacas. (The old version of Ryacas only works with certain old versions of XML pckage. XML version 2.5-3, XML version 2.1-0 and XML version 1.96-0 and prior seem to work; however, a number of other versions of the XML package which may include the latest version of the XML package do not work with Ryacas.) not using yacas 1.0.63 with Ryacas 0.2-9 (Windows users can use the Ryacas yacasInstall() command which will automatically find the correct yacas version on the net and install it. Others can find yacas here. forgetting to download and install yacas (see last point) yacas was not built with the server enabled. On UNIX: ./configure --enable-server yacas is not started in server mode -- this is different from its normal interactive mode a left over .yacCon variable in your workspace from a failed attempt can be a problem. In that case just delete it: rm(.yacCon) yacas is not being intialized to start in OpenMath mode. This is the mode where XML output is generated. A yacas command is normally issued automatically to do that but if somehow this command does not get issued the session will fail to work: PrettyPrinter("OMForm");UNIX/Linux TroubleshootingHere are some of the common problems that UNIX/Linux/Mac users encounger:
1. Startup Timing Issues. (Ryacas 0.2-7 has fixed this but we have left this point in just case.) The first time you issue the yacas command in each session Ryacas is supposed to start the yacas process; however, there can be timing problems on some systems so if it does not start up just issue another yacas command and it will likely start.
2. Telnet problems. If you are unable to get a connection at all try to connect to yacas manually using
telnet localhost 9734making sure that yacas is indeed running since you cannot telnet to a process that is not there! Also read the link 'Ryacas & Telnet' in the links section of this page. If you think you have telnet problems that you cannot resolve then you can run Ryacas without telnet but that will result in no memory from one command to the next. To run without telnet use the method = 'system' argument on yacas or set the yacas.method option to 'system'.
options(yacas.method = 'system')
x 3. Startup Configuration Problems. The following should normally not be needed but if you are having problems even after the above, try entering this into R to configure your system. One Debian user indicated that this solved his problem in getting Ryacas to work:
cat("PrettyPrinter('OMForm');\n", file = "~/.yacasrc")
Sys.setenv(YACAS_INVOKE_STRING = 'yacas -pc --server 9734')The cat line above only has to be done once while the second line needs to be done before each Ryacas session. Please contact one of the developers if you find this is necessary so we can keep track of this.
4. FC and Others. HowTo: Ryacas Installation on FC discusses how to get Ryacas working on Fedora systems. Some of the information here may apply to other UNIX systems too. Warning: Some of the info in that link may be outdated now.
5. Gentoo. One Gentoo user of Ryacas found that Gentoo does have Yacas in its Portage package repository, but it installs without the '--enable-server' option so install Yacas from source and configure with the '--enable-server' option as Marc Schwartz did on Fedora Core (see previous point, #4). Then change the Use statement in R.ys to an absolute path so that R.ys looks like this:
// Start with the default initialization, R-specific initialization to follow
PrettyPrinter('OMForm'); 6. One user was finding he could only launch yacas when logged in as root. After deleting the .yacCon variable -- rm(.yacCon) -- that had been left over from a failed attempt this rectified itself.
7. Note that on UNIX you may need to detach the Ryacas package prior to exiting R:
detach() # assuming Ryacas was last one loadedor
stopYacas()8. Make sure that yacas is in the PATH environment variable. This is usually guaranteed by the "make install" step of the compilation of Yacas. However, you may easily verify it. Typing "yacas" to the command line should start an interactive Yacas session.
9. When installing yacas be sure to use