Legendre functions have an important property that is, they are orthogonal on the interval −1 ≤ x ≤ 1:
(where δmn denotes the Kronecker delta, equal to 1 if m = n and to 0 otherwise).
We can verify this result using Scilab.
To work with Legendre Polynomials we use the Scilab function legendre(n,m,x).
Which basically returns the value of the Associated Legendre Polynomial for a given value of m,n and x.
However, since I only wanted Legendre Polynomials so I’ll have to put m=0.
The following code returns the value of the integral, ∫Pm(x)*Pn(x)dx,
//Legendre Polynomials Orthogonality Verification clc; n=input("Enter n:"); m=input("Enter m:"); a=integrate('legendre(m,0,x)*legendre(n,0,x)','x',-1,1,0.001); mprintf('∫P%i(x)*P%f(x)dx= %g\n',m,n,a);
Ph.D. researcher at Friedrich-Schiller University Jena, Germany. I’m a physicist specializing in computational material science. I write efficient codes for simulating light-matter interactions at atomic scales. I like to develop Physics, DFT, and Machine Learning related apps and software from time to time. Can code in most of the popular languages. I like to share my knowledge in Physics and applications using this Blog and a YouTube channel.