Evaluate sin x Using Series Expansion :- Question:-
Write an algorithm and flowchart to evaluate sin x using series expansion.
Series Expansion का उपयोग करके sin x का मान ज्ञात करने के लिए Algorithm और Flowchart लिखिए।
Example:-
The series expansion of sin x is:
sin x = x − x³/3! + x⁵/5! − x⁷/7! + ...
Logic / Explanation:-
TERM = (−1)ⁱ × x²ⁱ⁺¹ / (2i + 1)! → Calculate each term of the series.
SUM = SUM + TERM → Add each term to the result.
Finally, display SUM as the value of sin x.
Solution:-
Algorithm: Evaluate sin x Using Series Expansion
Step 1: Start.
Step 2: Input the value of x and the number of terms N.
Step 3: Set SUM = 0.
Step 4: Set i = 0.
Step 5: Calculate:
TERM = (−1)ⁱ × x²ⁱ⁺¹ / (2i + 1)!
Step 6: Set SUM = SUM + TERM.
Step 7: Set i = i + 1.
Step 8: Repeat Steps 5 to 7 while i < N.
Step 9: Display SUM as sin x.
Step 10: Stop.