<< Legendre Legendre legendre_norm >>

Orthogonal Polynomials >> Orthogonal Polynomials > Legendre > legendre_eval

legendre_eval

Evaluate Legendre polynomial

Calling Sequence

y=legendre_eval(x,n)

Parameters

x :

a matrix of doubles, in the interval [-1,1].

n :

a 1-by-1 matrix of doubles, integer value, n>=0.

y :

a matrix of doubles, the function value

Description

Evaluates a Legendre polynomial of degree n at point x.

The first Legendre polynomials are

The remaining Legendre polynomials satisfy the recurrence:

for n=1,2,....

Examples

x=linspace(-1,1,100);
y0=legendre_eval(x,0);
y1=legendre_eval(x,1);
y2=legendre_eval(x,2);
y3=legendre_eval(x,3);
h=scf();
plot(x,y0,"r-")
plot(x,y1,"g-")
plot(x,y2,"b-")
plot(x,y3,"c:")
xtitle("Legendre Polynomials","x","Pn(x)")
legend(["n=0","n=1","n=2","n=3"]);
h.children.data_bounds(1:2,2)=[-1.05;1.05];
h.children.children(4).children.thickness=3;
h.children.children(5).children.thickness=2;
h.children.children(5).children.line_style=5;

Authors


Report an issue
<< Legendre Legendre legendre_norm >>