Orthogonal polynomials

Copyright (C) 2020 Andreas Kloeckner

MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Mini-Introduction to sympy

Make a new Symbol and work with it:

Orthogonal polynomials

Now write a function inner_product(f, g):

Show that it works:

Next, define a basis consisting of a few monomials:

And run Gram-Schmidt on it:

These are called the Legendre polynomials.


What do they look like?


These functions are important enough to be included in scipy.special as eval_legendre:

What can we find out about the conditioning of the generalized Vandermonde matrix for Legendre polynomials?

The Chebyshev basis can similarly be defined by Gram-Schmidt, but now with respect to a different inner-product weight function, $$w(x) = 1/\sqrt{1-x^2}.$$

Chebyshev polynomials achieve similar good, but imperfect conditioning on a uniform grid (but perfect conditioning on a grid of Chebyshev nodes).