# hw2 - Due CS 257(Luke Olson Homework#2 Problem 1[Range...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the 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.

### Page1 / 2

hw2 - Due CS 257(Luke Olson Homework#2 Problem 1[Range...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online