| NEWS | R Documentation |
News for Package 'redcas'
Changes in redcas version 0.2.1 (2026-10-28)
New functions interfacing with REDUCE
This release introduces new set of interface functions which simplify the interaction with REDUCE for cases where no significant programming in REDUCE is needed. In addition, these functions return their results as suitable R objects. Furthermore it also provides functions for converting reduce objects to their counterparts in R.
redFunc executes a vector of any REDUCE built-in functions (prefix operators) or user-defined functions directly returning the results as either plain text or LaTeX.
factorize calls the REDUCE FACTORIZE operator to factorize an integer, rational, complex number or univariate and multivariate polynomials with such coefficients.
odesolve solves ordinary differential equations using the REDUCE ODESOLVE operator, return the results as an R redcas.odesolve object.
redDf calls the REDUCE DF operator to differentiate one or more expressions by one or more variables specifying the degree for each variable and returning the output as either R functions, LaTeX or plain text.
redLatex returns the results of REDUCE objects or expressions using LaTeX output. Supports optional translation of REDUCE variable names to user-defined names and conversion of function arguments to subscripts or superscripts.
R2latex sends R objects of type character, numeric, expression or data frame to REDUCE and converts these to LaTeX. Supports list input and converts any such objects leaving other types unchanged.
swset sets one or more switches to a desired state remembering which had to be changed so that these can later be restored to the original state using swreset.
swreset restores the previous state of the switches which were toggled by swset
the argument switches has been added to all functions which run REDUCE code (factorize, odesolve, red2Rarray, redDf, redFunc, redLatex, R2latex, redSolve, redStart) allowing control of switch states during function execution. This is implemented using the swset and swreset functions. redExec is the only exception because all other functions running REDUCE code do so via redExec.
the argument outfmt controls the output format of the functions factorize, odesolve, red2Rarray, redDf, redFunc, redLatex and redSolve. Possible values are expr, func, latex or text for producing output as an expression, a function, LATEX or plain text, respectively. The default varies depending on the function and not all options are available on all functions.
the arguments notify and timeout can now be passed via ... to redExec.
New utility functions
red2Rarray converts REDUCE arrays to R arrays.
red2Rfn creates R functions from REDUCE expressions.
red2Rlist converts REDUCE lists to R lists.
redlsExtract creates a character vector with one element per REDUCE list in the input and is used by red2Rlist.
fnMatch extracts REDUCE function calls and is used by red2Rlist.
dlmMatch calculates the coordinates of REDUCE lists in a character vector and is used by both redlsExtract and fnMatch.
sublist2char converts sublists containing only elements of type character to character vectors. This is used by red2Rlist if requested.
redin for easier entry of REDUCE code in R programs.
sessionGet function is now exported and documented and returns information about the session.
Improvements to handling LaTeX output
a new function, redLatex replaces asltx. redLatex uses a logical argument (latex) to determine whether output is LaTeX or plain. This allows the NAT setting to control the plain output. asltx is retained for compatibility and is now a wrapper for redLatex.
the argument use.names allows both redLatex and asltx to control whether the object's name followed by an equal sign is included in the output.
a bug which caused asltx to return a blank when the object is an unbounded variable or its value is an unbounded variable has been fixed in redLatex and therefore in asltx.
redLatex/asltx inputs may be R expressions.
the LaTeX command \* (multiplication) is replaced by space to avoid generating invalid LaTeX commands.
the usermap argument has a third element named "arb" which allows for arbitrary user transformations, not just identifier names and indices. arb transformations are run after index and before \* is converted to space so an alternative to space may be used.
when transforming arguments to indices added {} after all but last index to avoid invalid LaTeX commands when indices are variables.
redLatex/asltx accept vectors as input - the documentation for version 0.1.1 erroneously stated that this was not the case.
REDUCE matrices are considered expressions and so can be handled by redLatex/asltx.
new function ltx.append.eol appends the LaTeX end of line command to all but the last element of its input.
Changed functions
redStart accepts the switches argument.
redStart default for argument echo is now TRUE in order to avoid incorrect splitting of REDUCE output into commands and results.
redExec traps REDUCE aborts and writes the log file to the R transcript.
redExec traps the "***** unknown print item" error.
redSolve now can optionally produce LaTeX output and control the display of informational messages. The switches argument now takes input in the same form as swset but still accepts the previous format for compatibility.
redSolve now accepts R expressions for equations and unknowns.
Documentation
The "Introduction" document has been replaced by the vignette "Using redcas".
added vignettes "Brief Overview of REDUCE" and "Switches by Context".
help for redExec incorrectly stated that the REDUCE log is written to the current directory. In fact the log is written to the R transcript and the documentation now reflects this.
REDUCE URLs have changed.
Bug fixes
Use fixed=TRUE to find ^ when handling double superscript. Thanks to Mike Chirico for the hint.
If ECHO is off when REDUCE code is run, the first line of output can appear on a line with a command number resulting in this line not appearing in the output. To fix this, the default setting of the redStart echo argument is now TRUE. In addition, all interface functions with the exception of redExec now ensure ECHO is on for the duration of their execution.
redGetErrWarn searches REDUCE output for error and warning messages.
session handling functions now trap the error caused by a non-numeric session id.
prior to REDUCE 7130 odesolve did not load solve when dealing with plus_or_minus which caused odesolve to exit prematurely without error message. redStart now loads solve for earlier releases.
sessionExists failed if the session registry were empty producing an useless message for the user. This condition is now handled.
redSolve: fixed bug in print method which caused error with underdetermined systems of equations.
REDUCE functions
atoi is a new function to convert character to integer. Used for the case when reduce variable revision!* is character (as is the case for PSL in revision 7335) to convert to numeric so comparison works.
Changes in redcas version 0.1.1 (2024-11-05)
Initial release