Number¶
This module one type useful in Context values:
ImpreciseFloatfor representing imprecise float as intervals.ImpreciseIntegerfor representing imprecise int as intervals.
-
class
galactic.type.number.ImpreciseNumber(**kwargs)[source]¶ The
ImpreciseNumberclass ca be used to represent intervals.New in version 0.0.3.
-
classmethod
default_lower()[source]¶ Get the default lower limit for that class.
Returns: The default lower limit Return type: NNew in version 0.0.3.
-
classmethod
default_upper()[source]¶ Get the default upper limit for that class.
Returns: The default upper limit Return type: NNew in version 0.0.3.
-
classmethod
convert(value)[source]¶ Convert the value to the desired type.
Parameters: value – Value to be converted Returns: The default lower limit Return type: NNew in version 0.0.3.
-
__init__(**kwargs)[source]¶ Initialise an
ImpreciseNumber.Keyword Arguments: - lower (
N) – the lower limit of the interval - upper (
N) – the upper limit of the interval
New in version 0.0.2.
- lower (
-
lower¶ Get the lower limit.
Returns: the lower limit Return type: NNew in version 0.0.2.
-
upper¶ Get the upper limit.
Returns: the upper limit Return type: NNew in version 0.0.2.
-
isdisjoint(other: galactic.type.number.ImpreciseNumber[N]) → bool[source]¶ Return True if the imprecise number has no elements in common with the other. Imprecise numbers are disjoint if and only if their intersection is the empty imprecise number.
Parameters: other ( ImpreciseNumber[N]) – the other imprecise numberReturns: True if the imprecise number is disjoint from the other Return type: boolNew in version 0.0.2.
-
issubset(other: galactic.type.number.ImpreciseNumber[N]) → bool[source]¶ Test if the imprecise number is included (or equal) to the other.
Parameters: other ( ImpreciseNumber[N]) –Returns: True if this imprecise number is included or equal to the other Return type: boolNew in version 0.0.2.
-
issuperset(other: galactic.type.number.ImpreciseNumber[N]) → bool[source]¶ Test if the imprecise number includes (or is equal to) the other.
Parameters: other ( ImpreciseNumber[N]) –Returns: True if this imprecise number includes (or is equal to) the other Return type: boolNew in version 0.0.2.
-
union(*others) → galactic.type.number.ImpreciseNumber[N][source]¶ Compute the union between this imprecise number and the others.
Parameters: *others – Variable length argument list Returns: the union between this imprecise number and the others Return type: ImpreciseNumber[N]New in version 0.0.2.
-
intersection(*others) → galactic.type.number.ImpreciseNumber[N][source]¶ Compute the intersection between this imprecise number and the others.
Parameters: *others – Variable length argument list Returns: the intersection between this imprecise number and the others Return type: ImpreciseNumber[N]New in version 0.0.2.
-
classmethod
-
class
galactic.type.number.ImpreciseFloat(**kwargs)[source]¶ ImpreciseFloatinstances represents subset of the real line.New in version 0.0.2.
-
classmethod
convert(value)[source]¶ Convert the value to a float.
Parameters: value – The value to convert Returns: The value converted Return type: floatNew in version 0.0.3.
-
classmethod
-
class
galactic.type.number.ImpreciseInteger(**kwargs)[source]¶ ImpreciseIntegerinstances represents subset of the integer set.New in version 0.0.3.
-
classmethod
convert(value)[source]¶ Convert the value to an int.
Parameters: value – The value to convert Returns: The value converted Return type: intNew in version 0.0.3.
-
classmethod