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.4.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.4-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rbool-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 bcd11ddc82371c9f5794576a035302fe88568b2bdec48dc5cc1007b586453a44
MD5 e528baa3c0e8249a5bada0ec7a0cb6be
BLAKE2b-256 a5a1304e7409a78ecf45783a9bf5582fef87bddfea8b3b92d05e09079ec1daca

See more details on using hashes here.

Provenance

The following attestation bundles were made for rbool-0.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: rbool-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 506bad6f1e75450286ad2fa68ce201bef577a1d960b2c115be7567c6f05151aa
MD5 c30d1262429d112ccb70462430c374fb
BLAKE2b-256 972746b1a4c4ac836f1ef93960f0eeee9bd797229cafd8b13278a6a65ed6c954

See more details on using hashes here.

Provenance

The following attestation bundles were made for rbool-0.0.4-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