Does anyone know how could I plot the basis order functions for the following function (code below)?
An example of what I should expect is https://en.wikipedia.org/wiki/Lagrange_polynomial#/media/File:Lagrange_basis_functions.svg . Please note they use a different spatial grid, here xg
I am having difficulties deciding on how to plot each of the 7 basis functions.
NN = 7 ; a = 0.0; b = 1.0 ;
xg = Table[(i (b - a))/NN, {i, 0, NN}];
Lagrg[X_, x_] :=
Module[{j, k, n},
n = Length[X] - 1;
For[ k = 0, k <= n, k++,
L[n, k, x] = ( \!\(
\*UnderoverscriptBox[\(\[Product]\), \(j = 0\), \(k - 1\)]
\*FractionBox[\(x -
\*SubscriptBox[\(X\), \(j\)]\), \(
\*SubscriptBox[\(X\), \(k\)] -
\*SubscriptBox[\(X\), \(j\)]\)]\)) (\!\(
\*UnderoverscriptBox[\(\[Product]\), \(j = k + 1\), \(n\)]
\*FractionBox[\(x -
\*SubscriptBox[\(X\), \(j\)]\), \(
\*SubscriptBox[\(X\), \(k\)] -
\*SubscriptBox[\(X\), \(j\)]\)]\)); ];
Return[ L[n, k, x] ]; ];
For clarity, also find the picture 
Any ideas are welcomed. Thanks in advance.
