Learn R Programming

InfDim (version 1.0)

p.function: A generic function to calculate Legendre polynomials

Description

The function calculates the value of j:th normalized Legendre polynomial at x. This function is a subfunction of IDM.

Usage

p.function(j, x)

Arguments

j
an integer giving the rank of the polynomial
x
numeric value between -1 and 1

References

Kirkpatrick M, Lofsvold D, Bulmer M (1990) Analysis of the inheritance, selection and evolution of growth trajectories. Genetics 124:979-993.

See Also

IDM, IDM.bootCI

Examples

Run this code
# The function is currently defined as
function(j,x){

temp1=1/(2^j)*sqrt((2*j+1)/2)
jj=floor(j/2)

temp2=0
for(i in 0:jj){
temp2b=(-1)^i*factorial(j)/(factorial(i)*factorial(j-i))*factorial(2*j-2*i)/(factorial(j)*factorial(2*j-2*i-j))*x^(j-2*i)
temp2=temp2+temp2b
  }
return(temp1*temp2)
  }

Run the code above in your browser using DataLab