Genius Manual | ||
---|---|---|
<<< Previous | Next >>> |
Genius has some basic set theoretic functionality built in. Currently a set is just a vector (or a matrix). Every distinct object is treated as a different element.
Just like vectors, objects
in sets can include numbers, strings, null
, matrices and vectors. It is
planned in the future to have a dedicated type for sets, rather than using vectors.
Note that floating point numbers are distinct from integers, even if they appear the same.
That is, Genius will treat 0
and 0.0
as two distinct elements. The null
is treated as an empty set.
To build a set out of a vector, use the MakeSet function. Currently, it will just return a new vector where every element is unique.
genius> MakeSet([1,2,2,3]) = [1, 2, 3] |
Similarly there are functions Union, Intersection, SetMinus, which are rather self explanatory. For example:
genius> Union([1,2,3], [1,2,4]) = [1, 2, 4, 3] |
For testing membership, there are functions IsIn and IsSubset, which return a boolean value. For example:
genius> IsIn (1, [0,1,2]) = true |
<<< Previous | Home | Next >>> |
Polynomials in GEL | List of GEL functions |