Numerical Methods for Engineers

Published by McGraw-Hill Science/Engineering/Math
ISBN 10: 0073401064
ISBN 13: 978-0-07340-106-5

Chapter 2 - Programming and Software - Problems - Page 47: 2.6

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
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.