yacas interface
Interface to the yacas computer algebra system.
yacas(x, ...) ## S3 method for class 'character' yacas(x, verbose = FALSE, method, retclass = c("expression", "character", "unquote"), addSemi = TRUE, ...)
x |
A yacas character string or an R expression without terminating semicolon to be processed by yacas. |
... |
Additional arguments ultimately passed down to
|
verbose |
A logical value indicating verbosity of output or
|
method |
method used to communicate with yacas. If |
addSemi |
If |
retclass |
The class of the first component of the yacas structure. It
defaults to |
The user supplies an R expression, an R function name corresponding to a function with a single line body, a formula or a yacas input string. In the case of a formula it is regarded as an expression represented by the right hand side of the formula while the left hand side, if any, is ignored.
Note the silent version syacas()
.
An R object of class "yacas"
is returned. If
PrettyPrinter("OMForm")
is in effect, which it is by default, then
the first component is an R expression and the OMForm
component
contains OpenMath XML code. In other cases the first component is NULL and
the YacasForm
or PrettyForm
components have display
information.
Generally an expression. Refer to details.
Windows Installation. On Windows one can install Ryacas
by
issuing the commands:
install.packages("Ryacas", dep = TRUE)
|
library(Ryacas)
|
yacasInstall()
|
or by using the Packages | Install package(s)
menu in place of the
first command. The second command downloads scripts.dat
and
yacas.exe
from the internet and installs them into
R_HOME/library/Ryacas/yacdir
where R_HOME
is the location of
your R
installation.
Normally the default locations of yacas, its initialization file and the
scripts file are sufficient but, if necessary, they can be overridden via
the environment variables: YACAS_HOME
, YACAS_INIT
and
YACAS_SCRIPTS
. The YACAS_INVOKE_STRING
environment variable
discussed in the next section overrides all three of these.
All OS Installation. The YACAS_INVOKE_STRING
environment variable
can be used to override the invocation string for yacas. Normally it is not
used. If it does need to be used then a typical use might be:
library(Ryacas)
|
# only need to do the file.copy
command once
|
file.copy(system.file("yacdir/R.ys", package =
"Ryacas"), "~/.yacsrc")
|
# this needs to be done once per
session
|
Sys.setenv(YACAS_INVOKE_STRING = "yacas -pc --server
9734")
|
demo(Ryacas) # test it out
|
yacmode. There is also a utility yacmode which is called without arguments and just turns R into a terminal into yacas until one quits out of it (and back to R) by entering stop, end, quit, exit or e.
Startup. yacas
starts up when yacasStart()
is called or the
first time yacas
is called. yacas is shut down when
yacasStop()
is called or when the package is detached using the
detach()
R command. On Windows, when yacas is shut down, the yacas
process is terminated on Windows XP Pro but not on other versions of
Windows. In those cases there will be a dangling process that the user must
terminate manually.
Translation. The translation process occurs in several steps. If the input
to the yacas
function is an expression then it is translated to a
valid yacas character string (otherwise, it is sent to yacas unprocessed).
Yacas then processes the string and if retclass="expression"
it is
translated back to an R expression (otherwise it is sent back unprocessed).
Examples of translations are:
R | yacas |
sin(x) | Sin(x) |
deriv(sin, x) | Deriv(x)Sin(x) |
log(x) | Ln(x) |
yacas(expression(Factor(x^2-1))) exp1 <- expression(x^2 + 2 * x^2) exp2 <- expression(2 * exp0) exp3 <- expression(6 * pi * x) exp4 <- expression((exp1 * (1 - sin(exp3))) / exp2) print(yacas(exp4)) print(yacas("Version()")) # yacas version # see demo("Ryacas-Function")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.