Answer
Pseudocode:
SUBROUTINE Sincomp(n,x) i =1
true = SIN(x)
approx = 0
factor = 1 DO
IF i > n EXIT
approx = approx + (-1)i-1•x2•i-1 / factor
error = Abs(true - approx) / true) * 100 PRINT i, true, approx, error
i=i+ 1
factor = factor•(2•i-2)•(2•i-1)
END DO END
Work Step by Step
Pseudocode:
SUBROUTINE Sincomp(n,x) i =1
true = SIN(x)
approx = 0
factor = 1 DO
IF i > n EXIT
approx = approx + (-1)i-1•x2•i-1 / factor
error = Abs(true - approx) / true) * 100 PRINT i, true, approx, error
i=i+ 1
factor = factor•(2•i-2)•(2•i-1)
END DO END