A Python module to compute multidimensional arrays of evaluated functions based on Numpy.
Specifically, the module evaluates basis functions on intervals by employing a recursive formula of type
<p align="center">
<img src="https://latex.codecogs.com/gif.latex?f_{n+1}(x)&space;=&space;g(f_n(x),&space;\dots,&space;f_0(x),x)." title="f_{n+1}(x) = g(f_n(x), \dots, f_0(x),x)." />
</p>
This is generalized to the multi-dimensional case by using a tensor product
<p align="center">
<img src="https://latex.codecogs.com/gif.latex?(x,y)&space;\mapsto&space;f_i(x)f_j(y)" />
</p>
repeatedly on coordinate wise one-dimensional function bases. The code is vectorized over the evalution points
<img src="https://latex.codecogs.com/gif.latex?x_m&space;\in&space;\mathbb{R}^{num\_dim},&space;m&space;\in&space;\{1,&space;\dots,&space;num\_samples\}" />
and returns a multi-dimensional array of shape `(num_samples, degree+1, ..., degree+1)`, where `degree`
is the cardinality of the one-dimensional bases omitting a constant function. Currently, the following functions are available:
| Name | Domain |
|-------|-----------|
| [`standard_poly`](https://en.wikipedia.org/wiki/Polynomial) | `[-Inf, Inf]`|
| [`legendre_poly`](https://en.wikipedia.org/wiki/Legendre_polynomials) | `[-1, 1]`|
| [`legendre_rational`](https://en.wikipedia.org/wiki/Legendre_rational_functions) | `[0, Inf]`|
| [`chebyshev_poly`](https://en.wikipedia.org/wiki/Chebyshev_polynomials#First_kind) | `[-1, 1]`|
Please make sure that your data lies in these domains, checks will be run if desired.
### Contents
[1. Installation](#installation)
[2. Simple Usage](#simple-usage)
## Installation
Requirements: `pip3 install numpy`
```bash
pip3 install pyfunctionbases
```
## Simple Usage
Now a simple example using standard polynomials is given. By exchanging the name parameter, you can try different functions.
```python
from pyfunctionbases import RecursiveExpansion
import numpy as np
# create some data to evaluate basis functions on<
num_samples = 1000
num_dim = 2
x = np.random.uniform(low=0.0, high=1.0, size=(num_samples, num_dim))
# create an expansion object where name can be any
# function name, that is in the table below
degree = 10
name = 'standard_poly'
expn = RecursiveExpansion(degree, recf=name)
# evaluate the function, result is of shape (num_samples, degree+1, degree+1)
f_ij = expn.execute(x, check=True)
# flatten the result if needed
f_k = f_ij.reshape(num_samples,(degree+1)**num_dim)
```
Metadata
Release files for pyfunctionbases 0.0.post68
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfunctionbases-0.0.post68.tar.gz | 6.9 kB | Without provenance | Details for pyfunctionbases-0.0.post68.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfunctionbases-0.0.post68-py2-none-any.whl | Python 2 | none | any | Details for pyfunctionbases-0.0.post68-py2-none-any.whl |
Total release size: 14.5 kB
Release files / pyfunctionbases-0.0.post68.tar.gz
| Download URL | pyfunctionbases-0.0.post68.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7de88219744cc4892b395500075009f60936299d1cde377b0189475391c15d7a
|
|
BLAKE2b-256 checksum How to use checksums |
381b227f7d7aa26d0d9a0f84cb1e6dff884fc756ee3c670c27a31f2b96bb8ee8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3
|
Release files / pyfunctionbases-0.0.post68-py2-none-any.whl
| Download URL | pyfunctionbases-0.0.post68-py2-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
113c7a0878da370e00b482978b6728090a36f55bed31eb52c3dc23883e35154f
|
|
BLAKE2b-256 checksum How to use checksums |
02faab10e338b1ce2653c9135a9316b6e42ab95dbaf47c8333d1ff807859e42d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3
|
Security for pyfunctionbases 0.0.post68
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.