All problems
Taylor Sine Series Value
Problem
The Maclaurin series of sin(x) is sum_{k>=0} (-1)^k x^(2k+1) / (2k+1)!.
Given x and the number of terms, return the partial sum.
Hint
Alternate signs and use odd factorials.
Test cases
case 1
in: [1,5]
expected: 0.8414710097001764
case 2
in: [0.5,3]
expected: 0.47942708333333334
case 3
in: [-2,8]
expected: -0.9092974264614476
Starter codePython
def taylor_sine_series_value(x, terms):
# Your code here
pass3 test cases · run your code against them in the editor