Skip to main content

ChebTools

Chebyshev-basis expansions, and more broadly, orthogonal polynomial expansions, are commonly used as numerical approximations of continuous functions on closed domains. One of the most successful projects that makes use of the Chebyshev expansions is the chebfun library for MATLAB. Other similar libraries are pychebfun, chebpy, and Approxfun. Our library ChebTools fills a similar niche as that of chebfun -- working with Chebyshev expansions.

The primary motivation for the development of ChebTools is the need for a highly optimized and fast C++11 library for working with Chebyshev expansions. Particularly, in order to approximate numerical functions with well-behaved interpolation functions.

Automatic tests on github actions: build and run tests

Paper about ChebTools in JOSS: DOI

Example:

Try it in your browser: Binder

Suppose we wanted to calculate the roots and extrema of the 0-th Bessel function in [0, 30]. That results in a picture like this:

Roots and extrema of the 0-th Bessel function

For which the Python code would read

import scipy.special
import ChebTools
# Only keep the roots that are in [-1,1] in scaled coordinates
only_in_domain = True
# The 0-th Bessel function (for code concision)
def J0(x): return scipy.special.jn(0,x)
# Make a 200-th order expansion of the 0-th Bessel function in [0,30]
f = ChebTools.generate_Chebyshev_expansion(200, J0, 0, 30)
# Roots of the function
rts = f.real_roots(only_in_domain)
# Extrema of the function (roots of the derivative, where dy/dx =0)
extrema = f.deriv(1).real_roots(only_in_domain)

Changelog

  • 1.1: Added integrate function for indefinite integral
  • 1.2: Added some more operators, including division and unary negation
  • 1.3: Added is_monotonic function to ascertain whether the nodes are monotonically increasing or decreasing
  • 1.4: Added dyadic splitting into intervals (C++ only for now)
  • 1.5: Added FFT-based function for getting expansion coefficient values from nodal values
  • 1.7: Added ChebyshevCollection container class for fast evaluation of collection of expansions (generated from dyadic splitting maybe?)
  • 1.8: Added __version__ attribute
  • 1.9: Added the ability to construct inverse functions
  • 1.10: Added 2D evaluation functions in double and complex<double> options (useful for model optimization with complex step derivatives)
  • 1.10.1: Repaired universal2 binary wheels on Mac
  • 1.11: Exposed get_coef function for Taylor series extrapolator
  • 1.12.0: Switched interface for python to nanobind. Dropped pypy wheels.

License

*MIT licensed (see LICENSE for specifics), not subject to copyright in the USA.

Uses unmodified Eigen for matrix operations

Contributing/Getting Help

If you would like to contribute to ChebTools or report a problem, please open a pull request or submit an issue. Especially welcome would be additional tests.

Installation

Prerequisites

You will need:

  • cmake (on windows, install from cmake, on linux sudo apt install cmake should do it, on OSX, brew install cmake)
  • Python (the anaconda distribution is used by the authors)
  • a compiler (on windows, Visual Studio 2015+ (express version is fine), g++ on linux/OSX)

If on linux you use Anaconda and end up with an error like

ImportError: /home/theuser/anaconda3/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/theuser/anaconda3/lib/python3.5/site-packages/ChebTools.cpython-35m-x86_64-linux-gnu.so)

it can be sometimes fixed by installing libgcc with conda: conda install libgcc. This is due to an issue in Anaconda

To install in one line from github (easiest)

This will download the sources into a temporary directory and build and install the python extension so long as you have the necessary prerequisites:

pip install git+git://github.com/usnistgov/ChebTools.git

From a cloned repository

Alternatively, you can clone (recursively!) and run the setup.py script

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools
cd ChebTools
python setup.py install

to install, or

python setup.py develop

to use a locally-compiled version for testing. If you want to build a debug version, you can do so with

python setup.py build -g develop

With a debug build, you can step into the debugger to debug the C++ code, for instance.

Cmake build

Starting in the root of the repo (a debug build with the default compiler, here on linux):

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools
cd ChebTools
mkdir build
cd build
cmake ..
cmake --build .

For those using Anaconda on Linux, please use the following for cmake:

mkdir build
cd build
cmake .. -DPYTHON_EXECUTABLE=`which python`
cmake --build .

For Visual Studio 2015 (64-bit) in release mode, you would do:

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools
cd ChebTools
mkdir build
cd build
cmake .. -G "Visual Studio 14 2015 Win64"
cmake --build . --config Release

If you need to update your submodules (pybind11 and friends)

git submodule update --init

For other options, see the cmake docs.

Metadata

Release files for chebtools 1.13.0

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

Source distribution (sdist)

Source distribution for chebtools 1.13.0
File Size Uploaded
chebtools-1.13.0.tar.gz 6.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for chebtools 1.13.0
File
chebtools-1.13.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
chebtools-1.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details
chebtools-1.13.0-cp312-abi3-macosx_10_15_universal2.whl CPython 3.12 abi3 macOS 10.15+ universal2 (ARM64, x86-64) Details
chebtools-1.13.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
chebtools-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
chebtools-1.13.0-cp311-cp311-macosx_10_15_universal2.whl CPython 3.11 CPython 3.11 macOS 10.15+ universal2 (ARM64, x86-64) Details
chebtools-1.13.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
chebtools-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
chebtools-1.13.0-cp310-cp310-macosx_10_15_universal2.whl CPython 3.10 CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64) Details
chebtools-1.13.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
chebtools-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
chebtools-1.13.0-cp39-cp39-macosx_10_15_universal2.whl CPython 3.9 CPython 3.9 macOS 10.15+ universal2 (ARM64, x86-64) Details

Total release size: 8.7 MB

Release files / chebtools-1.13.0.tar.gz

Download URL chebtools-1.13.0.tar.gz
Size 6.1 MB
Tags Source
SHA-256 checksum
How to use checksums
8b57b2e5a463e89e182123eb3977f2a8ddb5564ba162c28d5da342ccd67a3b37
BLAKE2b-256 checksum
How to use checksums
04872146b4be6f84b860d349221270327b1093a9bab1cf71986e2d836dc729e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp312-abi3-win_amd64.whl

Download URL chebtools-1.13.0-cp312-abi3-win_amd64.whl
Size 168.6 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
930a98e4e0ad3ea67bc17bb22a56d103072c7fcbeffe699fa7958fa6b61d28b6
BLAKE2b-256 checksum
How to use checksums
3cdc0f712b491a1fc683ca63f8d3898d99f1433dc49d85d97636ad23d539a96e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chebtools-1.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 183.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2288cf485849bc97e88461c7eecf63b4f046c253e7786fa9573dce7df6dbb7da
BLAKE2b-256 checksum
How to use checksums
74534dd1ec74a731086305098d5775a92c5fb351883ca7b0aea47a5d852bc205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp312-abi3-macosx_10_15_universal2.whl

Download URL chebtools-1.13.0-cp312-abi3-macosx_10_15_universal2.whl
Size 293.1 kB
Tags CPython 3.12 abi3 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
a70686105500860c677fee551713ab11cbf131133e89d885c6c58f286ed96d5c
BLAKE2b-256 checksum
How to use checksums
552a25177f873e175495c79f2657d1cbd9c2fa15f945af94f1b036c1cde30f26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp311-cp311-win_amd64.whl

Download URL chebtools-1.13.0-cp311-cp311-win_amd64.whl
Size 169.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bd1d2729f1d970952a5012cb5dfe28f68e3977245fd11e03632182cbbd085efa
BLAKE2b-256 checksum
How to use checksums
ec8782da323a23b0570f7e8f072061f14fafae087a4052ba8f6622cd94087d59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chebtools-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 184.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ee2685ca0984195e62a2a3486f4f906306ba4e529162e3dba7057eeec76506b0
BLAKE2b-256 checksum
How to use checksums
5bd4148ced534e74d45a50c30fd11da838314d9deade878a2564816c32f21aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp311-cp311-macosx_10_15_universal2.whl

Download URL chebtools-1.13.0-cp311-cp311-macosx_10_15_universal2.whl
Size 294.4 kB
Tags CPython 3.11 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
9f56232e52b78ec8674ca6f8ad7fe2bd33f588fbd2e220a8f4e10175f9a0b4d9
BLAKE2b-256 checksum
How to use checksums
789e0cc8b6d613815186a651bb2e9928450a1ea6b210c8417ac4d34ef0688f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp310-cp310-win_amd64.whl

Download URL chebtools-1.13.0-cp310-cp310-win_amd64.whl
Size 169.3 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
d3b5438fa60650d82b7784f5c313c2f856db4fbe8cf837712d7bfa6e2192c126
BLAKE2b-256 checksum
How to use checksums
aae376983b17d49e5c113e9aed26360a1914f36fe15d491246380caf03f5f5e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chebtools-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 184.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fdf2f8a5398e5c2404095647cd1113e15efa75a8753ea4681c0c0fc987baf58d
BLAKE2b-256 checksum
How to use checksums
b3c8d1276c0b9065c0dcfcbffc28a1d4bf53102a3c3f61939dabb011ace8d119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp310-cp310-macosx_10_15_universal2.whl

Download URL chebtools-1.13.0-cp310-cp310-macosx_10_15_universal2.whl
Size 294.8 kB
Tags CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
fd43d97722a851155521e3ee5c091dea3f723ca5e4d919d2abba96a36cdc029a
BLAKE2b-256 checksum
How to use checksums
229f3270c3b477645b286e0dcefa4b82f1ec574bdf917b2c82ed158a3f305bc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp39-cp39-win_amd64.whl

Download URL chebtools-1.13.0-cp39-cp39-win_amd64.whl
Size 169.7 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
ad5f421dcbc91ec16a6e0685c346ec923c9c779609686812b40b36798dbee93f
BLAKE2b-256 checksum
How to use checksums
2bd5baddafbddd901840265cb207ebcc57d0decdb9fb7959722475f465944e18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chebtools-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 184.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a4c7af313f7266889d75c7a115262b3683422583bfb8ceba06c1623abd9941a4
BLAKE2b-256 checksum
How to use checksums
9c2adde2a259846fac3ed294be203e71bf1d775f8cad8e3114781cd58af4a425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / chebtools-1.13.0-cp39-cp39-macosx_10_15_universal2.whl

Download URL chebtools-1.13.0-cp39-cp39-macosx_10_15_universal2.whl
Size 295.2 kB
Tags CPython 3.9 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
156a0c837cf655713cb1fdf9588ccab11161b3ef9dad0a008e85492449c88070
BLAKE2b-256 checksum
How to use checksums
b2d8520e17e8bc9ce5c5db5bc1cf5fb5a62186e03e95d17b3f7c5281fb5972fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

1.13.0 This release

13 release files

1.11

17 release files

1.9.0

10 release files

1.0.0

2 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