{ } Raw JSON

bundles / scipy 1.18.0 / scipy / special / _orthogonal / legendre

function

scipy.special._orthogonal:legendre

source: /scipy/special/_orthogonal.py:2631

Signature

def legendre(n, monic = False)

Summary

Legendre polynomial.

Extended Summary

Defined to be the solution of

is a polynomial of degree .

Parameters

n : int

Degree of the polynomial.

monic : bool, optional

If True, scale the leading coefficient to be 1. Default is False.

Returns

P : orthopoly1d

Legendre polynomial.

Notes

The polynomials are orthogonal over with weight function 1.

Examples

Generate the 3rd-order Legendre polynomial 1/2*(5x^3 + 0x^2 - 3x + 0):
from scipy.special import legendre
legendre(3)
✓
poly1d([ 2.5,  0. , -1.5,  0. ])

Aliases

  • scipy.special.legendre