Convert appendix D to legendre basis