Skip to main content

Real/Complex analysis library for Python 3.

Project description

libcalculus: A comprehensive real and complex analysis library for Python

pipeline status

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
>>> f = libcalculus.csc @ (1 / libcalculus.identity)
>>> f(1 + 2j)
(1.0316491868272164+1.9336686363989997j)
>>> libcalculus.residue(f, 0, tol=1e-4)
(0.16666666639893526-8.181230860681676e-06j)

>>> print(f.latex("z"))
\csc\left( \frac{1}{z}\right)

>>> contour = libcalculus.line(2, 1 + 1j) # 2(1 - t) + (1 + 1i)t
>>> libcalculus.integrate(f, contour, 0, 1) # integrate along the contour between t=0 and t=1
(-2.0551412843830605+1.1351565349386723j)

>>> libcalculus.threads(4) # Enable threading
>>> arr = np.array([[1, 2j, 3], [4 + 1j, 5 + 2j, 7 + 3j]])
>>> print(f(arr))
[[ 1.18839511+0.j         -0.        +1.91903475j  3.05628425+0.j        ]
 [ 4.03942207+0.99000843j  5.02878731+1.98839211j  7.02013025+2.99133798j]]

License

Copyright (c) 2022, Ariel Terkeltoub All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

* Neither the name of the libcalculus developers nor the names of any
   contributors may be used to endorse or promote products derived
   from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

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

libcalculus-0.3.5.2.tar.gz (285.2 kB view details)

Uploaded Source

Built Distributions

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

libcalculus-0.3.5.2-cp38-cp38-manylinux2014_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.8

libcalculus-0.3.5.2-cp37-cp37m-win_amd64.whl (343.9 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

Details for the file libcalculus-0.3.5.2.tar.gz.

File metadata

  • Download URL: libcalculus-0.3.5.2.tar.gz
  • Upload date:
  • Size: 285.2 kB
  • Tags: Source
  • 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.3.5.2.tar.gz
Algorithm Hash digest
SHA256 4d0b797fa312c9ee1eac6fea15c2f6245b2bb7245e81f2cd3faa08826b7bcf4a
MD5 182ad113b0b0cf340e777ba984bafa72
BLAKE2b-256 99c79565810bde81a96f1598ce63550ff8c9efe1eacff21a91ac81210fe82813

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libcalculus-0.3.5.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.8 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.3.5.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5b1abe9e073dddc862efad6430420bf71e40e7a6d2245e1d9dd50498c07b7be
MD5 66a9683800bebf8b467fdf3f7a8750c4
BLAKE2b-256 5f5b45d659e93d785dc19761afbc676a267851e502b3e56d3907055a69f8a9af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libcalculus-0.3.5.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 343.9 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.3.5.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5f5c5b13dc4005f4742bd2c33856177f85236f0f4e09829e0740060011a4d773
MD5 64875dd0f087de3ee7c0601e3f4b6421
BLAKE2b-256 86c645b7f4e305ea03b6b3e2f26faa140b781cc693aac94d116fe497eceb5fc3

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