Documentation Center |
Convert expression into rational function over a suitable field
This functionality does not run in MATLAB.
polylib::makerat(a, <maxd>) polylib::makerat(l, <maxd>)
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 gives a.
polylib::makerat(l) does the same for every element of the list l and returns lists of resulting f's and g'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 input a.
polylib::makerat(l) replaces all irrational subexpressions in all elements of l by newly created identifiers.
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 maxd is given.
The imaginary unit I is handled in a special way: it is replaced by the element `#I` of the algebraic extension field with minimal polynomial `\#I`^2 + 1. If I occurs in the input, the result consists of polynomials over that extension field.
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 maxd. 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:
polylib::makerat(x^2+3)
Transcendental expressions are replaced by new identifiers. The result indicates on which variables the generated identifiers depend:
polylib::makerat(sin(u)/x)
Floating point numbers are considered transcendental:
polylib::makerat(0.27*x)
By default, radicals are treated like transcendental subexpressions:
polylib::makerat(sqrt(2)/x)
If a sufficiently large second argument is given, radicals are replaced by elements of algebraic extensions:
polylib::makerat(sqrt(2)/x, 2)
a |
Polynomial over Expr or arithmetical expression |
l |
List or set of polynomials over Expr or arithmetical expressions |
maxd |
Positive integer |
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 Dom::AlgebraicExtension.
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.