15 views

Uploaded by Rachit Madan

Notes on floating points by suban

- GRE Math 강좌 Set 1
- Nested Radicals and Other Infinitely Recursive Expressions
- Mth 104 Basic Mathematics for Nurses
- Volumes of Revolution
- Test 1 Fall 01 Solution
- IBPS Aptitude Clerk Paper
- Polymath Tutorial
- MATHEMATICAL MODEL OF REACTOR
- Ulam - Hyers Stability of a 2- Variable AC - Mixed Type Functional Equation: Direct and Fixed Point Methods
- Functions
- Solutions to Homework
- 12jan2sm
- Public Page372 374
- Numerical Analysis for Engineering
- Data Structure BCA Practical Exercises
- UT Dallas Syllabus for phys5416.501.07s taught by Xinchou Lou (xinchou)
- CD q Estions
- Eulers Method
- 6666_01_que_20130618
- Topic

You are on page 1of 7

November 6, 2012

x = (0.d1 d2 dn ) e

where 0.d1 d2 dn is a -fraction called the mantissa and e is an integer called the exponent. Such a oating point number is called normalised if d1 = 0, or else, d1 = d2 = = dn =. The exponent e is limited to a range m<e<M Usually, m = M .

1.1

There are two common ways of translating a given real number x in to an n -digit oating point number f l(x) - rounding and chopping. For example, if two decimal digit oating point numbers are used f l(2/3) = and f l(838) = (0.67) 100 rounded (0.66) 100 chopped (0.84) 103 rounded (0.83) 103 chopped

The conversion is undened if |x| M (overow) or 0 < |x| mn (underow), where m and M are the bounds on the exponent. The dierence between x and f l(x) is called the round-o error. If we write f l(x) = x(1 + ) 1

then it is possible to bound independently of x. It is not dicult to see that 1n | | < 1 in rounding 2 1 n < 0 in chopping The maximum possible value of | | is often called the unit roundo or machine epsilon and is denoted by u. It is the smallest machine number such that f l(1 + u) > 1

1.2

If denotes one of the arithmetic operations (addition, subtraction, multiplication or division) and represents the oating point version of the same operation, then, usually x y=x

y = f l (x

y ) = (x

y )(1 + )

1.3

Error analysis

n

2 2 x1 = x2 0 , x2 = x1 , . . . , xn = xn1

with f l(x0 ) = x0 . In oating point arithmetic, we compute: x 1 = x2 2 = x 2 n = x 2 0 (1 + 1 ), x 1 (1 + 2 ), . . . , x n1 (1 + n ) with |i | u, i. The computed answer is, therefore,

2 x n = x2 0 (1 + 1 )

n n1

2 (1 + n 1 )(1 + n )

Now, if |1 |, |2 |, . . . , |r | u, then there exist and with | |, | | u, such that (1 + 1 )(1 + 1 ) . . . (1 + r ) = (1 + )r = (1 + )r+1 2

Thus,

2 x n = x2 = f (x0 (1 + )) 0 (1 + )

for some with u. In other words, the computed value x n is the exact answer for a perturbed input x = x0 (1 + ). The above is an example of backward error analysis.

1.4

Loss of signicance

If x is an approximation to x, then the error in x is x x . The relative error in x , as an approximation to x is the number (x x )/x Every oating point operation in a computational process may give an error which, once generated, may then be amplied or reduced in subsequent computations. One of the most common (and often avoidable) ways of increasing the importance of an error is commonly called loss of signicant digits. x approximates x to r signicant -digits provided the absolute error |x x | 1 is at most 2 in the rth signicant -digit of x, i.e., 1 |x x | sr+1 2 with s the largest integer such that s |x|. For example, x = 3 agrees with x = to one signicant decimal digit, where as x = 22 7 = 3.1428 is correct to three signicant digits. Suppose we are to calculate z = x y and we have approximations x and y for x and y , respectively, each of which is good to r digits. Then, z = x y may not be good to r digits. For example, if x = (0.76545421) 101 y = (0.76544200) 101

are each correct to seven decimal digits, then their exact dierence z = x y = (0.12210000) 103 is good only to three digits as an approximation to x, since the fourth digit of z is derived from the eighth digits of x and y , both possibly in error. Hence, the relative error in z is possibly 10,000 times the relative error in x or y .

Such errors can be avoided by anticipating their occurrence. For example the calculation of f (x) = 1 cos x is prone to loss of signicant digits for x near 0, however, the alternate representation sin x2 f (x) = 1 + cos x can be evaluated quite accurately for small values of x and is, on the other hand, problematic near x = .

1.5

2

2.1

Problems

Discretization

1. Derive the trapezoidal rule for numerical integration which goes somewhat like: n1 b 1 f (x)dx h[f (xk ) + f (xk+1 )] 2 a

k=0

for discrete values of xk in interval [a, b]. Compute 0 sin(x)dx using trapezoidal rule (use h = 0.1 and h = 0.01) and compare with the exact result. 2. Consider the dierential equation y (x) = 2xy (x) 2x2 + 1, 0 x 1 y (0) = 1 (a) Show/verify that the exact solution is the function y (x) = ex + x. (b) If we approximate the derivative operation with a divided dierence y (xk ) = (yk+1 yk )/(xk+1 xk ) then show that solution can be approximated by the iteration yk+1 = yk + h(2xk yk 2x2 k + 1), k = 0, 1, . . . , n y0 = 1 where xk = kh, k = 0, 1, . . . , n and h = 1/n. 4

2

(c) Use h = 0.1 to solve the dierential equation numerically and compare (plot) your answers with the exact solution. 3. (a) Derive the Newtons iteration for computing 2 given by xk+1 = 1 2 [xk + (2/xk )], k = 0, 1, . . . x0 = 1 (b) Show the Newtons iteration takes O(log n) steps to obtain n decimal digits of accuracy. (c) Numerically compute 2 using Newtons iteration and verify the rate of convergence. 4. Which of the following are rounding errors and which are truncation errors (please check out the denitions from Wikipedia)? (a) Replace sin(x) by x (x3 /3!) + (x5 )/5! . . . (b) Use 3.1415926536 for . (c) Use the value x10 for 2, where xk is given by Newtons iteration above. (d) Divide 1.0 by 3.0 and call the result 0.3333.

2.2

1. Consider the dierential equation y (x) = (2/ )xy (y ), 0 x 10 y (0) = y0 (a) Show/verify that the exact solution to this equation is y (x) = y0 /[y0 + ( y0 )ex ] (b) Taking y0 = compute the solution for i. an 8 digit rounded approximation for ii. a 9 digit rounded approximation for What can you say about the results? 2. Solve the system 2x 4y = 1 2.998x + 6.001y = 2 5

2

using any method you know. Compare the solution with the solution to the system obtained by changing the last equation to 2.998x+6y = 2. Is this problem stable? 3. Examine the stability of the equation x3 102x2 + 201x 100 = 0 which has a solution x = 1. Change one of the coecients (say 201 to 200) and show that x = 1 is no longer even close to a solution.

2.3

Unstable methods

1. Consider the quadratic ax2 + bx + c = 0, a=0 Consider a = 1, b = 1000.01, c = 2.5245315. Suppose that b2 4ac is computed correctly to 8 digits, what is the number of digits of accuracy in x? What is the source of the error? 2. Show that the solution to the quadratic can be re-written as x = 2c/(b2 + b2 4ac)

Write a program to evaluate x for several values of a, b and c (with b large and positive and a, c of moderate size). Compare the results obtained with the usual formula and the formula above. 3. Consider the problem of determining the value of the integral

1 0

x20 ex1 dx

1

If we let Ik =

0

xk ex1 dx

Then, integration by parts gives us (please verify) Ik = 1 kIk1 1 I0 = 0 ex1 dx = 1 (1/e) Thus we can compute I20 by successively computing I1 , I2 , . . .. Compute the (k, Ik ) table with a program, plot, and see if it makes sense. What are the errors due to? 6

Compare the results with that obtained using the following recursion (which you can easily! derive by integrating by parts twice). Ik = (1/ ) [k (k 1)/ 2 ]Ik2 , k = 2, 4, 6, . . .

n

s = (1/n)

i=1

(xi x )2

n

s = (1/n)

i=1

x2 2 i x

(a) Discuss the instability of the second formula for the case where the xi are all very close to each other. (b) Observe that s should always be positive. Write a small program to evaluate the two formulas and nd values of x1 , . . . , x10 for which the second one gives negative results.

- GRE Math 강좌 Set 1Uploaded byHee_Eun_Jang_6656
- Nested Radicals and Other Infinitely Recursive ExpressionsUploaded byapi-26401608
- Mth 104 Basic Mathematics for NursesUploaded byelkanawy
- Volumes of RevolutionUploaded byRickavD
- Test 1 Fall 01 SolutionUploaded byGobara Dhan
- IBPS Aptitude Clerk PaperUploaded byGeorge Matthew
- Polymath TutorialUploaded byDurgesh Bagri
- MATHEMATICAL MODEL OF REACTORUploaded byjagannath881
- Ulam - Hyers Stability of a 2- Variable AC - Mixed Type Functional Equation: Direct and Fixed Point MethodsUploaded bySEP-Publisher
- FunctionsUploaded byJohnny Murray
- Solutions to HomeworkUploaded byPeter James Bedoña
- 12jan2smUploaded byAnti Tech play
- Public Page372 374Uploaded byvikas_ojha54706
- Numerical Analysis for EngineeringUploaded byjanamurali
- Data Structure BCA Practical ExercisesUploaded byIndumathy Kavandiran
- UT Dallas Syllabus for phys5416.501.07s taught by Xinchou Lou (xinchou)Uploaded byUT Dallas Provost's Technology Group
- CD q EstionsUploaded byanon_844363378
- Eulers MethodUploaded byMustijab Haider
- 6666_01_que_20130618Uploaded bytigerdentist
- TopicUploaded byNorrita Hamzah
- JMTS7Uploaded bysanjeev1000
- 10.1.1.149Uploaded byjamilvora
- Specialsums (en)Uploaded byShikhin Sethi
- 23 RearrangeUploaded byIulian Danciu
- Grade7-318240-10-2299Uploaded byAnimesh
- Cubics PlineUploaded by140557
- Egg LabUploaded byThM4
- Adding and Subtracting IntegersUploaded byKenny Toth
- Wave Evolution on Electrified Falling FilmsUploaded byphaneufdl
- Lecture 8 Solving ODEUploaded byAravind Kumar

- MIT6_436JF08_lec05Uploaded byRachit Madan
- Problems on Statistical PhysicsUploaded byRachit Madan
- Tutorial 4Uploaded byRachit Madan
- FourierUploaded byRachit Madan
- Courses of StudyUploaded byRachit Madan
- Standing Waves Per Unit Volume-Derivation-blackbody RadiationUploaded byRachit Madan
- LaTeX MathUploaded bycool_gardens20074304
- Mie TheoryUploaded byRachit Madan
- slot_modified.pdfUploaded byNuzhat Fatema
- Tutorial IIIUploaded byRachit Madan
- Courses in IIT DelhiUploaded byRachit Madan
- Lecture NotesUploaded byRachit Madan
- MAL110Tutsheet4Uploaded byRachit Madan
- Solution Assignment 7Uploaded byRachit Madan
- MAL 110 , tutorialUploaded byRachit Madan
- Tutorial IVUploaded byRachit Madan
- minor2 (1)Uploaded byRachit Madan
- Exp 6.pdfUploaded byRachit Madan
- MAL110Tutsheet1ansUploaded byRachit Madan
- Lecture 1Uploaded byRachit Madan
- CM & Relativity-Slides-Week 4 (1)Uploaded byRachit Madan
- MAL110Tutsheet7Uploaded byRachit Madan
- IIT DelhiUploaded bydeepak_india13

- New Microsoft Word Document.docxUploaded byAnonymous Nlaa5H
- Control & Instrumentation Engineer Job - Qatar _ IndeedUploaded byanse1
- CV_Vijay Saxena.docxUploaded byvijaynarayansaxena
- 3.SAP MII 12.2 + Plant Connectivity 2Uploaded bySai Vellanki
- VIGOR2920.pdfUploaded byBinu Kalarickan
- Pb RouteUploaded byEdgar Navarro
- Mouser ApplicationUploaded byNabeel Haider
- para 33Uploaded bylemo
- L2_dataTypesUploaded bynaveenbabu19
- Extract Plot Data PDF MatlabUploaded byDenise
- Qhd 1 BrakesUploaded byjoesantane
- Battery MPG12V200Uploaded byanon_176248139
- Magnetic Tunnel JunctionUploaded byJohn Richard
- Autonomous Electric HelicopterUploaded byaaa111yyy
- Fortinet Wireless Product MatrixUploaded byFelipe Gabriel Nieto Concha
- 2003 Nissan Altima 2.5 Serivce Manual FaxUploaded byAndy Dellinger
- Interfacing 7Uploaded byanon_720821824
- Java Caching: Strategies and the JCache APIUploaded byanubhavi25
- EKM Metering EKM-15E 120 Volt Meter Spec SheetUploaded byAdam Brouwer
- AS3933 Datasheet en v6Uploaded byEmanuel Ramírez
- JpegUploaded byMelanie Torres Bisbal
- SBC-PII Technical ReferenceUploaded byJustin Tuttle
- KirschenbaumUploaded byFarhad Bahram
- Meridian Norstar M2006 M2008 M2616Uploaded bySteven Lee
- HP Smart ArrayUploaded byGabriel Osvaldo Gómez Abarca
- VPAT_10Uploaded byXavier Danny
- The Machine Symbiont (7297528)Uploaded byEarl Ellis Smith
- Sms Controller PROJECTUploaded byMihai Paun
- Advantest Reset InstructionsUploaded bybox4x4
- EX 2200-C Data Sheet.PDFUploaded byPankaj