Adding sine
No. 123
Implementing sin(x).
Q: |
We may implement sin(x) in a similar fashion to Equation 1, “Power series definition of f(x)=ex”: Equation 2. Power series definition of
f(x)=sin(x)
sin(x)=x-x33!+x55!-x77!+...=∑∞k=0(-1)kx2k+1(2k+1)!
Extend Figure 291, “An implementation sketch for the exponential” by adding a
second method Test your implementation by calculating the known values
sin(π2),
sin(π) and
sin(4π) using |
A: |