Why are some coefficients negative when expanding a function in Legendre?

1 reply · 2K views · last reply
chenaiyy
Messages
1
Reaction score
0
I get a series of Legendre expansion coefficients for a function. Then I compute the value of the function via expansion coefficients. As I want to whether the code is right or not, finally I expand the function in Legendre again. the result is almost same as before, but some coefficients is negative which are not exist before. I want to know why ?
The code are all fortran.
Thanks a lot!