I am trying to understand the nodal and modal basis formulation from the book of Hesthaven (Nodal Discontinuous Galerkin Methods, Hesthaven, Jan S., Warburton, Tim). For $N=2$, I get the Vandermonde Matrix, which is computed by the Jacobi polynomial for $\alpha, \beta =0$ which is the Legendre polynomial:
V = Vandermonde1D(2, x)
V =
0.7071 -1.2247 1.5811
0.7071 0 -0.7906
0.7071 1.2247 1.5811
and x = (-1,0,1)
the LGL points.
In the book on page 48, it says that for $N=6$ the d) option on the table is for orthonormal basis with Legendre-Gauss-Lobatto points.
Now, if I run a code from here
[x,w,P]=lglnodes(2)
I get
x =
-1
0
1
which are the LGL points and
w =
0.3333
1.3333
0.3333
the weights. But then I get
P =
1.0000 -1.0000 1.0000
1.0000 -0.0000 -0.5000
1.0000 1.0000 1.0000
In the comments for the program, it says
Computes the Legendre-Gauss-Lobatto nodes, weights, and the LGL Vandermonde matrix. The LGL nodes are the zeros of $(1-x^2)P'_N(x)$
But this is different than the Vandermonde I get from the original program of Hesthaven.
Now, I kinda understand what this $P$ Matrix is. If you have the Legendre Polynomials
$p_{0}(x) = 1, p_{1}(x) = x, p_{2}(x) = \frac{1}{2}(3x^{2} -1)$.
and replace the LGL points (-1,0,1)
I get this $P$ matrix.
But how to get the Vandermonde matrix?