Dom::ExpressionField
Domains of expressions forming a field
Syntax
Domain Creation
Dom::ExpressionField(<Normal, <IsZero>
>)
Element Creation
Dom::ExpressionField(Normal, IsZero)(e
)
Description
Domain Creation
Dom::ExpressionField(Normal, IsZero)
creates
a domain of expressions forming a field, where the functions Normal
and IsZero
are
used to normalize expressions and test for zero.
The function Normal
is used to normalize
the expressions representing the elements, the function IsZero
is
used to test the expressions for zero. It is assumed that the field
has characteristic 0.
The domain cannot decide if the element expressions—given
the normalizing function and zero test—actually form a field.
It is up to the user to choose correct functions for normalizing and
zero test and to enter only valid expressions as domains elements.
One should view this domain constructor as a pragmatic way to
create a field of characteristic 0 in an adhoc fashion. Note that
the default of using id
and iszero
does not yield
a field really, but it is often convenient and sensible to use the
resulting structure as a field.
Normal
must be a function which takes an
expression representing a domain element and returns the normalized
expression. Normal
should return FAIL
if the expression
is not valid.
If Normal
is not given, then the system function id
is used, i.e., only
the kernel simplifier is used to normalize expressions.
If a normalizing function other than id
is given, it is assumed that this
functions returns a normal form where the zero element is uniquely
represented by the constant 0
.
IsZero
must be a function which takes an
expression representing a domain element and returns TRUE
if the expression
represents zero and FALSE
otherwise.
If IsZero
is not given, then iszero
@ Normal
is used for zero testing. If Normal
is
equal to id
this
functional expression is simplified to iszero
.
If Normal
is equal to id
and IsZero
is equal
to iszero
, a
façade domain is created, i.e., the domain elements are simply
expressions and are not explicitly created by new
.
Otherwise the elements of the domain are explicitly created
by new
. Each
such element has one operand, which is the expression representing
the domain element. The element expressions are normalized after each
operation using the function Normal
.
Element Creation
Dom::ExpressionField(Normal, IsZero)(e)
creates
a field element represented by the expression e
.
The expression is normalized using the function Normal
.
If Normal
returns FAIL
, it is assumed
that the expression does not represent a valid field element. If this
test is not fully implemented the domain cannot decide if the expression
represents a valid field element. In this case it is up to the user
to enter only valid expressions as field elements.
If Normal
is equal to id
and IsZero
is equal
to iszero
, the
domain is only a façade domain. In this case the expression e
is
returned after being simplified by the builtin kernel simplifier.
Axioms
Ax::indetElements
If Normal = id
and IsZero = iszero
,
then Ax::efficientOperation ("_divide"), Ax::efficientOperation
("_mult"), Ax::efficientOperation("_invert")
, else Ax::normalRep
.
If Normal = id
and IsZero =
iszero
and IsZero = iszero
, then Ax::systemRep
.
Examples
Example 1
Dom::ExpressionField(normal)
creates a field
of rational expressions over the rationals. The expressions representing
the field elements are allways normalized by normal
:
The field elements are explicit elements of the domain:
Example 2
In the domain Dom::ExpressionField(id, iszero@normal)
the
expressions representing the elements are normalized by the kernel
simplifier only:
The elements of this domain are not normalized (when viewed
as rational expressions over the rationals), thus the domain does
not have the axiom Ax::normalRep
:
But nevertheless this domain also represents the field of rational
expressions over the rationals, because zero is detected correctly
by the function iszero @ normal
:
Parameters
Normal

A function used to normalize the expressions of the domain;
default is id .

IsZero

A function used to test the expressions of the domain for zero;
default is iszero @ Normal .

e

An expression representing a field element.

Entries
"characteristic"  The characteristic of the fields created by this constructor
is assumed to be 0 . 
"one"  The element represented by the expression 1 is
assumed to be a neutral element w.r.t. "_mult" . 
"zero"  The element represented by the expression 0 is
assumed to be a neutral element w.r.t. "_plus" . 
Methods
expand all
Mathematical Methods
abs
— Absolute value
abs(x
)
Overloads the function abs
,
thus may be called via abs(x)
.
combine
— Combine terms of the same algebraic structure
combine(x
, <a
>)
Overloads the function combine
,
thus may be called via combine(x,...)
.
conjugate
— Complex conjugate
conjugate(x
)
Overloads the function conjugate
,
thus may be called via conjugate(x)
.
D
— Differential operator
D(<l
>, x
)
Overloads the function D
, thus may be called via D(x)
or D(l,
x)
.
denom
— Denominator
denom(x
)
Overloads the function denom
,
thus may be called via denom(x)
.
diff
— Differentiate an element
diff(x
, <v, , …
>)
Overloads the function diff
,
thus may be called via diff(x,...)
.
_divide
— Divide elements
_divide(x
, y
)
Overloads the function _divide
, thus may be called via x/y
or _divide(x,
y)
.
equal
— Test for mathematical equality
expand
— Expand an element
expand(x
)
Overloads the function expand
,
thus may be called via expand(x)
.
factor
— Factorize an element
factor(x
)
Overloads the function factor
,
thus may be called via factor(x)
.
float
— Floatingpoint approximation
float(x
)
Overloads the function float
,
thus may be called via float(x)
.
gcd
— Greatest common divisor
gcd(x, …
)
Overloads the function gcd
,
thus may be called via gcd(x,...)
.
Im
— Imaginary part of an element
Im(x
)
Overloads the function Im
, thus may be called via Im(x)
.
int
— Definite and indefinite integration
int(x
, <v
>)
Overloads the function int
,
thus may be called via int(x,...)
.
intmult
— Integer multiple
_invert
— Invert an element
_invert(x
)
Overloads the function _invert
,
thus may be called via 1/x
or _invert(x)
.
iszero
— Test for zero
iszero(x
)
Overloads the function iszero
,
thus may be called via iszero(x)
.
lcm
— Least common multiple
lcm(x, …
)
Overloads the function lcm
,
thus may be called via lcm(x, ...)
.
_leequal
— Test if less or equal
_leequal(x
, y
)
Please note that the function _leequal
can only test numbers (in a
syntactical sense), but not constant expressions like PI or sqrt(2)
.
Overloads the function _leequal
,
thus may be called via x <= y
, y >=
x
or _leequal(x, y)
.
_less
— Test if element is less
_less(x
, y
)
Please note that the function _less
can only test numbers (in a syntactical
sense), but not constant expressions like PI or sqrt(2)
.
Overloads the function _less
,
thus may be called via x < y
, y >
x
or _less(x, y)
.
limit
— Limit computation
limit(x
, <v, …
>)
Overloads the function limit
,
thus may be called via limit(x,...)
.
max
— Maximum of arguments
max(x, …
)
Overloads the function max
,
thus may be called via max(x,...)
.
min
— Minimum of arguments
min(x, …
)
Overloads the function min
,
thus may be called via min(x,...)
.
_mult
— Multiplie elements
_mult(x, …
)
If all arguments are of this domain or can be coerced to this
domain (using the method coerce
),
the product of the expressions representing the arguments is calculated
using the function _mult
.
If one of the arguments cannot be coerced, the arguments up
to the offending one are multiplied and then the method "_mult"
of
the domain of the offending argument is called to multiply the remaining
arguments.
Overloads the function _mult
, thus may be called via x*...
or _mult(x,...)
.
_negate
— Negate an element
_negate(x
)
Overloads the function _negate
,
thus may be called via x
or _negate(x)
.
norm
— Norm of an element
norm(x
)
Overloads the function norm
,
thus may be called via norm(x)
.
Please note that the system function norm
, applied to an expression, computes
the norm of that expression interpreted as a polynomial expression
and not the absolute value of the expression.
This may be regarded as an inconsistency.
normal
— Normal form
normal(x
)
Overloads the function normal
, thus may be called via normal(x)
.
numer
— Numerator
numer(x
)
Overloads the function numer
,
thus may be called via numer(x)
.
_plus
— Add elements
_plus(x, …
)
If all arguments are of this domain or can be coerced to this
domain (using the method coerce
)
the sum of the expressions representing the arguments is calculated
using the function _plus
.
If one of the arguments cannot be coerced the arguments up to
the offending one are added and then the method "_plus"
of
the domain of the offending argument is called to add the remaining
arguments.
Overloads the function _plus
, thus may be called via x+...
or _plus(x,...)
.
_power
— Exponentiate arguments
_power(x
, y
)
_power(x
, y
)
If both arguments are of this domain the power is calculated
by mapping the function _power
to
the expressions representing the arguments.
If one of the arguments is not of this domain it is coerced
to this domain, then the power is computed. If the coercion fails
an error is raised.
Note that it is assumed that at least one of the arguments is
of this domain.
Overloads the function _power
,
thus may be called via x^y
or _power(x,
y)
.
radsimp
— Simplifie radicals
radsimp(x
)
Overloads the function radsimp
,
thus may be called via radsimp(x)
.
random
— Create a random element
random()
See polylib::randpoly
for
details about creating random polynomials.
Re
— Real part of an element
Re(x
)
Overloads the function Re
, thus may be called via Re(x)
.
sign
— Sign of an element
sign(x
)
Overloads the function sign
,
thus may be called via sign(x)
.
simplify
— General simplification of an element
simplify(x
, <a
>)
Overloads the function simplify
,
thus may be called via simplify(x,...)
.
solve
— Solve an equation
solve(x
, <a, …
>)
Note that this method will never return an element of this domain.
See solve
for
details about results and optional additional arguments.
Overloads the function solve
,
thus may be called via solve(x,...)
.
sqrfree
— Squarefree factorization
sqrfree(x
)
Overloads the function polylib::sqrfree
,
thus may be called via polylib::sqrfree(x)
.
_subtract
— Subtract elements
_subtract(x
, y
)
Overloads the function _subtract
,
thus may be called via xy
or _subtract(x,
y)
.
Conversion Methods
convert
— Convert to this domain
convert_to
— Convert to other domain
expr
— Convert to basic type
expr(x
)
This method is called by the function expr
if a subexpression of the argument
is an element of this domain.
new
— Creating an element
new(x
)
Overloads the function call operator for this domain, thus may
be called via F(x)
where F
is
this domain.
Access Methods
nops
— Number of operands
nops(x
)
Overloads the function nops
,
thus may be called via nops(x)
.
op
— Get operands
op(x
)
op(x
, i
)
Returns the operand with index i
of the expression
representing x
. If i
is 0
then
the operator of the expression is returned, which usually is not an
element of this domain. The other operands are converted to elements
of this domain.
This method is called by the function op
when an element of this domain is
contained, as a subexpression, in the first argument of op
. Operand ranges and
paths are handled by op
and
need not be handled by this method. See op
for details.
subs
— Substitute subexpressions
subs(x, e, …
)
Maps subs
to
the expression representing x
. The resulting expression
is converted to an element of this domain.
This method is called by the function subs
when an element of this domain is
contained, as a subexpression, in the first argument of subs
. See subs
for details.
subsex
— Extended substitution
subsex(x
, e
, ,
…
)
Maps subsex
to
the expression representing x
. The resulting expression
is converted to an element of this domain.
This method is called by the function subsex
when an element of this domain
is contained, as a subexpression, in the first argument of subsex
. See subsex
for details.
subsop
— Substitute operand
subsop(x
, e
, ,
…
)
This method is called by the function subsop
when an element of this domain
is contained, as a subexpression, in the first argument of subsop
. Operand ranges
and paths are handled by subsop
and
need not be handled by this method. See subsop
for details.
Technical Methods
indets
— Identifier of an element
indets(x
, <optionName
>)
Overloads the function indets
,
thus may be called via indets(x)
and indets(x,
optionName)
, respectively.
length
— Size of an element
length(x
)
Overloads the function length
,
thus may be called via length(x)
.
map
— Applie function to operands
map(x
, f
,
<a, …
>)
Overloads the function map
,
thus may be called via map(x, f,...)
.
rationalize
— Approximate floatingpoint numbers by rationals
rationalize(x
, <a,
…
>)
Note that this method does not overload
the function rationalize
from
the standard library package, but the function numeric::rationalize
from the numeric
package
instead. Thus the method may be called via numeric::rationalize(x,...)
.