Example of first few Legendre Polynomials
Draws a graph.
#include <cmath>
{
TCanvas *Canvas =
new TCanvas(
"DistCanvas",
"Legendre polynomials example", 10, 10, 750, 600);
for(int nu = 0; nu <= 4; nu++)
{
L[nu]=
new TF1(
"L_0",
"ROOT::Math::legendre([0],x)", -1, 1);
}
leg->
AddEntry(L[0]->DrawCopy(),
" L_{0}(x)",
"l");
leg->
AddEntry(L[1]->DrawCopy(
"same"),
" L_{1}(x)",
"l");
leg->
AddEntry(L[2]->DrawCopy(
"same"),
" L_{2}(x)",
"l");
leg->
AddEntry(L[3]->DrawCopy(
"same"),
" L_{3}(x)",
"l");
leg->
AddEntry(L[4]->DrawCopy(
"same"),
" L_{4}(x)",
"l");
}
- Author
- Lorenzo Moneta
Definition in file Legendre.C.