C Program To Evaluate sin(x) = x – (x^3)/3! + (x^5)/5! + (x^7)/7! + ..
Satish B
https://technotip.com/7978/c-program-to-evaluate-sin-x-series/
Write a C function to evaluate the series sin(x) = x – (x^3)/3! + (x^5)/5! + (x^7)/7! + .. up to 10 terms.
Analyze Above Problem Statement
- In above sine series, observe the first term, which is x. Which can be written as x^1/1!.
i.e., x = x^1/1!;
- Check the exponent and the number used to divide the value of x in each series. 1 followed by 3 which is followed by 5 and so on. If you observe closely they’re all odd numbers. Adding 2 to 1 gives you 3. Adding 2 to 3 gives you 5. Adding 2 to 5 gives you 7 and so on ..
So the sine series becomes:
sin(x) = (x^1)/1! – (x^3)/3! + (x^5)/5! – (x^7)/7! + (x^9)/9! – (x^11)/11! + (x^13)/13! – (x^15)/15! + (x^17)/17! – (x^19)/19!
Now we have all 10 terms in the sine series.
Now observe the sign. First term in the series is positive. Second term is negative. Third term is positive. Again the forth term is negative. So we can conclude that, first term starts with positive and then it’s an alternative between negative and positive.
Next we need to find factorial of each number which divides x in each series. i.e., 1, 3, 5, 7, 9, 11, 13, 15, 17, 19. (10 odd numbers)
C Programming Interview / Viva Q&A List https://technotip.com/6378/c-programming-interview-viva-qa-list/
C Programming: Beginner To Advance To Expert https://technotip.com/6086/c-programming-beginner-to-advance-to-expert/ ... https://www.youtube.com/watch?v=WF1UUdoZX5Q
31097242 Bytes