Evaluate sinx as sum of series Assignment Help

Assignment Help: >> Algorithms for Problem Solving >> Evaluate sinx as sum of series

Evaluate 'sin x' as sum of series

 The formula for the 'sin x' is represented as

sin x= x-x3/3!+x5/5!-x7/7!+x9/9!- .................. (where x is in radians)

Algorithm:

Step 1: Take value of x in radians.

Step 2: Take the value of n where n is a number upto which we want to print the sum of series).

Step 3: For first term

                sum=x:

                p=1 (variable p is used for denominator)

                num=x (variable num is used for numerator)

                power=1

Step 4: For next term,

                 num=num* (-x2);

                 power=power+2;

                 p=p*(power-1)*power

                 next=num/p;

Step 5:  then sum=sum+next.

Step 6: Repeat the step 4 and step 5, looping 'n-1' times to get the sum of first 'n'  terms of the series.

Step 7: Print the value of sum.

Step 8: Stop.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd