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 Distribution
set-algebra-0.3.6.tar.gz
(26.0 kB
view details)
File details
Details for the file set-algebra-0.3.6.tar.gz
.
File metadata
- Download URL: set-algebra-0.3.6.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 306bba7f293f6c44e1e5a4282d83ede006323f3536f593af5ed2b0bb33a200f8 |
|
MD5 | a81392084338211d642845d1c90de67f |
|
BLAKE2b-256 | ad9656ee95ed3fb85f55b90d63081b72ccfd05228494916b06bdd7a33b0fbe13 |