Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « scipy.special »

Fonction gegenbauer - module scipy.special

Signature de la fonction gegenbauer

def gegenbauer(n, alpha, monic=False) 

Description

help(scipy.special.gegenbauer)

Gegenbauer (ultraspherical) polynomial.

Defined to be the solution of

.. math::
    (1 - x^2)\frac{d^2}{dx^2}C_n^{(\alpha)}
      - (2\alpha + 1)x\frac{d}{dx}C_n^{(\alpha)}
      + n(n + 2\alpha)C_n^{(\alpha)} = 0

for :math:`\alpha > -1/2`; :math:`C_n^{(\alpha)}` is a polynomial
of degree :math:`n`.

Parameters
----------
n : int
    Degree of the polynomial.
alpha : float
    Parameter, must be greater than -0.5.
monic : bool, optional
    If `True`, scale the leading coefficient to be 1. Default is
    `False`.

Returns
-------
C : orthopoly1d
    Gegenbauer polynomial.

Notes
-----
The polynomials :math:`C_n^{(\alpha)}` are orthogonal over
:math:`[-1,1]` with weight function :math:`(1 - x^2)^{(\alpha -
1/2)}`.

Examples
--------
>>> import numpy as np
>>> from scipy import special
>>> import matplotlib.pyplot as plt

We can initialize a variable ``p`` as a Gegenbauer polynomial using the
`gegenbauer` function and evaluate at a point ``x = 1``.

>>> p = special.gegenbauer(3, 0.5, monic=False)
>>> p
poly1d([ 2.5,  0. , -1.5,  0. ])
>>> p(1)
1.0

To evaluate ``p`` at various points ``x`` in the interval ``(-3, 3)``,
simply pass an array ``x`` to ``p`` as follows:

>>> x = np.linspace(-3, 3, 400)
>>> y = p(x)

We can then visualize ``x, y`` using `matplotlib.pyplot`.

>>> fig, ax = plt.subplots()
>>> ax.plot(x, y)
>>> ax.set_title("Gegenbauer (ultraspherical) polynomial of degree 3")
>>> ax.set_xlabel("x")
>>> ax.set_ylabel("G_3(x)")
>>> plt.show()



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé