Skip to main content

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

Metadata

Release files for mtflib 1.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mtflib 1.5.2
File
mtflib-1.5.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details
mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
mtflib-1.5.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details
mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
mtflib-1.5.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
mtflib-1.5.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl CPython 3.9 CPython 3.9 Linux musl 1.2+ x86-64 Details
mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
mtflib-1.5.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl CPython 3.8 CPython 3.8 Linux musl 1.2+ x86-64 Details
mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details

Total release size: 41.7 MB

Release files / mtflib-1.5.2-cp312-cp312-win_amd64.whl

Download URL mtflib-1.5.2-cp312-cp312-win_amd64.whl
Size 251.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
aedf2439889f8c3ab9da92c28fa12eb0b3f1a37c1e8268010821fe97e3b133b8
BLAKE2b-256 checksum
How to use checksums
44965a1b6db6b4a373f4a9ff327a45652c9986215d9790cf49c0f785ec2022f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL mtflib-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl
Size 4.5 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
a1182b938a58dbfba2c99614e2df2b1cef6bd6e24ee74567e43fd39b57c1b8ce
BLAKE2b-256 checksum
How to use checksums
af156ecf1ac781c68af0683de37021b45fe0cd4935298a928f36df1d40ab5445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mtflib-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
58fbac683f829baaeb4b46bb286a1401d6c1e6f5a949b2aa51bf0afd50b12b76
BLAKE2b-256 checksum
How to use checksums
209c6970986c339a2d615394b1f867b1eea3f1652a7065bba50696ffaf9f025f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp311-cp311-win_amd64.whl

Download URL mtflib-1.5.2-cp311-cp311-win_amd64.whl
Size 248.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
860df8c5ff161230e321c0b3fd437877a377ffb0e6aa53a877d2933508caef13
BLAKE2b-256 checksum
How to use checksums
2a4d197dd37cb12969a959edd67ce37b05a4e8c7ad9923c38039e3b05c7c1c94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL mtflib-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl
Size 4.5 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
2e31d3da49ac2f2886272c7d50d5630b01474306ed554024aa08bb51031b2da0
BLAKE2b-256 checksum
How to use checksums
41f12f367f6749bddad2c49c22c032d9feb659f0dea3302b5511f9b8e65469de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mtflib-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.7 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
06e7b058e33a15d4291a276f45b92d9510c39083d53b545906667686f1502069
BLAKE2b-256 checksum
How to use checksums
b3b455a932a59e925a17a009d33c235e84141dde81f2886911a61f6e1fd03918
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp310-cp310-win_amd64.whl

Download URL mtflib-1.5.2-cp310-cp310-win_amd64.whl
Size 247.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
3b3db96587bdf0174147a404d557c76b951427e9bcb40cb4e41dceacb1f7375a
BLAKE2b-256 checksum
How to use checksums
220faff92da6cb4f4c668d3eb18670cb15b005f74e2a39142794e3a96794ef8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL mtflib-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl
Size 4.4 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
3638db7c8e01e7338850c0fafc4ad7a6764435816400df1a49aa1f1b6db2b25b
BLAKE2b-256 checksum
How to use checksums
a8c259120544f77aac778175418da03127416d4034f5960ae6a62b37dd91a6f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mtflib-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fc18c47d6f66c6624bc30616a9c705cfdf870012e681cefe5b18c30792d4aeb9
BLAKE2b-256 checksum
How to use checksums
7e1ca2bbb87a00e76da06c3556d81fbacaaa8a68a98c1cff89c9c66b8f513f5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp39-cp39-win_amd64.whl

Download URL mtflib-1.5.2-cp39-cp39-win_amd64.whl
Size 249.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
9bf50aaccfcb200c6f4b85acdb12a2bf0381bd64d1f7ab7ea5d8e656bf752d69
BLAKE2b-256 checksum
How to use checksums
245794f3289bafaf74bd5681eada697837333852305014445762dcfcbcc7f4ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl

Download URL mtflib-1.5.2-cp39-cp39-musllinux_1_2_x86_64.whl
Size 4.4 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
77717548e3b4a261d0d60e2660986ebbd4c155e6f2289e1d540884c6e466ec34
BLAKE2b-256 checksum
How to use checksums
3bf5aff5c06fd2fe0ef842cf8881346c299c8b3104ed86854fad42411af74938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mtflib-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f1559a6b91593537549355b18b4b1c356cdfcf1a4f06bc442513f048d0746ec5
BLAKE2b-256 checksum
How to use checksums
48ab30f69f6e5c99994b9b2cee025b2f69dcf5622ed28a985907878622b429fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp38-cp38-win_amd64.whl

Download URL mtflib-1.5.2-cp38-cp38-win_amd64.whl
Size 246.5 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
02f5b047dd1e898006a6f15d9ba6038c39d1c20a6ca0bb99dcecaf8d1e702a14
BLAKE2b-256 checksum
How to use checksums
797e17bffd45e8f512fc3d81dc1b4fa1dad75ccf91d74a2695ec7e512229062c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl

Download URL mtflib-1.5.2-cp38-cp38-musllinux_1_2_x86_64.whl
Size 4.4 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
c86aa579f8f49b10c954bc7c726aeee03856be2432fb0cf1e8518ac33d9d41ed
BLAKE2b-256 checksum
How to use checksums
ee1b1352bf681d5b83148ff4a082a9e411607a8e6d66dd4361e16c1144f817a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release files / mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mtflib-1.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
628596e56da49fb06df1a24800a5c7a37d6d1952014c4cf690ea445101101734
BLAKE2b-256 checksum
How to use checksums
8b0ccdd07cf54a577eeb669c56227833b4f468179084a50ff15aee79bce23a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.5.2 This release

15 release files

1.5.1

15 release files

1.5.0

15 release files

1.4.3

15 release files

1.4.2

20 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page