Write an algorithm for Sine function computation.
Answers
Answered by
5
.
.
Answered by
3
An algorithm for Sine function computation:
sine series is:
sin(x)=(x/1!)-((x^3)/3!)+((x^5)/5!)-...........
- Based on the expression we require fatorial and powers of 1,3,5,7.....
- Also we should compute
(x^i)/i!=(x/1)*(x/2)*(x/3)*......
- And continue following loop:
fp:=1;
j:=0;
while j<i do
begin
j:=j+1;
fp:=fp*(x/j);
end
- In generalized form of each term is,
current ith term= [(x^2)/i(i-1)]* previous term.
Similar questions