rim-package {rim} | R Documentation |
rim
Description
Provides an interface to Maxima, a computer algebra system.
Usage
maxima.start(restart = FALSE)
maxima.stop(engine = FALSE)
maxima.get(command)
maxima.load(module)
maxima.apropos(keystring)
maxima.version()
maxima.isInstalled()
iprint(x)
## S3 method for class 'maxima'
print(x, ...)
maxima.eval(x, code = FALSE, envir = globalenv())
Arguments
restart |
if FALSE (default), then Maxima is started provided it is not running already. If TRUE starts or restarts Maxima. |
engine |
if FALSE (default), quits the (running) maxima instance and closes the connection, otherwise quits and closes the (running) maxima instance used for the knitr engine. |
command |
character string containing the Maxima command. |
module |
character vector naming the Maxima module (typically a *.mac or *.lisp file) to be loaded. |
keystring |
character vector containing a search term. |
x |
Either a character vector of length 1L or an S3 object of class "maxima" |
... |
other arguments (ignored). |
code |
A logical vector of length 1L, whether to attach the original expression (TRUE) or not (FALSE, default) |
envir |
A environment object. |
Details
Note: You need to install the Maxima software separately in order to make use of this package.
Maxima is set up automatically on attachment via library(rim)
and automatically started when a command is send (if it isn't running already) using maxima.get()
. If environment variable RIM_MAXIMA_PATH is not set, rim will search for the Maxima executable, or use the former otherwise. Using maxima.start()
and maxima.stop()
, one can stop and (re-)start the current Maxima session if needed, e.g. to clear Maxima command and output history.
To send a single command to Maxima and receive the corresponding output use maxima.get()
. This function returns a S3 object of class "maxima". The output is printed by printing the object and will be printed in a format currently set by maxima.options(format)
. The output format can be changed by setting it, e.g. maxima.options(format = "ascii")
. Output labels are printed according to option maxima.options(label)
.
Value
invisibly returns NULL.
Character vector of length 1 of the input command. Depending on whether option "label" is set to TRUE, the corresponding input reference label is printed preceding the input command.
The evaluated R-object
Functions
-
maxima.start()
: (re-)starts Maxima. -
maxima.stop()
: Quits Maxima. -
maxima.get()
: Executes a single Maxima command provided bycommand
. If no command ending character (;
or$
is provided,;
is appended. -
maxima.load()
: A wrapper to load a Maxima module named bymodule
-
maxima.apropos()
: A wrapper to the Maxima helper functionapropos
to lookup existing Maxima functions that matchkeystring
. -
maxima.version()
: Returns the version number of Maxima that is used -
maxima.isInstalled()
: Returns TRUE when an installation of Maxima has been detected, otherwise FALSE -
iprint()
: Prints the input command of an maxima S3-object returned bymaxima.get()
-
print(maxima)
: Prints the maxima output part of an S3 object returned bymaxima.get()
-
maxima.eval()
: Evaluates the parsed and quoted R-expression which is part of an S3 object returned bymaxima.get()
Author(s)
Maintainer: Eric Stemmler stemmler.eric@gmail.com
Authors:
Kseniia Shumelchyk shumelchyk@gmail.com
Hans W. Borchers hwborchers@googlemail.com
See Also
Useful links:
Report bugs at https://github.com/rcst/rim/issues
Examples
if(maxima.isInstalled()) maxima.start(restart = TRUE)
if(maxima.isInstalled()) {
maxima.start(restart = TRUE)
maxima.stop()
}
if(maxima.isInstalled()) maxima.get("2+2;")
if(maxima.isInstalled()) maxima.load("abs_integrate")
if(maxima.isInstalled()) maxima.apropos("integrate")
maxima.version()
maxima.isInstalled()
if(maxima.isInstalled()) {
a <- maxima.get("2+2;")
iprint(a)
}
if(maxima.isInstalled()) {
a <- maxima.get("2+2;")
print(a)
}
if(maxima.isInstalled()) {
a <- maxima.get("2+2;")
maxima.eval(a)
# same
maxima.eval("2+2;")
# evaluate with data.frame
df <- data.frame(x = seq(0, 1, by = 0.1))
maxima.eval("integrate(1 / (1 + x^4), x);", code = TRUE, envir = df)
maxima.stop()
}