This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Due: September 11, 2008 CS 257 (Luke Olson): Homework #2 Problem 1 [Range Reduction] We are developing code for a financial firm and are required to compute tan (10 n ) for various n as a component of our financial model. Use range reduction to show how to compute tan (10 n ) for small n ( n < 5). What happens for large n ( n = 20, 50, 100)? Hint: (Think of the role of the less significant digits in a number, when that number is multiplied by a large number). Hand in pseudocode or matlab code to compute tan (10 4 ) and discuss in a couple of sentences the problem of computing tan (10 20 ). Problem 2 [Loss of Significance] In implementing the previous problem, we notice the need to derive π to high accuracy. One approach is to use the method of Archimedes to approximate π with n-polygons. A formula for this is start with c = 1 / √ 3 and to use the recurrence mypi = 6 × 2 × c c i = q 1 + c 2 i- 1- 1 c i- 1 mypi i = 6 × 2 i × c i What happens to mypi in this case? Is there a fix? Hand in the result of using the above algorithm, a fix,in this case?...
View Full Document
This note was uploaded on 07/10/2011 for the course CS 257 taught by Professor Olson during the Spring '08 term at University of Illinois, Urbana Champaign.
- Spring '08