Maxima Function
rat (expr)
rat(expr,x_1,...,x_n)
Converts expr to canonical rational expression (CRE) form by expanding and
combining all terms over a common denominator and cancelling out the
greatest common divisor of the numerator and denominator, as well as
converting floating point numbers to rational numbers within a
tolerance of ratepsilon
.
The variables are ordered according
to the x_1, ..., x_n, if specified, as in ratvars
.
rat
does not generally simplify functions other than
addition +
, subtraction -
, multiplication *
, division /
, and
exponentiation to an integer power,
whereas ratsimp
does handle those cases.
Note that atoms (numbers and variables) in CRE form are not the
same as they are in the general form.
For example, rat(x)- x
yields
rat(0)
which has a different internal representation than 0.
When ratfac
is true
, rat
yields a partially factored form for CRE.
During rational operations the expression is
maintained as fully factored as possible without an actual call to the
factor package. This should always save space and may save some time
in some computations. The numerator and denominator are still made
relatively prime
(e.g. rat ((x^2 - 1)^4/(x + 1)^2)
yields (x - 1)^4 (x + 1)^2)
,
but the factors within each part may not be relatively prime.
ratprint
if false
suppresses the printout of the message
informing the user of the conversion of floating point numbers to
rational numbers.
keepfloat
if true
prevents floating point numbers from being
converted to rational numbers.
Examples:
(%i1) ((x - 2*y)^4/(x^2 - 4*y^2)^2 + 1)*(y + a)*(2*y + x) / (4*y^2 + x^2); 4 (x - 2 y) (y + a) (2 y + x) (------------ + 1) 2 2 2 (x - 4 y ) (%o1) ------------------------------------ 2 2 4 y + x (%i2) rat (%, y, a, x); 2 a + 2 y (%o2)/R/ --------- x + 2 y