Skip to main content

1D boolean operations

Project description

Documentation Status Build Status Lint with Black Code Coverage

PyPI Version Python Versions License: MIT

Unibool

A python package for unidimensional boolean operations

Simple example

>>> from rbool import *
>>> interval = Interval(-10, 5)  # Create a closed interval
>>> interval
[-10, 5]
>>> interval | (3, 8)  # Unite with open interval
[-10, 8)
>>> ~interval  # Complementar of the interval
(-inf, 10) U (5, inf)
>>> interval |= {-2, 6, 10}  # Unite with single values
>>> interval
[-10, 5] U {6, 10}
>>> interval - {2, 3}  # Remove single values from interval
[-10, 2) U (2, 3) U (3, 5] U {6, 10}
>>> [-8, 3] in interval  # Checks if [-8, 3] is inside the interval
True

The usual operations happens between two subsets:

  • A | B: union
  • A & B: intersection
  • ~A: complementar
  • A ^ B: XOR
  • A - B: subtract
  • A in B: is subset ?

Useful functions

>>> minimum("[-3, 10]")  # Gets the minimum value from subset
-3
>>> minimum("(-3, 10]")  # Returns None, there's no minimum
>>> infimum("(-3, 10]")  # Gets the infimum value from subset
-3
>>> maximum("(-3, 10]")  # Gets the maximum value
10
>>> supremum("(-3, 10]")
10
>>> lower(5)  # All values on real line less than 5
(-inf, 5]
>>> {-15, 0} in lower(5)  # -15 and 0 are inside (-inf, 5] ?
True
>>> [-3, 6] in bigger(5)  # interval [-3, 6] is inside [5, inf) ?
False
>>> scale("[-3, 10) U {15}", 2)  # Maps each value 'x' to '2*x'
[-6, 20) U {30}
>>> move("[-3, 10) U {15}", -8)  # Maps each value 'x' to 'x - 8'
[-8, 2) U {7}

Installation:

This library is available in PyPI. To install it

$ pip install rbool

For more details, refer to the documentation

Documentation

The documentation can be found at rbool.readthedocs.io

Contribute

Please use the Issues or refer to the email compmecgit@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rbool-0.0.3.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rbool-0.0.3-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file rbool-0.0.3.tar.gz.

File metadata

  • Download URL: rbool-0.0.3.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rbool-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d5ac66f9e4fb69622e9a0bd4fccf19d000c1eb49207ef87ce0bbd2906207f114
MD5 ec3fea374494e313aadb2a116860922f
BLAKE2b-256 dfb0812ac466a7e3ec2a12e075ab1ec0adc1b925f2e2dac22a200c8849b25c84

See more details on using hashes here.

Provenance

The following attestation bundles were made for rbool-0.0.3.tar.gz:

Publisher: publish.yaml on compmec/rbool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rbool-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: rbool-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rbool-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e3708537528d2df69d5a3f6c3b7752d6842cf6a3fe8a901fb60371ceca13da43
MD5 48c4d337ee6a4d4261930a61d229d9da
BLAKE2b-256 fa6cd36bf453fcc1b7c332cc97e6269b15f276b8bb1de408b5a93c99cf767bb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rbool-0.0.3-py3-none-any.whl:

Publisher: publish.yaml on compmec/rbool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page