Dom::Fraction
-- the field of
fractions of an integral domainDom::Fraction
(R)
creates a domain which
represents the field of fractions of an integral domain
R.
Dom::Fraction(R)
R |
- | an integral domain, i.e., a domain of category
Cat::IntegralDomain |
Dom::Fraction
(R)
creates a domain which
represents the field of fractions F = {x/y | x,y in R, y <>
0} of the integral domain R.Dom::Fraction
(R)
has two operands, the numerator and denominator.Dom::Fraction
(R)
has the axiom
Ax::canonicalRep
(see
below), the denominators have unit
normal form and the gcds of numerators and denominators
cancel.Dom::Fraction
(Dom::Integer)
represents the field of rational numbers. But the created domain is not
the domain Dom::Rational
, because it uses a
different representation of its elements. Arithmetic in
Dom::Rational
is much more efficient than it is in
Dom::Fraction
(Dom::Integer)
.Dom::Fraction
(R)(r)
r |
- | a rational expression, or an element of
R |
Cat::QuotientField(R)
r
is a rational expression, then an element of the
field of fractions Dom::Fraction
(R)
is
created by going through the operands of r
and converting
each operand into an element of R
. The result of this
process is r
in the form x/y, where
x and y are elements of R
. If
R
has Cat::GcdDomain
, then x and
y are coprime.
If one of the operands can not be converted into the domain
R
, an error message is issued.
is the characteristic of R
.
is the integral domain R
.
is the one of the field of fractions of R
, i.e., the
fraction 1/1.
is the zero of the field of fractions of R
, i.e., the
fraction 0/1.
_divide(dom x, dom
y)
x
by y
,
i.e., it computes x*y^(-1)._divide
for
fractions, i.e., one may use it in the form x / y
or in
functional notation: _divide(x, y)
._invert(dom r)
_invert
for
fractions, i.e., one may use it in the form 1/r
or
r^(-1)
, or in functional notation:
_invert(r)
._less(dom q, dom
r)
TRUE
if q = xq/yq is
smaller than r = xr/yr, i.e., if xq * yr < yq *
xr.R
is an ordered
set, i.e., a domain of category Cat::OrderedSet
._less
for
fractions, i.e., one may use it in the form q < r
, or
in functional notation: _less(q, r)
._mult(any q, any
r)
q
and r
are both fractions of the same
type, the product q * r is computed directly. The resulting
fraction is normalized (see the methods "normalize"
and
"normalizePrime"
).q
is not of the domain type
Dom::Fraction
(R)
, it is considered as a
rational expression which is converted into a fraction over
R
and multiplied with q
. If the conversion
fails, FAIL
is returned.
The same applies to r
.
_mult
. The two results are multiplied
again with _mult
whose result then is returned._mult
for fractions, i.e., one may use
it in the form q * r
or in functional notation:
_mult(q, r)
._negate(dom r)
_negate
for fractions, i.e., one may
use it in the form -r
or in functional notation:
_negate(r)
._power(dom r, integer
n)
n
._power
for fractions, i.e., one may
use it in the form r^n
or in functional notation:
_power(r, n)
._plus(dom q, dom
r...)
"normalize"
and
"normalizePrime"
).Dom::Fraction
(R)
, then FAIL
is
returned._plus
for fractions, i.e., one may use
it in the form q + r
or in functional notation:
_plus(q, r)
.D(dom r)
The resulting fraction is normalized (see the methods
"normalize"
and "normalizePrime"
).
R
is a partial
differential ring, i.e., a domain of category Cat::PartialDifferentialRing
.D
for fractions, i.e., one may use it in
the form D(r)
.denom(dom r)
r
, an element
of the integral domain R
.denom
for fractions, i.e., one may use
it in the form denom(r)
.diff(dom r, variable
u)
The resulting fraction is normalized (see the methods
"normalize"
and "normalizePrime"
).
diff
for fractions, i.e., one may use
it in the form diff(r, u)
.R
is a partial
differential ring, i.e., a domain of category Cat::PartialDifferentialRing
.equal(dom q, dom
r)
q
is equal to
r
, and returns TRUE
, FALSE
or
UNKNOWN
, respectively.factor(dom r)
r
into irreducible factors and returns r
in
the form r = u * r1^e1 * ... * rn^en.
The result is a factored object, i.e., an element of the domain type
Factored
. Its
factorization type is "irreducible"
and the factorization
ring is R
.
Dom::Fraction
(R)
, the exponents e1, ...,
en are integers.factor
is used to perform the
factorization of the numerator and denominator of r
.factor
for fractions, i.e., one may
use it in the form factor(r)
.intmult(dom r, integer n)
iszero(dom r)
TRUE
if r
is zero,
and FALSE
otherwise.Dom::Fraction
(R)
is zero if its numerator is the zero element of R
. Note
that there may be more than one representation of the zero element if
R
does not have Ax::canonicalRep
.iszero
for fractions, i.e., one may
use it in the form iszero(r)
.numer(dom r)
r
, an element of
the integral domain R
.numer
for fractions, i.e., one may use
it in the form numer(r)
.random()
"random"
of the domain R
to randomly
generate its numerator and denominator."normalize"
and "normalizePrime"
.convert_to(dom r, any
T)
r
into an element of the
domain T
, or, if T
is not a domain, to the
domain type of T
.FAIL
is returned.T
is one of the following
domains: Dom::Expression
or Dom::ArithmeticalExpression
.expr
to convert r
into an object of a kernel domain (see
below).expr(dom r)
TeX(dom r)
r
in form of a TeX \frac
construct.TeX
of the component ring R
is
used to get the TeX-representations of the numerator and denominator of
r
, respectively.retract(dom r)
r
by the
denominator of r
and returns the result, if it is an
element of R
. Otherwise, FAIL
is
returned.normalize(R x, R
y)
x
and
y
. Hence, R
needs to be of category Cat::GcdDomain
. Otherwise,
normalization cannot be performed and the result of this method is the
fraction x / y.normalizePrime(R x, R
y)
x
is zero, the fraction is normalized to zero.Cat::GcdDomain
, elements are assumed
to be relatively prime. Hence, there is no need to normalize the
fraction x / y.Cat::GcdDomain
, normalization of
elements can not be performed and the result of this method is the
fraction x / y.We define the field of rational functions over the rationals:
>> F := Dom::Fraction(Dom::Polynomial(Dom::Rational))
Dom::Fraction(Dom::Polynomial(Dom::Rational, LexOrder))
and create an element of F
:
>> a := F(y/(x - 1) + 1/(x + 1))
x + y + x y - 1 --------------- 2 x - 1
To calculate with such elements use the standard arithmetical operators:
>> 2*a, 1/a, a*a
2 2 x + 2 y + 2 x y - 2 x - 1 ---------------------, ---------------, 2 x + y + x y - 1 x - 1 2 2 2 2 2 2 - 2 x - 2 y + x + y + 2 x y + 2 x y + x y + 1 --------------------------------------------------- 2 4 - 2 x + x + 1
Some system functions are overloaded for elements of
domains generated by Dom::Fraction
, such as diff
, numer
or denom
(see the description of the
corresponding methods "diff"
, "numer"
and
"denom"
above).
For example, to differentiate the fraction a
with
respect to x
enter:
>> diff(a, x)
2 2 2 x - y - 2 x y - x - x y - 1 ------------------------------- 2 4 - 2 x + x + 1
If one knows the variables in advance, then using the
domain Dom::DistributedPolynomial
yields a more efficient arithmetic of rational functions:
>> Fxy := Dom::Fraction( Dom::DistributedPolynomial([x, y], Dom::Rational) )
Dom::Fraction(Dom::DistributedPolynomial([x, y], Dom::Rational, LexOrder))
>> b := Fxy(y/(x - 1) + 1/(x + 1)): b^3
2 3 2 3 2 2 (3 x + 3 y - 3 x y - 3 x + x - 3 y + y - 3 x y - 3 x y + 3 3 2 2 2 3 3 2 3 3 3 x y + 3 x y + 3 x y + 3 x y + 3 x y + x y - 1) / 2 4 6 (3 x - 3 x + x - 1)
We create the field of rational numbers as the field of fractions of the integers, i.e., Q = {x/y | x,y in Z }:
>> Q := Dom::Fraction(Dom::Integer): Q(1/3)
1/3
>> domtype(%)
Dom::Fraction(Dom::Integer)
Another representation of Q in MuPAD
is the domain Dom::Rational
where the rationals are
of the kernel domains DOM_INT
and DOM_RAT
. Therefore it is much more
efficient to work with Dom::Rational
than with
Dom::Fraction
(Dom::Integer)
.
Ax::normalRep
"factor"
for factoring fractions.