gpe.chebyshev
=============

.. py:module:: gpe.chebyshev

.. autoapi-nested-parse::

   Chebyshev methods.



Attributes
----------

.. autoapisummary::

   gpe.chebyshev._EPS


Classes
-------

.. autoapisummary::

   gpe.chebyshev.Base
   gpe.chebyshev.Chebyshev


Functions
---------

.. autoapisummary::

   gpe.chebyshev.sinnx_sinx


Module Contents
---------------

.. py:data:: _EPS

.. py:function:: sinnx_sinx(x, n, d=0)

   Return the dth derivative of sin(n*x)/sin(x).


.. py:class:: Base(**kw)

   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.


   .. py:attribute:: _initializing
      :value: True



   .. py:method:: __setattr__(key, value)


   .. py:method:: init()

      Perform any initializations here.



   .. py:method:: __repr__()

      Return a rudimentary representation for debugging.



.. py:class:: Chebyshev(**kw)

   Bases: :py:obj:`Base`


   Chebyshev pseudo-spectral basis of order N.

   This is an orthonormal basis for functions on [-1, 1]:

   .. math::
     \braket{f, g} = \int_{-1}^{1} \frac{f^*(x)g(x)}{\sqrt{1-x^2}}\d{x}

   :param N: 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`).
   :type N: int
   :param interior: 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.
   :type interior: bool
   :param x: Abscissa and corresponding weights.
   :type x: array_like
   :param w: Abscissa and corresponding weights.
   :type w: array_like


   .. py:attribute:: N
      :value: 32



   .. py:attribute:: interior
      :value: True



   .. py:attribute:: xL
      :value: -1.0



   .. py:attribute:: xR
      :value: 1.0



   .. py:method:: init()

      Perform any initializations here.



   .. py:method:: W(x)
      :staticmethod:


      Return the integration weight (metric).



   .. py:method:: Tn(x, n, d=0)
      :staticmethod:


      Return the dth derivative of the nth Chebyshev polynomial.

      These are orthogonal, but not normalized.



   .. py:method:: Cn(x, n)

      Return the nth Cardinal function: zero on all abscissa except x_n.



   .. py:method:: get_a(f)

      Return the Chebyshev series using the DCT.



   .. py:method:: get_f(a)

      Evaluate the series at the abscissa using the DCT.

      This is the inverse of `get_a()`.



   .. py:method:: diff(f, d=1)

      Return the dth derivative of f.



   .. py:method:: integrate(f)

      Return the integral of f.



