Contents

Dom::Fraction

Field of fractions of an integral domain

Syntax

Domain Creation

Dom::Fraction(R)

Element Creation

Dom::Fraction(R)(r)

Description

Domain Creation

Dom::Fraction(R) creates a domain which represents the field of fractions of the integral domain R.

An element of the domain Dom::Fraction(R) has two operands, the numerator and denominator.

If Dom::Fraction(R) has the axiom Ax::canonicalRep (see below), the denominators have unit normal form and the gcds of numerators and denominators cancel.

The domain 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).

Element Creation

If 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 , 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.

Superdomain

Dom::BaseDomain

Categories

Cat::QuotientField(R)

Examples

Example 1

We define the field of rational functions over the rationals:

F := Dom::Fraction(Dom::Polynomial(Dom::Rational))

and create an element of F:

a := F(y/(x - 1) + 1/(x + 1))

To calculate with such elements use the standard arithmetical operators:

2*a, 1/a, a*a

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)

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)
)

b := Fxy(y/(x - 1) + 1/(x + 1)): 
b^3

Example 2

We create the field of rational numbers as the field of fractions of the integers, i.e., :

Q := Dom::Fraction(Dom::Integer):
Q(1/3)

domtype(%)

Another representation of 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).

Parameters

R

An integral domain, i.e., a domain of category Cat::IntegralDomain

r

A rational expression, or an element of R

Entries

"characteristic"

is the characteristic of R.

"coeffRing"

is the integral domain R.

"one"

is the one of the field of fractions of R, i.e., the fraction 1.

"zero"

is the zero of the field of fractions of R, i.e., the fraction 0.

Methods

expand all

Mathematical Methods

_divide — Divide two fractions

_divide(x, y)

This method overloads the function _divide for fractions, i.e., one may use it in the form x / y or in functional notation: _divide(x, y).

_invert — Invert a fraction

_invert(r)

This method overloads the function _invert for fractions, i.e., one may use it in the form 1/r or r^(-1), or in functional notation: _invert(r).

_less — Less-than relation

_less(q, r)

An implementation is provided only if R is an ordered set, i.e., a domain of category Cat::OrderedSet.

This method overloads the function _less for fractions, i.e., one may use it in the form q < r, or in functional notation: _less(q, r).

_mult — Multiplie fractions by fractions or rational expressions

_mult(q, r)

If 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.

This method also handles more than two arguments. In this case, the argument list is splitted into two parts of the same length which both are multiplied with the function _mult. The two results are multiplied again with _mult whose result then is returned.

This method overloads the function _mult for fractions, i.e., one may use it in the form q * r or in functional notation: _mult(q, r).

_negate — Negate a fraction

_negate(r)

This method overloads the function _negate for fractions, i.e., one may use it in the form -r or in functional notation: _negate(r).

_power — Integer power of a fraction

_power(r, n)

This method overloads the function _power for fractions, i.e., one may use it in the form r^n or in functional notation: _power(r, n).

_plus — Add fractions

_plus(q, r, …)

If one of the arguments is not of the domain type Dom::Fraction(R), then FAIL is returned.

This method overloads the function _plus for fractions, i.e., one may use it in the form q + r or in functional notation: _plus(q, r).

D — Differential operator

D(r)

An implementation is provided only if R is a partial differential ring, i.e., a domain of category Cat::PartialDifferentialRing.

This method overloads the operator D for fractions, i.e., one may use it in the form D(r).

denom — Denominator of a fraction

denom(r)

This method overloads the function denom for fractions, i.e., one may use it in the form denom(r).

diff — Differentiation of fractions

diff(r, u)

This method overloads the function diff for fractions, i.e., one may use it in the form diff(r, u).

An implementation is provided only if R is a partial differential ring, i.e., a domain of category Cat::PartialDifferentialRing.

factor — Factorize the numerator and denominator of a fraction

factor(r)

The factors u, r1, …, rn are fractions of type Dom::Fraction(R), the exponents e1, …, en are integers.

The system function factor is used to perform the factorization of the numerator and denominator of r.

This method overloads the function factor for fractions, i.e., one may use it in the form factor(r).

iszero — Test for zero

iszero(r)

An element of the field 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.

This method overloads the function iszero for fractions, i.e., one may use it in the form iszero(r).

numer — Numerator of a fraction

numer(r)

This method overloads the function numer for fractions, i.e., one may use it in the form numer(r).

random — Random fraction generation

random()

The returning fraction is normalized (see the methods "normalize" and "normalizePrime".

Conversion Methods

convert_to — Fraction conversion

convert_to(r, T)

If the conversion fails, FAIL is returned.

The conversion succeeds if T is one of the following domains: Dom::Expression or Dom::ArithmeticalExpression.

Use the function expr to convert r into an object of a kernel domain (see below).

expr — Convert a fraction into an object of a kernel domain

expr(r)

The result is an object of a kernel domain (e.g., DOM_RAT or DOM_EXPR).

This method overloads the function expr for fractions, i.e., one may use it in the form expr(r).

TeX — TeX formatting of a fraction

TeX(r)

The method TeX of the component ring R is used to get the TeX-representations of the numerator and denominator of r, respectively.

Technical Methods

normalize — Normalizing fractions

normalize(x, y)

Normalization means to remove the gcd of 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 .

normalizePrime — Normalizing fractions over integral domains with a gcd

normalizePrime(x, y)

In rings of category Cat::GcdDomain, elements are assumed to be relatively prime. Hence, there is no need to normalize the fraction .

In rings not of category Cat::GcdDomain, normalization of elements can not be performed and the result of this method is the fraction .

See Also

MuPAD Domains

Was this topic helpful?