Skip to main content

A library for working with Multivariate Taylor Functions.

Project description

mtflib: Multivariate Taylor Function Library

Documentation Status License: MIT

A Python library for creating, manipulating, and composing Multivariate Taylor Functions (MTF/mtf), with a C++ backend for performance-critical applications.

Installation

The recommended way to install mtflib is from PyPI:

pip install mtflib

Installation from Source

Alternatively, you can install mtflib directly from the source repository using pip. Ensure you have a C++17 compliant compiler (e.g., GCC, Clang, MSVC) for building the backend extensions.

pip install .

Quick Start

Here's a simple example to get you started with mtflib:

import numpy as np
from mtflib import mtf
from IPython.display import display

# 1. Initialize global settings (optional but recommended for non-default values)
# If skipped, defaults to max_order=4, max_dimension=3.
mtf.initialize_mtf(max_order=5, max_dimension=2)

# 2. Define symbolic variables
# var(1) corresponds to x, var(2) to y
x = mtf.var(1)
y = mtf.var(2)

# 3. Create a Taylor series expression
# This creates a Taylor series for sin(x) + y^2
f = mtf.sin(x) + y**2

# 4. Evaluate the result at a point
# Let's evaluate f at (x=0.5, y=2.0)
eval_point = np.array([0.5, 2.0])
result = f.eval(eval_point)

print(f"\nf(x, y) = sin(x) + y^2")
print(f"Result of f(0.5, 2.0): {result[0]}")

# For comparison, the exact value is sin(0.5) + 2.0^2
exact_value = np.sin(0.5) + 4.0
print(f"Exact value: {exact_value}")

# You can also view the Taylor series coefficients
print("\nTaylor Series Representation:")
print(f)

print("Symbolic representation of the function:")
display(f.symprint())  # This will print the series in a human-readable format

output:

Initializing MTF globals with: _MAX_ORDER=5, _MAX_DIMENSION=2
Loading/Precomputing Taylor coefficients up to order 5
Global precomputed coefficients loading/generation complete.
Size of precomputed_coefficients dictionary in memory: 464 bytes, 0.45 KB, 0.00 MB
MTF globals initialized: _MAX_ORDER=5, _MAX_DIMENSION=2, _INITIALIZED=True
Max coefficient count (order=5, nvars=2): 21
Precomputed coefficients loaded and ready for use.

f(x, y) = sin(x) + y^2
Result of f(0.5, 2.0): 4.479427083333333
Exact value: 4.479425538604203

Taylor Series Representation:
          Coefficient  Order Exponents
0  1.000000000000e+00      1    (1, 0)
1  1.000000000000e+00      2    (0, 2)
2 -1.666666666667e-01      3    (3, 0)
3  8.333333333333e-03      5    (5, 0)

Symbolic representation of the function:

$\displaystyle 0.00833333 x^{5} - 0.166667 x^{3} + 1.0 x + 1.0 y^{2}$

JSON Serialization

mtflib supports serializing MTF objects to JSON format, preserving all coefficients and properties (including complex values).

# Serialize to JSON string
json_str = f.to_json()

# Deserialize back to object
f_loaded = mtf.from_json(json_str)

Running Tests

The project uses pytest for testing. First, install the test dependencies:

pip install -e .[test]

Then, run the test suite from the root of the repository:

pytest

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.

mtflib-1.5.2-cp312-cp312-win_amd64.whl (251.4 kB view details)

Uploaded CPython 3.12Windows x86-64

mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

mtflib-1.5.2-cp311-cp311-win_amd64.whl (248.9 kB view details)

Uploaded CPython 3.11Windows x86-64

mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mtflib-1.5.2-cp310-cp310-win_amd64.whl (247.2 kB view details)

Uploaded CPython 3.10Windows x86-64

mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

mtflib-1.5.2-cp39-cp39-win_amd64.whl (249.2 kB view details)

Uploaded CPython 3.9Windows x86-64

mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

mtflib-1.5.2-cp38-cp38-win_amd64.whl (246.5 kB view details)

Uploaded CPython 3.8Windows x86-64

mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file mtflib-1.5.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mtflib-1.5.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 251.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mtflib-1.5.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aedf2439889f8c3ab9da92c28fa12eb0b3f1a37c1e8268010821fe97e3b133b8
MD5 5478ac3d77eda08ce4d5e195fe79f56f
BLAKE2b-256 44965a1b6db6b4a373f4a9ff327a45652c9986215d9790cf49c0f785ec2022f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp312-cp312-win_amd64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a1182b938a58dbfba2c99614e2df2b1cef6bd6e24ee74567e43fd39b57c1b8ce
MD5 4eb5837045408339c647450baf1cad53
BLAKE2b-256 af156ecf1ac781c68af0683de37021b45fe0cd4935298a928f36df1d40ab5445

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58fbac683f829baaeb4b46bb286a1401d6c1e6f5a949b2aa51bf0afd50b12b76
MD5 3c486bd8c3b18ec2f885d52ec5d5b0e8
BLAKE2b-256 209c6970986c339a2d615394b1f867b1eea3f1652a7065bba50696ffaf9f025f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mtflib-1.5.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 248.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mtflib-1.5.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 860df8c5ff161230e321c0b3fd437877a377ffb0e6aa53a877d2933508caef13
MD5 0d408659e915a052bb99aec1a9494786
BLAKE2b-256 2a4d197dd37cb12969a959edd67ce37b05a4e8c7ad9923c38039e3b05c7c1c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp311-cp311-win_amd64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e31d3da49ac2f2886272c7d50d5630b01474306ed554024aa08bb51031b2da0
MD5 c719af3cfc2e5a2fe5eba3b9a707bedc
BLAKE2b-256 41f12f367f6749bddad2c49c22c032d9feb659f0dea3302b5511f9b8e65469de

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06e7b058e33a15d4291a276f45b92d9510c39083d53b545906667686f1502069
MD5 e29d1110199553b521d338342e076e36
BLAKE2b-256 b3b455a932a59e925a17a009d33c235e84141dde81f2886911a61f6e1fd03918

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mtflib-1.5.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 247.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mtflib-1.5.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3b3db96587bdf0174147a404d557c76b951427e9bcb40cb4e41dceacb1f7375a
MD5 e7f847aaa0850de0120b651c3921c8c0
BLAKE2b-256 220faff92da6cb4f4c668d3eb18670cb15b005f74e2a39142794e3a96794ef8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp310-cp310-win_amd64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3638db7c8e01e7338850c0fafc4ad7a6764435816400df1a49aa1f1b6db2b25b
MD5 1289a0ba957c1c837b7ac8dfdf7081f4
BLAKE2b-256 a8c259120544f77aac778175418da03127416d4034f5960ae6a62b37dd91a6f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc18c47d6f66c6624bc30616a9c705cfdf870012e681cefe5b18c30792d4aeb9
MD5 f9dfc251391c5182af7a6faf3165b680
BLAKE2b-256 7e1ca2bbb87a00e76da06c3556d81fbacaaa8a68a98c1cff89c9c66b8f513f5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mtflib-1.5.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 249.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mtflib-1.5.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9bf50aaccfcb200c6f4b85acdb12a2bf0381bd64d1f7ab7ea5d8e656bf752d69
MD5 a0d498271324fea05ac6e6bc25280de9
BLAKE2b-256 245794f3289bafaf74bd5681eada697837333852305014445762dcfcbcc7f4ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp39-cp39-win_amd64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 77717548e3b4a261d0d60e2660986ebbd4c155e6f2289e1d540884c6e466ec34
MD5 85e225d7a15ffe34ad71d4e428f5b81e
BLAKE2b-256 3bf5aff5c06fd2fe0ef842cf8881346c299c8b3104ed86854fad42411af74938

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1559a6b91593537549355b18b4b1c356cdfcf1a4f06bc442513f048d0746ec5
MD5 442017efe2a0a06fd9618a4fdb21880b
BLAKE2b-256 48ab30f69f6e5c99994b9b2cee025b2f69dcf5622ed28a985907878622b429fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mtflib-1.5.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 246.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mtflib-1.5.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 02f5b047dd1e898006a6f15d9ba6038c39d1c20a6ca0bb99dcecaf8d1e702a14
MD5 b180d0b78b100511741cb1712a62b731
BLAKE2b-256 797e17bffd45e8f512fc3d81dc1b4fa1dad75ccf91d74a2695ec7e512229062c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp38-cp38-win_amd64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c86aa579f8f49b10c954bc7c726aeee03856be2432fb0cf1e8518ac33d9d41ed
MD5 a40093025862e6d7054c4ac67fd14290
BLAKE2b-256 ee1b1352bf681d5b83148ff4a082a9e411607a8e6d66dd4361e16c1144f817a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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

File details

Details for the file mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 628596e56da49fb06df1a24800a5c7a37d6d1952014c4cf690ea445101101734
MD5 e7e2a599243b380f4030ecce020e6b8f
BLAKE2b-256 8b0ccdd07cf54a577eeb669c56227833b4f468179084a50ff15aee79bce23a61

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on shashi-manikonda/MTFLibrary

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