Convert expression into rational function over a suitable field
This functionality does not run in MATLAB.
polylib::makerat(a) returns two polynomials f and g over
the rationals and a list of substitutions such that applying the substitutions
to the rational function
polylib::makerat(l) does the same for every
element of the list
l and returns lists of resulting f's
polylib::makerat(a, maxd) replaces d-th
roots of integers by elements of some algebraic extension field over
the rationals if d ≤ maxd,
and returns polynomials f and g over
that extension field.
polylib::makerat(a) replaces all irrational
subexpressions (except identifiers) in
a by newly
created identifiers, thereby producing a rational function over the
rationals. It returns the numerator and denominator of that rational
function as polynomials over
Expr, and the substitutions
to be made to get back the numerator and denominator of the original
polylib::makerat(l) replaces all irrational
subexpressions in all elements of
l by newly created
Every subexpression is replaced by the same identifier every time it occurs.
All indeterminates of the input and all of the new identifiers
become indeterminates of the result, unless a second argument
The imaginary unit I is
handled in a special way: it is replaced by the element
the algebraic extension field with
`\#I`^2 + 1. If I occurs
in the input, the result consists of polynomials over that extension
If a second argument
maxd is given, d-th
roots of rationals are replaced by elements of a suitable field extension
of the rationals if d ≤ maxd.
In the same way, nested fractional powers of rationals are replaced
unless the denominator of some exponent exceeds
In this case, the returned result consists of polynomials over a tower
of extension fields over the rationals.
In the simplest case (integer polynomial), the numerator equals the input, the denominator equals 1, and no substitutions are necessary:
Transcendental expressions are replaced by new identifiers. The result indicates on which variables the generated identifiers depend:
Floating point numbers are considered transcendental:
By default, radicals are treated like transcendental subexpressions:
If a sufficiently large second argument is given, radicals are replaced by elements of algebraic extensions:
List or set of polynomials over
polylib::makerat returns an expression sequence
consisting of three operands:
The first operand represents the numerator (or the
list/set of numerators, respectively). It is a single polynomial if
the call was
polylib::makerat(a), otherwise it
is a set or list of polynomials (the same type as the input). The
polynomial(s) may have more indeterminates than the input. The coefficient
ring is either
Expr or a
The second operand represents the denominator (or the list/set of denominators, respectively). It is of the same type as the first operand.
The third operand is a list of equations.