Algebra of Sets
Project description
How to have a set containing all real numbers from 1 to 10 not including 10?
How to add interval from 20 to 30 to the set?
How to make sure this set is a subset of set of positive numbers?
How to add scalar number to it?
How to get complement of the set?
>>> from set_algebra import Interval, Set
>>> s = Set('[1, 10)')
>>> 1 in s
True
>>> 10 in s
False
>>> s.add(Interval('[20, 30]'))
>>> 25 in s
True
>>> s <= Set('(0, inf)')
True
>>> s.add(100)
>>> s.notation
'[1, 10), [20, 30], {100}'
>>> (~s).notation
'(-inf, 1), [10, 20), (30, 100), (100, inf)'
Set-Algebra provides classes representing math concepts:
Infinity
Endpoint
Interval
Uncountable Infinite Set
Besides numbers, Set-Algebra supports all objects that can be compared to each other - strings, datetimes, etc.
Infinity() is greater than any of these objects except float(‘inf’) and float(‘nan’). NegativeInfinity included as well.
Set-Algebra fully supports Python3. Tested on python 2.7, 3.2 - 3.6.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for set_algebra-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3db4cc6f0dce1368a2509dfec4953e221a94ac50c78418a0d74a0e21d0729bc |
|
MD5 | fc1248e6a09349ab0529761ea9c70115 |
|
BLAKE2b-256 | eec78ce46a52a1941fa99ead1845c8e3ff3b95283c0a663aaf035313116f728b |
Close
Hashes for set_algebra-0.3.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b4a3461bd4de3685617df8bd95236e7785eff2764e0357006c4680de0ed89e3 |
|
MD5 | e0f38504e9d92159b94fb5d7baf16476 |
|
BLAKE2b-256 | c72ad154338f970294ee9aebde42e15180d21c0b3c8e296c49efa4778a5c477c |