legpolypow

Power of Legendre polynoamials.


Syntax
   f = legpolypow(p, n, order4trunc)

Description
   f = legpolypow(p, n) is a recursive application of chebypolyprod 
   funtion, computing sum(p_i*T_i)^n. i.e. If
   P(x) = p(1)*L_0(x) + ... + p(m+1)*L_m(x), 
   then the result will be the vector of coefficients y such that
   P(x)^n = f(1)*L_0(x) + ... + f(m+n+1)*L_{m+n+1}(x).

Inputs
   p = vector of coefficients in Legendre basis.
   n = power degree.

Output
   f = vector of coefficients in Legendre basis (P(x)^n).

Example
   legpolyprod(legpolyprod(legpolyprod( ...
   [1 2 3], [1 2 3]), [1 2 3]), [1 2 3]) - legpolypow([1 2 3], 4)
   The result must be zeros.