_invert
-- the reciprocal of an
expression_invert
(x)
computes the reciprocal
1/x
of x
.
1/x _invert(x)
x |
- | an arithmetical expression or a set |
an arithmetical expression or a set.
x
_divide
, _negate
, ^
, /
, *
, +
, -
1/x
is equivalent to the function call
_invert(x)
. It represents the inverse of the element
x
with respect to multiplication, i.e., x * (1/x) =
1
.Type::Numeric
is returned as a
number.1/x
is overloaded for matrix domains (matrix
) and returns the inverse of
the matrix x
.x
is not an element of a library domain with an
"_invert"
method, 1/x
is internally
represented as x^(-1)
= _power(x, -1)
.x
is an element of a domain with a slot "_invert"
, then this method is used to
compute 1/x
. Many library domains overload the
/
operator by an appropriate "_invert"
slot.
Note that a/x
calls the overloading slot
x::dom::_invert(x)
only for a = 1
.x
nor y
overload the binary
operator /
by a "_divide"
method, the
quotient x/y
is equivalent to x * y^(-1)
=
_mult(x, _power(y, -1))
.1/X
is the set {1/x; x in
X}._invert
is a function of the system kernel.The reciprocal of an expression is the inverse with
respect to *
:
>> _invert(x), x * (1/x) = x * _invert(x)
1 -, 1 = 1 x
>> 3 * y * x^2 / 27 / x
x y --- 9
Internally, a symbolic expression 1/x
is
represented as x^(-1)
= _power(x, -1)
:
>> type(1/x), op(1/x, 0), op(1/x, 1), op(1/x, 2)
"_power", _power, x, -1
For finite sets, 1/X
is the set {1/x;
x in X}:
>> 1/{a, b, c}
{ 1 1 1 } { -, -, - } { a b c }
Various library domains such as matrix domains or residue class domains overload
_invert
:
>> x := Dom::Matrix(Dom::IntegerMod(7))([[2, 3], [3, 4]]): x, 1/x, x * (1/x)
+- -+ +- -+ | 2 mod 7, 3 mod 7 | | 3 mod 7, 3 mod 7 | | |, | |, | 3 mod 7, 4 mod 7 | | 3 mod 7, 5 mod 7 | +- -+ +- -+ +- -+ | 1 mod 7, 0 mod 7 | | | | 0 mod 7, 1 mod 7 | +- -+
>> delete x: