Skip to main content

orthopoly

This is a package for using sets of orthogonal functions/polynomials. Currently, it includes the Chebyshev polynomials and the spherical harmonics. The package is MIT licensed. Use it however you like. Documentation is available here: https://wordsworthgroup.github.io/orthopoly

Installing/Using

To install the package, you can

> pip install orthopoly

or you can download/clone the repository, put the top directory in your sys.path, then import it.

chebyshev

The chebyshev module is pretty well developed. It includes many functions for evaluating the Chebyshev polynomials and their derivatives. The module also includes higher level functions for setting up the elements needed to solve boundary value problems (using the pseudospectral method), interpolate using a Chebyshev grid, and perform the spatial discretization of a PDE solver. Generally, these methods are very well suited to smooth problems.

For performing a discrete Chebyshev transform (generating a Chebyshev expansion from a set of points in 1D), the cheby_coef_setup function can be used. It allows one of the boundary conditions to be the value of the expansion's first derivative and returns a matrix allowing expansion coefficents to be computed by solving a linear system. When there are no derivatives, the transform can be computed (on the appropriate cheby_grid) with a discrete cosine transform (DCT). The cheby_dct function does this and cheby_dct_setup sets up the grid as well.

Information about the Chebyshev polynomials is widely available, but a few particularly helpful references are below. The Boyd book is especially good.

  • Boyd, John P. Chebyshev and Fourier spectral methods. Courier Corporation, 2001.
  • Fornberg, Bengt. A practical guide to pseudospectral methods. Vol. 1. Cambridge university press, 1998.
  • Canuto, Claudio, et al. Spectral methods. Springer-Verlag, Berlin, 2006.

spherical_harmonic

The spherical_harmonic module provides functions for evaluating the real, two-dimensional (surface), orthonormal, spherical harmonics. It contains functions for evaluating the associated Legendre polynomials and their first two derivatives via stable recursion relationships. From the associated Legendre polynomials, the spherical harmonics, their gradients, and their Laplacians can be evaluated. The module also contains some functions for creating grids on the sphere (regular, icosahedral, and Fibonacci) and for creating random spherical harmonic expansions with specific power density relationships (noise). The module does not have functions for performing spherical harmonic analysis (transforming from values on the sphere to expansion coefficients).

For some applications, fitting a spherical harmonic expansion to data in spherical coordinates is useful. A least squares fit can be computed with the pseudoinverse of a matrix full of spherical harmonic function evaluations (see sph_har_matrix and related functions). However, this should only be done when the number of points is much greater than the number of terms in the fitted expansion.

The books cited above have some good discussion of spherical harmonics. Other useful sources include:

  • Press, William H., et al. Numerical recipes 3rd edition: The art of scientific computing. Cambridge university press, 2007.
  • Dahlen, F., and Jeroen Tromp. Theoretical global seismology. Princeton university press, 1998.
  • Bosch, W. "On the computation of derivatives of Legendre functions." Physics and Chemistry of the Earth, Part A: Solid Earth and Geodesy 25.9-11 (2000): 655-659.

Release files for orthopoly 0.4

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

Source distribution (sdist)

Source distribution for orthopoly 0.4
File Size Uploaded
orthopoly-0.4.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orthopoly 0.4
File Interpreter ABI Platform
orthopoly-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 37.7 kB

Release files / orthopoly-0.4.tar.gz

Download URL orthopoly-0.4.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ebcc143a514a5aac3a15f06a21c553e7050201ad1facdf8ba0486c50af3d7455
BLAKE2b-256 checksum
How to use checksums
db5368c700d4ff3087ebb195dd855d03fc8c9a6df0fc305de885adab3eb69611
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

Release files / orthopoly-0.4-py3-none-any.whl

Download URL orthopoly-0.4-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ef854653dbe703b53fb055c4c770eda83972bef814907711ce9509fcd641701
BLAKE2b-256 checksum
How to use checksums
66f6fa95f5899fb92e8a4763c9c0e1fc37d129da67e98a5de62a542ad571aba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

Release history Release notifications | RSS feed

0.9.5

1 release file

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

This release

0.4 This release

2 release files

0.3

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