Calculate the Legendre Polynomial expansion.