Skip to main content

Real/Complex analysis library for Python 3.

Project description

libcalculus: A comprehensive real and complex analysis library for Python

libcalculus is fully written in C++ and Cython for bindings to Python; all numeric calculations take place in C++ and take full advantage of SIMD vectorization and OpenMP threading wherever available.

Features

  • Functional programming approach to analysis in Python
  • Numeric integration and differentiation of real and complex functions
  • Full integration with NumPy: functions support array inputs
  • LaTeX support: every function object has a .latex() that produces its LaTeX markup

Technology

libcalculus is written in C++20 and bound to Python via Cython; operations between functions are performed using C++ lambdas, and all calculations happen at the C++ level, with Python only interfacing methods and results.

Installation

libcalculus can be installed from pip:

pip install libcalculus

Examples

Here is a snippet demonstrating some of the library's features:

>>> import libcalculus, numpy as np
>>> z = libcalculus.ComplexFunction.Identity() # Shorten syntax
>>> f = z ** 2 * (libcalculus.ComplexFunction.Sin() @ (3 / z)) # represents z^2 + sin(3/z)
>>> f(1 + 2j)
(1.9161297498044316+7.826928799856612j)
>>> libcalculus.residue(f, 0, tol=1e-4) # residue of f around z=0, with an error tolerance of 1e-4
(-4.499999999971643+1.3805827092608378e-05j)
>>> print(f.latex())
{z}^{2}\sin\left( \frac{3}{z}\right)
>>> contour = libcalculus.Contour.Cosh() + libcalculus.ComplexFunction.Exp() @ (1j * libcalculus.Contour.Identity()) # represents the contour cosh(t) + e^(i*t)
>>> libcalculus.integrate(f, contour, 1, 2) # integrate along the contour between t=1 and t=2
(8.225229199586169+4.308468258475392j)
>>> libcalculus.threads(4) # Enable threading when working with arrays
>>> arr = np.array([[1, 2j, 3], [4 + 1j, 5 + 2j, 7 + 3j]])
>>> f(arr)
array([[1.41120008e-01+0.j        , 1.04304611e-15+8.51711782j,
        7.57323886e+00+0.j        ],
       [1.09624856e+01+3.24567376j, 1.42295657e+01+6.29864507j,
        2.04585023e+01+9.22847707j]])

License

Copyright 2022 Ariel Terkeltoub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


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

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

libcalculus-0.2-cp38-cp38-manylinux_2_24_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

libcalculus-0.2-cp38-cp38-manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8

libcalculus-0.2-cp38-cp38-manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8

libcalculus-0.2-cp37-cp37m-win_amd64.whl (263.3 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

Details for the file libcalculus-0.2-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: libcalculus-0.2-cp38-cp38-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.46.1 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for libcalculus-0.2-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 010d58c5409587789cb4e50afa8f67432ab599fa461a4a8d8f388da54982cb17
MD5 d1179d0c63311ec77166a2782d8e4c31
BLAKE2b-256 4408704f6b8251ff18538ebd5e692cba849f13b977cc4ab9b2f50c1dc3426c4d

See more details on using hashes here.

File details

Details for the file libcalculus-0.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: libcalculus-0.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.46.1 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for libcalculus-0.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 969d6e8bce6f11609e2b346ea4c5c7c8eef0344faedd547c808d590a81417c8b
MD5 241356e74d54e80f65d7affbe1af6d77
BLAKE2b-256 741356707d16bcadbfe3e62e0f3f54a4db02ebf102cfa32c3d2e56a585c3a133

See more details on using hashes here.

File details

Details for the file libcalculus-0.2-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: libcalculus-0.2-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.46.1 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for libcalculus-0.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cff4e983172ff5016a144253844005d7386b9fcb10c1a51770fd040976183c8a
MD5 3af6de7e7b4e9557d85e81673e30c418
BLAKE2b-256 d3cebf574b4bfd66ad647751c11e85837a29f2d41d758dc0bf2ea0849e42790a

See more details on using hashes here.

File details

Details for the file libcalculus-0.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: libcalculus-0.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 263.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.59.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.4

File hashes

Hashes for libcalculus-0.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a8f13330ff0e12f033df8f751917995ee11cddabd1e619c4fa59ba690ac9af13
MD5 d323a2cfc1b3f031b05376f72834f049
BLAKE2b-256 37fefff8c7b8d2b9940a3ea4f5e0f92794c4c5121f75846a6e31464ad2ed65aa

See more details on using hashes here.

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