Ch1 - cg: P/SQLW, CA jflw fl Lg Affmxlma’hfl/i! M...

Info iconThis preview shows pages 1–20. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13

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

View Full DocumentRight Arrow Icon
Background image of page 14
Background image of page 15

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

View Full DocumentRight Arrow Icon
Background image of page 16
Background image of page 17

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

View Full DocumentRight Arrow Icon
Background image of page 18
Background image of page 19

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

View Full DocumentRight Arrow Icon
Background image of page 20
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cg: P/SQLW, CA jflw fl Lg Affmxlma’hfl/i! M SCIGA‘H‘F-c Cawxfwyfls ‘ Saurux a; W .Mflgdw») - (jaunt. CFéaWr‘fis ang/u / €XawTUZ$7 ‘ 60019.2, VWK - UjW’r Wit/5 03' ,x ' a; A CARI-- ah} ~7M~e a/mo/ mash/vch bu} .640 m,no,k{- lam/n, SUS’FS {Law (ESSA) V814th % 'HMLOPQHC 4 fl COM? “WORM” 1‘ ‘ QM?ch mausde £04 ’ Fremou: QM-Yqhmg o ‘j‘rU/LCQUH’VIJ or (315 Crechmom Rx): Rs.) + £‘(C)(x~c)+ 10:9 (XML +.,, 1x °° m) : Z {Y CC] {X‘ch / chlnw‘mgc p-o F} gwl/S-L I44, ’ UAMUaU1> 13 w 13er senes “of 4’ 990% c aha/716310;. lg we know Mn‘w Cows-Vow *Hru— Awmm WWW. (m, m, 9mm), we an ng‘fUQQ 41K) mzwbwe. CLSJVMW; Mug, .94; My, $amawkm, Owl/M- cawjauere , om mfiye Ca”. 734) , . I 3 C’" V. r1 4g: Cax'I’Mdéa)’ 5M6“?! (mm. ’ egg”? T: 3' *4 ‘9”12‘6535Xcz7742557tf526 ’— 14 M‘é_ CM 95 (D‘i‘kok V$V\? fiylfliljffihc (’5 /£££ ngactdvg fomd" 0,,“ %%r V we 15 M “beat” nywber anAprkaP‘ .. ‘ qu >< ~ fi-l a 55w x Z {eyramh u NS 577;» Manch $50: J 52 (mi-5 l 19H“ (award-m5 Xeifl )dasu‘é‘ 5mg 546*)!1 [J’- ran/es (“when {a 5:314, msz'“ It GxflHmueh. Exawlnik Jim} “’4 ‘g/el lad/“ms W20) é” a ’pmloa IA Grim). arm/Ad @ Mdgéli’xp —- )7Mpe” fi—L-k Solar Systhem,‘ badnc; aV-Z/ Mm—umfirm a ewf‘nmfl. WSurewm "' hand MUCL $65 Mar: ‘ W‘MH: l5 1% orb}? a {fr‘Et/lauS Cowfvhhoflé ' viru/lcow‘wvz “ we W T}: [pk/3L W’J- 4/52. mac. 13: MC Jam}; a 1pm. on.” — ( m/ muck dye; my Mtge weigh? m, W24 thrwoL 4&6; 1+ jmamée?) IS flak fflfec flCCvmée, @WL , , V d . CMFB . Fauna/{k5 e/‘WK dcwr‘ Jam/7 CaMVuhhom 7: g i- (i3 Q Q '1 I Q v u i t 3 § \ m value a €><aw~TLgi "HALMws his 0044A.“ M W5 41— (S-s Mel-6M0; *“Vfit‘l'um 0% 166/sz XOXIOéKm aux/M OLLbIQPror' z (0 M vgeeyyts bus -8 Mfume era!" 3 (0 M - [0 1’ a jLImj waive— ?0‘ )0 QM a Tum CN— are $VrgoS€vi Q1 Wafck [A 5114’ 194/3" (Mo, [5 (’0 M' flva Etc; 6x105 err‘dr‘ t (0 M / Miami-we 6‘er = Rubi: Naw’a'flx error ’w yank, (flahme ever- has at am": fida‘dmg errar Hm} with time value, /S W *- (01°C (\vahwe. em») 25 ’4' $euwml 39% 03C acct/Maj 5’0 knob/:7 on Mars ewa2 z womb j amid a! acct/Maj C4“? 494' ,, 7 WWW. 7. 7 ,C/L LhVfiL [23 :Daém ewr v: Cowrué-ad'wml Wr- __————-‘ Suffqye we, wmk +0 anrum ’X '. vim/e. Jame $8: Mful A q .' fof‘éX/Myafltflaa :‘i‘b x ( (WTFECIS‘L mafyrewd‘j/ {‘W/‘d'As 6WD" 0A Mruh MCaMTszi-e know/Wm) ‘9‘ K4 WW OC/ncchdn, 9W- :I't’ Comfoh-fi If €Xac4—(fi 494665 (hit/311;) Moch-c 011% /\ 1F 5 £9173 afprexwxoéra 4um<ha~ W ’C L/a—ed [oak/j 7/2 = [£65 15.de sysdem SO MXW a! gffiq/ We GMde A A {Mal absdfie <9er 2 gb‘) " $09 ? R'lvwe Llme a/p/oraXIMaé-e dab/sea JEN—HQ) + (Hm—9m) (Cawfud'udVaM/l WC (Jada 9pm “I rmv‘amw M M wreak 6O firms} Commons/we, +oau oa—(—?“ Came” rrlaFfJ—kw cmor {a ‘T Clea/19 re.qu If afprwmahvxa ,S‘ // Jul/1C0 47m VS: Mdfiélb Wt. EM" We €32<4~WVKQ> Camoiwbcnol em: ans'h/‘chm If Aaé~ vino 07+va 1,15 {Svefij anhcaj) 4WVIC0‘ 0470/! WP 2‘ / PC3944» qu'leA USU/13 0\/\ (OtffmaxMré-e alg/r:+km bu)‘ - ( +NQ Pesd‘b) leA {>534 araH‘meM‘ FOUnAh/M?) epmr : Cemeé-Q) rQSUH~, UNA? jam air/row Maw/WW“ ml Mexad— air/#1th _ < am WI Comgwfi‘a'hamK WP :- ( FOJAA‘AS EN???) ‘1' ( +rudcad7“ 0m) Caf‘v’fél , {kaw Le' 51/610 3 (W1 ¥(X+M-L(X) (5 hJQGLnléom W [xx->0 \,\ _,O\ I 1% Tax/(gr $4065 09 ‘( aback ’X: [Cum = $60 + 42;) u + C(x/hz“, —— L W #9640146 7%; (Ml) E—y—ge) (X‘C) m.) gr 50M UA kMWAQ’ (NHL! Eda-“ecu Cam/)4 cc}th (Mics z}va [1“ % (“wazL km, 6x66?)— (/UIHA a "vaJcacf MM (fig 6 msJ—ed wan 3:: M {PNF 1) H ¥'<e)u72 9 Lawn WM MM ((21) g C(XHQ"?C><) K 4501, ‘ CA I F] gfibe :1 0C“) ’r ¥I(><)L + F69) VIZ '(x/ x ( M4 R > (I g: 3}“k x + g (aw/1 56/ we, MW‘ 0x @‘rdrIS 64ml! M brad [dad ’ deuMI/LSV (“(9) u lazy/wk) @639” gearefigmfi 1/1 {times *wmcahox WP, but» J; M 1; {My} fix”) an) «GHQ we, C(rga, Sax/ask Welr‘e way/h“? 1,41% 5 5“?“WCLCM+ ixsflb. any" 1C(><+M= LIZEQEE‘EJ (30d 2 {.123\f5u.o /‘H/\e;e. Jack) are [15+ RNM—Qx): -o~3fi:v'§m [C acct/rods; c1419 1 thra“ 1 Thug 5‘Av7/oL-neJ-IH— (you/cl be . 0&0 2 3.4/62“? EuoLuac— 041:] yak éxldté (oneiyck) go, +ny hm“ Fogflfg Cram/f a?! 1? {Emu -P(x))(/+ZJ‘) I: Com/9W1 We £226: ‘ MUM)’ or I Hm *9 er I /k SMAij word“? €909" “ (Ix (bu/mac‘de Wf' Q :14 «PD, M24176) Z wt m— « 2-3/3; at: mam k 2 1"!) WHAHNHLL J i :0 wk) fir" [4 AR ' SL(Z%+M%) ” ’245 +91 ‘0 AM k 2. 1k = 2% 5+“ +rmcadvdn, M): (QT 450/ f i ,A _ CA ’, [9? Ally Forujwy) epmr- US EACL‘LJOV‘J {pror- / Sarrpsn— we wonk— \j:{:(¥)/ but we, 5 MSRNL guru/QM {Paar : 9 - (j 1 "HQ errar/n m (6544', AAon '- M Q/‘Mr‘ fiat/J WU d“ 0L 6% Umr M 61"” ‘flFLJJ‘ Cm emrlazm MM. errat- we 3a. m Maul—pk? Suffix j = 1: €xac4— raw/v", (103* 1,097+; Surf»?— 9 z 5; ()2) gm 50m». 0': f 1: Same MAJ/XflJ—A Mka 70!“ exffcl" OCUWIA We Jan? EM! WW)? is, we «m: Jaser (Jr/«7 x++a ~extla 1’\_ 6 , TWA Ax = >24 I: M bacth @“we. A 1143 )oluham W‘Q Did”, 9 J 1‘ A A jalua‘wm 7?) 51m Magicu) 7"fo A/ j Muskbe a’é‘g gm 3‘ 2 ,ECX) —- HAL QTPwagm 91Ach Cup/’50) :l-z) {HAG 3-“ka be Meade») m dLUM ways-9 93%» — M age; cm” WW m affW/Maad m/w}, , A A A (M Mafia, we «My 313*“ y HWX) M- 34m; I; a {IN/llfiwlhdfl "' I} (MW/‘4“; m 51"de 6%? 6'; v? V5 p? (grungy W) 1’3 )c vs )2 ( backward ~<~M"> C91“ 4371 H H 7 V I a (, “fig” [’2/6 §eflélflLIinj and ~Csva10544963) / Quadww " SUK/UX «Meal; my Mrua’r & ij 14"» a”) (Mj resale} bawdy W5. 71ml”; 34w}! TIA; Pesolr} I: MSeAm‘wa +0 nth” lmrué", (UkLl~CanJld7M) Bud” (S, i We“; Eni’u‘fi‘ 6‘4) a [£036 amny m M owl—wa? 15 [49 L 1. CM 1 dwser wj wreak? ( I'lwawhdwa) final!“ [COAAIJ‘UA NUbe/‘f = Chfi’kfi {A watt»? ‘FelG-Zhl/‘e. (Mpg; M lard—l : 4h" gramme) Mr 2 g‘fl relé‘hv'e <¥urww~9 mur- I {>2 -x)/)< l = 3-3 AL A “3 bomth 6m»- -..- x -;< ;_x 'I’lw! Hugh/e. Ignazme .omm = '37 z retarhvne’ gr“)me 6 (aflcbhws ( Y‘Cbhhvw. Efictu/MN er‘f‘lr numw Q/‘f‘ah / {In C , QT Lisa/m, LL’__._V F17— 9 0m dainH‘M \s‘ “IZEML 4v? {Profs W dong wav‘a'fiokéwm [\H-e, Z‘CLCC" (JAM/‘0. NELSUH" 9 a U well—amaldeQ (-F 14» luv 0x014) _______—.-—- Ca/«Lvhm When - uh. 92km» aCCde-e fess/H» imj “mg n SE13} MLfiJ/‘lewflw‘ dA 9x wen‘canebhme‘) {NV/ban. (ya (Can) via-W mama/ale few/a" by 6% 05m? am uAf—JZHL m?an an a “xebL-@¢Jm¢w¢ ffidLI-QW/ or" w] S'th agahm 0A 6km I/(‘CJAJWPMW/ W (karrarsi) ,-0!/\ UASd‘oJ’LL alyar-NLLM am am ,fl Cr/LAI'haAQ) ruum' IX : @i‘W-W x 2‘ CH W1 5 L3H bu}- 19‘156 2. 3, acted/Lem}, is M 01"»; MA}; *IDZL +0 l023, -303 43 Or 60:40? (0 "J'D [0 a) /X 25 ,5 q sfccm case/ as M firms; a“! Na“ (“QOX‘a % U VHFWMIIIZQ) _" fla (690%? Jlle’ IS Gal/913) j- ( 5& Me an? («m/t 42) 547mg :4») (gag—e - l0 Wdloakfi o IX: 2*. $.N-‘E x10 , m i 0,03l416 No2 (585 Cal! EC 964% Z Or (9°46 (O (USMle Page 2,)_ M Past-2, M/Mbo-S hlce<o.l),o C3350} be her/BM} COT7501_,, I v CUM/2175 714/2 [/X z 0 (Rank-e5 fl 4mm, M». (a whiz (X fit) 'L x 2x +. | en; J VS . ,jCOr X a O; ,( :\ pal/"din tJf/‘ades L0 41M!) ¢ I '9‘; (MATLAG 5 Car-aw Jw (Asdhe. 031:) I; a? +ru/xcadm7 -’ 'A (+5 Vtearega- af/mwmdm M bflge Z (0:!) ,0 ’5 lye/Meal Ur , $95443 / («Man kaJ QT Vsolw ,f , CL; ,76’ _..<;__ _.,,_ ¥ ___ gee lieu 9r mewLm-I 4%. Mi “may 3mm, “gm? EWD5 0" “CURE”: fem? fimr ( 5601744 1.3.7) WK) 1 HHS) S“ 3019:, mm ms 3:5” 2 81‘ (“7) = (x+7)(\+ 0%) w = Q'W'CXWZ): (xymwnuwg) 1 W; (_\+<§9)7' = ML(I+23+ 31) t‘h \ 2* Xy'LK H22) “/ $6 tack apmd-nm can Maul+ m U), +0 g—Qf‘mr m «3449 raga/‘3’ F Farm/0va ermr )AJ-erffh‘h’“ exact} resvH- K7 = a A CoMFUQ-e) reguH- X7 ((4—3) 2 0x {lira/w) mar 15 a-m ar- a+ Mm 3x7 EaCkWO") e‘wr‘ " (Ma/\e COMqu 3\ _————-———- CWfUR) Soluchm/ a 15 flw. ego/CA» salad-2m U/Kavé- May;th lowlpcgm'? Ky 6+5) 13 M amok salt/67m an X (yCHQ 0r (><(1+S)3y or (YWMW t 74‘; am M cw,- x 7 r sfllfflwa ef/D Or‘ (\(l+¥)llz)(‘/(I+S)l’1>( xm’y Mose. (H9914 H 8% Floating points IEEE Standard unifies arithmetic model by Cleve Moler fyou look carefully at the definition of fundamental arithmetic operations like addition and multiplication, you soon encounter the mathematical abstraction known as the real numbers. But actual computation with real numbers is not very practical because it involves limits and infinities. Instead, MATLAB and most other technical computing environments use floating-point arithmetic, which involves a finite set of numbers with finite precision. This leads to phenomena like roundoff error, underflow, and overflow. Most of the time, MATLAB can be effectively used without worrying about these details, but every once in a while, it pays to know something about the properties and limitations of floating— point numbers. Twenty years ago, the situation was far more complicated than it is today. Each computer had its own floating-point number system. Some were binary; some were decimal. There was even a Russian computer that used trinary arithmetic. Among the binary computers, some used 2 as the base; others used 8 or 16. And everybody had a different precision. In 1985, the IEEE Standards .Board and the American National Standards Institute adopted the ANSI/IEEE Standard 754—1985 for Binary Floating-Point Arithmetic. This was the culmination of almost a decade ofwork by a 92~person working group of mathematicians, computer scientists and engineers from universities, computer manufacturers, and microprocessor companies. All computers designed in the last 15 or so years use IEEE floating-point arithmetic. This doesn’t mean that they all get exactly the same results, because there is some flexibility within the standard. But it does mean that we now have a machine- independent model of how floating-point arithmetic behaves. MATLAB uses the IEEE double precision format. There is also a single precision format which saves space but isn’t much faster on modern machines. And, there is an extended precision format, which is optional and therefore is one of the reasons for lack of uniformity among different machines. Most floating point numbers are normalized. This means they can be expressed as x::(i+f)-2e '(leve's Corner ‘K. where f is the fraction or mantissa and e is the exponent. The A», , fraction must satisfy What is the osf<1 output? and must be representable in binary using at most 52 bits. In a = 4/3 other words, 252fmust be an integer in the interval b = a — 1 c = b + b + b 0 s 252f< 253 e = 1 — c The exponent must be an integer in the interval —1022 5 es 1023 The finiteness offis a limitation on precision. The finiteness of e is a limitation on range. Any numbers that don’t meet these limitations must be approximated by ones that do. Double precision floating-numbers can be stored in a 64—bit word, with 52 bits for f, 11 bits for e, and 1 bit for the sign ofthe number. The sign of e is accommodated by storing e+1023, which is between I and 211—2. The two extreme values for the exponent field, 0 and 211-1, are reserved for exceptional floating—point numbers, which we will describe later. Illlllllllllllllllllllllllll||| l l l | l I 1 1/8 1 2 3 4 5 6 7 The picture’above shows the distribution of the positive numbers in a toy floating-point system with only three bits each for fand 6. Between 29 and Ze+1 the numbers are equally spaced with an increment of 28‘}. As 2 increases, the spacing increases. The spacing ofthe numbers between 1 and 2 in our toy system is 23, or In the full IEEE system, this spacing is 252. MATLAB calls this quantity eps, which is short for machine epsilon. eps = 21-52) MATLAB News 8- Notes Fall 1996 11 I 1 2 Fall, 1996 (Ieve’s Corner (continued) Before the IEEE standard, different machines had different values of eps. The approximate decimal value of eps is 2.2204 - 10'16. Either eps/2 or eps can be called the roundofflevel. The maximum relative error incurred when the result of a single arithmetic operation is rounded to the nearest floating-point number is eps/ 2. The maximum relative spacing between numbers is eps. In either case, you can say that the roundoff level is about 16 decimal digits. A very important example occurs with the simple MATLAB statement t = O . 1 The value stored in t is not exactly 0.1 because expressing . . l . . . . . . the decrmal fraction A0 1n binary requires an infinite serles. In fact, 1A0=%++%5+%6+%7+%8+%9+%l°+%“+%12+... After the first term, the sequence of coefficients 1, 0, 0, 1 is repeated infinitely often. The floating—point number nearest 0.1 is obtained by rounding this series to 53 terms, including rounding the last four coefficients to binary 1010. Grouping the resulting terms together four at a time expresses the approximation as a base 16, or hexadecimal, series. So the resulting value of t is actually t : (I +9A6+%62+9A63+ +%612+ 1%613)- 2'4 The MATLAB command format hex causes t to be printed as 3fb9999999999998 The first three characters, 3fb, give the hexadecimal representation of the biased exponent, e+ 1023, when e is -4. The other 13 characters are the hex representation of the fraction f. 50, the value stored in t is very close to, but not exactly equal to, 0.1. The distinction is occasionally important. For example, the quantity 0.3/0.1 is not exactly equal to 3 because the actual numerator is a little less than 0.3 and the actual denominator is a little greater than 0.]. Ten steps oflength t are not precisely the same as one step oflength 1. MATLAB is careful to arrange that the last element MATLAB News & Notes ofthe vector 0:0 .1 :1 is exactly equal to 1, but if you form this vector yourself by repeated additions of 0.1, you will miss hitting the final 1 exactly. Another example is provided by the MATLAB code segment in the margin on the previous page. With exact computation, e would be 0. But in floating-point, the computed e is not 0. It turns out that the only roundoff error occurs in the first statement. The value stored in 3 cannot be exactly %, except on that Russian trinary computer. The value stored in b is close to 1/3, but its last bit is O. The value stored in c is not exactly equal to 1 because the additions are done without any error. So the value stored in e is not 0. In fact, e is equal to eps. Before the IEEE standard, this code was used as a quick way to estimate the roundoff level on various computers. The roundofflevel eps is sometimes called “floating-point zero,” but that’s a misnomer. There are many floating—point numbers much smaller than eps. The smallest positive normalized floating—point number has f: 0 and e = —1022. The largest floating-point number has fa little less than 1 and e = 1023. MATLAB calls these numbers realmin and r‘ealmax. Together with eps, they characterize the standard system. Name Binary Decimal eps 2”(-52) 2.2204e—16 realmin 2“ ( -1022) 2.2251 e-308 r‘ealmax (2- eps) *2‘1023 1 .7977e+308 When any computation tries to produce a value larger than realmax, it is said to overflow. The result is an exceptional floating—point value called Inf, or infinity. It is represented by taking f: 0 and e = 1024‘ and satisfies relations like 1/Inf = Oand Inf+Inf = Inf. When any computation tries to produce a value smaller than realmin, it is said to underflaw. This involves one of the optional, and controversial, aspects of the IEEE standard. Many, but not all, machines allow exceptional denormal or subnormal floating—point numbers in the interval between r‘ealmin and eps*realmin. The smallest positive subnormal number is about 04946—323. Any results smaller than this are set to zero. On machines without subnormals, any result less than realmin is set to zero. The subnormal numbers fill in the gap you can see in our toy system between zero and the smallest positive number. They do provide an elegant model for handling underllow, but their practical importance for MATLAB style computation is very rare. When any computation tries to produce a value that is undefined even in the real number system, the result is an exceptional value known as Not-a-Number, or NaN. Examples include 0/0 and Inf-Inf. MATLAB uses the floating-point system to handle integers. Mathematically, the numbers 3 and 3.0 are the same, but many programming languages would use different representations for the two. MATLAB does not distinguish between them. We like to use the term flint to describe a floating—point number whose value is an integer. Floating- point operations on flints do not introduce any roundoff error, as long as the results are not too large. Addition, subtraction and multiplication of flints produce the exact flint result, if it is not larger than 2‘53. Division and square root involving flints also produce a flint when the result is an integer. For example, sqr‘t(363/3) produces 11, with no roundoff error. As an example of how roundoff error effects matrix computations, consider the two—by—two set of linear equations 11 3.3 10x1 + X2 3x, + 0.3x2 II The obvious solution is x1: 1 , X2: 1. But the MATLAB statements A = [10 1; 3 0.3] b = [11 3.31' x = A\b produce x = —0.5000 16.0000 Why? Well, the equations are singular. The second equation is just 0.3 times the first. But the floating—point representation of the matrix A is not exactly singular because A(2,2) is not exactly 0.3. Gaussian elimination transforms the equations to the upper triangular system U‘x = c where U(2,2)= 0.3 - 3*(o.1) = -5.5551e-17 and 0(2) = 3.3 - 33*(O.1) -4.4409e—16 MATLAB notices the tiny value ofU(2,2) and prints a message warning that the matrix is close to singular. It then computes the ratio of two roundoff errors X(2) c(2)/U(2,2) 16 II This value is substituted back into the first equation to give x(1) (11 - x(2))/10 -0.5 II The singular equations are consistent. There are an infinite number of solutions. The details of the roundoff error determine which particular solution happens to be computed. . 1 n . . 0.99 0.995 1 1.005 1.01 Our final example plots a seventh degree polynomial. X = 0.988: .0001 :1 .012; y = x.‘7—7*x."6+21*x."5-35*x.“4+35*x.“3-... 21*x.‘2+7*x-1; plOt(X,y) But the resulting plot doesn’t look anything like a polynomial. It isn’t smooth. You are seeing roundoff error in action. The y—axis scale factor is tiny, 10‘”. The tiny values ofy are being computed by taking sums and differences of numbers as large as 35 - 1.0124. There is severe subtractive cancellation. The example was contrived by using the Symbolic Toolbox to expand (x — 1)7 and carefully choosing the range for the x-axis to be near x = l. Ifthe values ofy are computed instead by Y : (X'l ) 37; then a smooth (but very flat) plot results. I MATLAB News 8; Notes Cleve Moler is chain and co—founder of The MathWorks. His e—mail address i: moler@mathworks.c< Fal|,1996 13 Mon Aug 25 14:09:42 2003 fe.m Wed Oct 01 11:33:08 2003 1 function [s,f,e] = fe (x) % % get the IEEE double precision mantissa f and exponent e so that x = s * (1+f) * 2Ae [fl,el] = 1092 (X) % get the sign if (fl < 0) S=—l; fl = —fl ; else 5:1; and % get the mantissa f = 2*fl — l ; % get the exponent e = el+l ; ...
View Full Document

Page1 / 20

Ch1 - cg: P/SQLW, CA jflw fl Lg Affmxlma’hfl/i! M...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online