\[\newcommand{\vect}[1]{\vec{\boldsymbol{#1}}}
\newcommand{\uvect}[1]{\hat{\boldsymbol{#1}}}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\Abs}[1]{\left\lvert#1\right\rvert}
\newcommand{\norm}[1]{\lVert#1\rVert}
\newcommand{\I}{\mathrm{i}}
\newcommand{\ket}[1]{\left|#1\right\rangle}
\newcommand{\bra}[1]{\left\langle#1\right|}
\newcommand{\braket}[1]{\langle#1\rangle}
\newcommand{\Braket}[1]{\left\langle#1\right\rangle}
\newcommand{\op}[1]{\hat{#1}}
\newcommand{\mat}[1]{\underline{\boldsymbol{#1}}}
\providecommand{\d}{\mathrm{d}}
\renewcommand{\d}{\mathrm{d}}
\newcommand{\D}[1]{\mathcal{D}[#1]\;}
\newcommand{\pdiff}[3][]{\frac{\partial^{#1}#2}{\partial{#3}^{#1}}}
\newcommand{\diff}[3][]{\frac{\d^{#1} #2}{\d{#3}^{#1}}}
\newcommand{\ddiff}[3][]{\frac{\delta^{#1} #2}{\delta{#3}^{#1}}}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\erf}{erf}
\DeclareMathOperator{\erfi}{erfi}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\sinc}{sinc}
\DeclareMathOperator{\sn}{sn}
\DeclareMathOperator{\cn}{cn}
\DeclareMathOperator{\dn}{dn}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\order}{O}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\span}{span}
\newcommand{\mylabel}[1]{\label{#1}\tag{#1}}
\newcommand{\degree}{\circ}
% These replace SIunitx. They should not be defined in LaTeX.
\newcommand{\SI}[2]{#1\;\mathrm{#2}}
\newcommand{\si}[1]{\mathrm{#1}}
\let\qty\SI
\let\unit\si
\newcommand{\squared}{{^{2}}}
\newcommand{\cubed}{{^{3}}}
\newcommand{\per}{/}
\newcommand{\tera}{T}
\newcommand{\giga}{G}
\newcommand{\mega}{M}
\newcommand{\kilo}{k}
\newcommand{\milli}{m}
\newcommand{\micro}{μ}
\newcommand{\nano}{n}
\newcommand{\kilogram}{\text{kg}\,}
\newcommand{\meter}{\text{m}\,}
\newcommand{\second}{\text{s}\,}
\newcommand{\ampere}{\text{A}\,}
\newcommand{\kelvin}{\text{K}\,}
\newcommand{\mol}{\text{mol}\,}
\newcommand{\candela}{\text{cd}\,}
\newcommand{\newton}{\text{N}\,}
\newcommand{\hertz}{\text{Hz}\,}
\newcommand{\pascal}{\text{Pa}\,}
\newcommand{\volt}{\text{V}\,}
\newcommand{\watt}{\text{W}\,}
\newcommand{\joule}{\text{J}\,}
\newcommand{\henry}{\text{H}\,}
\newcommand{\farad}{\text{F}\,}
\newcommand{\coulomb}{\text{C}\,}
\newcommand{\ohm}{\Omega\,}
\newcommand{\weber}{\text{Wb}\,}
\newcommand{\tesla}{\text{T}\,}
\newcommand{\degree}{\text{deg}\,}
\]
Back to top
gpe.chebyshev
Chebyshev methods.
Module Contents
_EPS [source]
sinnx_sinx ( x , n , d = 0 ) [source]
Return the dth derivative of sin(n*x)/sin(x).
class Base ( ** kw ) [source]
Simple base class.
Allows class variables to be assigned in the constructor and then delegates to
init() for initialization. See {class}`gpe.utils.ExperimentBase` for a more
comprehensive example.
_initializing = True [source]
__setattr__ ( key , value ) [source]
init ( ) [source]
Perform any initializations here.
__repr__ ( ) [source]
Return a rudimentary representation for debugging.
class Chebyshev ( ** kw ) [source]
Bases: Base
Chebyshev pseudo-spectral basis of order N.
This is an orthonormal basis for functions on [-1, 1]:
\[\braket{f, g} = \int_{-1}^{1} \frac{f^*(x)g(x)}{\sqrt{1-x^2}}\d{x}\]
Parameters:
N (int ) – Order of the basis. The quadrature rule is exact for polynomials of order 2N-1
(i.e. containing 2N terms \(1, x, x^2, ..., x^{2N-1}\) ). This means that there are
N interior abscissa or N+1 abscissa including the endpoints (interior = False ).
interior (bool ) – Type of collocation points. If True , then N interior abscissa will be used,
the roots of T_N(x) , also called the Chebyshev-Gauss quadature. If False ,
then N+1 abscissa will be used, including the endpoints (extreme + endpoints),
also called the Chebyshev-Gauss-Lobatto quadrature.
x (array_like ) – Abscissa and corresponding weights.
w (array_like ) – Abscissa and corresponding weights.
N = 32 [source]
interior = True [source]
xL = -1.0 [source]
xR = 1.0 [source]
init ( ) [source]
Perform any initializations here.
static W ( x ) [source]
Return the integration weight (metric).
static Tn ( x , n , d = 0 ) [source]
Return the dth derivative of the nth Chebyshev polynomial.
These are orthogonal, but not normalized.
Cn ( x , n ) [source]
Return the nth Cardinal function: zero on all abscissa except x_n.
get_a ( f ) [source]
Return the Chebyshev series using the DCT.
get_f ( a ) [source]
Evaluate the series at the abscissa using the DCT.
This is the inverse of get_a() .
diff ( f , d = 1 ) [source]
Return the dth derivative of f.
integrate ( f ) [source]
Return the integral of f.