What is the correct way to obtain (-1)^n?

前端 未结 7 1664
清歌不尽
清歌不尽 2021-01-31 07:19

Many algorithms require to compute (-1)^n (both integer), usually as a factor in a series. That is, a factor that is -1 for odd n and 1 fo

7条回答
  •  不要未来只要你来
    2021-01-31 08:14

    Many algorithms require to compute (-1)^n (both integer), usually as a factor in a series. That is, a factor that is -1 for odd n and 1 for even n.

    Consider evaluating the series as a function of -x instead.

提交回复
热议问题