Question: Write a program called sinseries . py to compute the following sum: s = x - x 3 3 ! + x 5 5 !

Write a program called
sinseries.py to compute the following sum:
s=x-x33!+x55!-x77!...+x2n-1(2n-1)!(-1)(n-1)
Where 0x6.28 is a real number. The value of n, which is to be determined by the program, must be the smallest positive integer that satisfies the inequality x2n-1(2n-1)!d where n1,d is a very small positive real number (less than 1). The values of x and d must be provided as inputs to the program. n! is the factorial of n.
The expected input/output behavior of the program is illustrated below for three example inputs:
Enter a real number x between 0 and 6.28, inclusive: 0.52
Enter a small positive real number d1 : 0.0001
s : 0.49688013020186006
Enter a real number x between and 6.28, inclusive: 1.57
Enter a small positive real number d1:0.001
s : 1.0000032058668369
Enter a real number x between 0 and 6.28, inclusive: 3.14
Enter a small positive real number d1:0.001
s : 0.0016136360330223744
Hint: Add the terms of the sum one at a time. Stop when the last added term is found to be less than or equal to d
 Write a program called sinseries.py to compute the following sum: s=x-x33!+x55!-x77!...+x2n-1(2n-1)!(-1)(n-1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!