algebraixlib.mathobjects.atom module¶
An atomic math object that represents a value.
-
algebraixlib.mathobjects.atom.
auto_convert
(arg)[source]¶ Return always a
MathObject
. Ifarg
is not aMathObject
, make it anAtom
.This function is used in several constructors as convenience wrapper to allow the creation of
MathObject
instances from non-MathObject
values.
-
class
algebraixlib.mathobjects.atom.
Atom
(value, direct_load=False)[source]¶ Bases:
algebraixlib.mathobjects.mathobject.MathObject
An atomic math object. It represents a value (of a non-
MathObject
, hashable type).Note
Instances of
Atom
are considered immutable. Therefore they only accept immutable values. Since anAtom
also needs to be hashable, the value itself also needs to be hashable.Construct an instance with the given
value
.Parameters: value – The value of the Atom
. May not be an instance ofMathObject
other thanAtom
. (If it is of typeAtom
, thisAtom
is used.) Thevalue
must be immutable and hashable.-
static
__new__
(value, direct_load=False)[source]¶ If
value
is anAtom
, return thatAtom
, else return a newAtom
initialized withvalue
.
-
value
¶ Read-only; return the value of this instance.
-
get_ground_set
()[source]¶ Return the ground set of the lowest-level algebra of this
MathObject
. Is always \(A\).
-
get_str
()[source]¶ Return the instance’s string representation (the string representation of the value).
-
__eq__
(other)[source]¶ A value-based comparison for equality. Return
True
if types and values match. NOTE: Atom(1) != Atom(1.0)
-
static