Question: Write a function to compute the sum of the series S1 given as: S1 = 1 - 1/2 + 1/3 - 1/4 + 1/5 -

 Write a function to compute the sum of the series S1

Write a function to compute the sum of the series S1 given as: S1 = 1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + 1/7 - 1/8 + 1/9 - 1/10 ....... plusminus 1/N where, N is an odd positive integer: for the last term take (+) if N is odd and (-) if N is even The function should have one input N and one output S1. Make use of for_loop and if_statement. Name your function as LastName_HW6_Part1. In the command window, test your function for N = 15 and N = 105. Copy and paste the command window results into your function as comments

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!