print: Print a redcas.solve object

printR Documentation

Print a redcas.solve object

Description

print.redcas.solve is a print method for function print in package base

Usage

print(x, ...) 

Arguments

x

a redcas.solve object returned by the function redSolve.

...

other arguments passed to print.

Details

print.redcas.solve displays the equations, solutions if any and the list of unknowns and switches. The solutions displayed are those returned from REDUCE without any transformation to R objects.

The layout depends on the length of the individual solution values and the width option. If there is sufficient space, the solutions for each unknown are printed in separate columns on the same line, for example with a width of 80, the output of the example below will be:

Equations:
  x+y+z = 0
  x^2 + y^2 + z^2 = 9
  x^2 + y^2 = z^2

Number of solutions: 4

Solutions:
               x               y               z
   2.12132034356               0  -2.12132034356
  -2.12132034356               0   2.12132034356
               0   2.12132034356  -2.12132034356
               0  -2.12132034356   2.12132034356

Unknowns: x,y,z
Switches:  rounded

If all values for a solution with not fit on a line, they are printed below each other. With a width of 30, the solutions section would be

Solution 1:
x:    2.12132034356
y:                0
z:   -2.12132034356

Solution 2:
x:   -2.12132034356
y:                0
z:    2.12132034356

Solution 3:
x:                0
y:    2.12132034356
z:   -2.12132034356

Solution 4:
x:                0
y:   -2.12132034356
z:    2.12132034356

Value

print.redcas.solve is called for its side-effect and returns NULL.

Examples

## start the session
r0 <- redStart()

## can only run code if session was successfully started
if (is.numeric(r0)) {
   rsobj <- redSolve(id=r0,
		     eqns=c("x+y+z = 0", "x^2 + y^2 + z^2 = 9", "x^2 + y^2 = z^2"),
		     unknowns=c("x", "y", "z"),
		     switch=c("on rounded;") )
   print(rsobj)
   redClose(r0)
}

redcas documentation built on April 12, 2025, 1:40 a.m.