Dom::MaxMinSemiRing – MaxMin semi-ring

Dom::MaxMinSemiRing creates a domain for the MaxMin semi-ring.

→ Examples

Creating Elements

MaxMinSemiRing(x)

Parameters:

x

real number, infinity or -infinity.

Superdomain

Dom::BaseDomain

Categories

Cat::SemiRing

Axioms

Ax::canonicalRep, Ax::normalRep

Related Domains:

Dom::MaxPlusSemiRing, Dom::MinMaxSemiRing, Dom::MinPlusSemiRing

Details:

The domain element Dom::MaxMinSemiRing(x) represents the constant math in the MaxMin semi-ring if math is a real number or real constant, or infinity or -infinity if math is infinity or -infinity.

Entries

"zero"

the constant infinity.

"one"

the constant -infinity.

Mathematical Methods

_plus – sum of MaxMin

Dom::MaxMinSemiRing::_plus(dom math, ...)

The sum math is defined to be the biggest of real numbers math.

This method overloads the function _plus.

_mult – product of MaxMin

Dom::MaxMinSemiRing::_mult(dom math, ...)

The product math is defined to be the smallest of real numbers, infinity or -infinity math.

This method overloads the function _mult.

_power – power of MaxMin

Dom::MaxMinSemiRing::_power(dom a, Dom::Integer n)

The nth power math of the MaxMin scalar a.

This method overloads the function _power.

Conversion Methods

convert – conversion of an object into a MaxMin scalar

Dom::MaxMinSemiRing::convert(any x)

This method tries to convert x into a MaxMin scalar. This is only possible if x is a real number, infinity or -infinity.

convert_to – conversion of a MaxMin scalar into another type

Dom::MaxMinSemiRing::convert_to(dom a, any T)

Tries to convert a into type T. Currently, only a conversion into a type of scalars.

expr – convert a MaxMin scalar into a real number, infinity or -infinity.

Dom::MaxMinSemiRing::expr(dom a)

This method returns a real number, infinity or -infinity such that generating a MaxMin scalar from that real number, infinity or -infinity would result in a.

Example 1:

This example shows the idempotency of the MaxMin semi-ring:

T:=Dom::MaxMinSemiRing:

T(infinity) + T(infinity);

T(3) + T(3)

math

math

T(6) + T(infinity);

T(6) + T(3);

T(6)*T(-infinity);

T(6)*T(3)

math

math

math

math

Example 2:

We can use real number and constants:

T(sin(2)) + T(-2.15)*T(PI)

math

Example 3:

We can change the domain of scalars:

T::convert_to(T(1), Dom::Integer) + T::convert_to(T(2), Dom::Integer)

math