{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

chw2 - and the relative error(abolute error divided by the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Math 128a, fall 2011, Chorin, computer homework 2 1. Write a computer program that truncates a number x after n digits, in a manner consistent with floating point representation, e.g., when n = 2, convert 1234 . 56 into 1200 . 00 and . 01234 into . 012. 2. Use the program from 1. to evaluate e x from its Taylor series around the origin, with n digit storage (i.e., truncate the outcome of each calculation after n digits), for x = . 1 , - 1 ., - 5 . with n = 2 , 3 , 4 , 5 , 6 for each value of x . In each case report the absolute error (the truth minus the result)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and the relative error (abolute error divided by the truth). Do not let the summation run for ever- stop it when adding more terms makes no difference. Observe the effects of round-off error. Warning: Calculating things like x n and n ! for large n is costly, and in many computing systems, liable to problems with overflow. If the term you add at the n-th step is a n , calculate a n +1 by multiplying a n by a suitable factor. 1...
View Full Document

{[ snackBarMessage ]}