06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 1. INTRODUCTION 37<br />

26.04166666666667<br />

64.8<br />

163.4013888888889<br />

416.10158730158724<br />

1067.6270089285715<br />

2755.7319223985887<br />

7147.658895778218<br />

18613.92623376623<br />

48638.84613847011<br />

127463.00337621223<br />

334864.62769059895<br />

881657.9515664611<br />

The previous version of the code gave overflow error when n =16. This version<br />

has no difficulty <strong>in</strong> comput<strong>in</strong>g n n /n! for n =16and 17. In fact, we can go as high as<br />

n = 700,<br />

In [3]: f(700)<br />

Out[3]: 1.5291379839716124e302<br />

but not n = 750.<br />

In [4]: f(750)<br />

Out[4]: Inf<br />

Overflow <strong>in</strong> float<strong>in</strong>g-po<strong>in</strong>t arithmetic yields the output Inf, which stands for <strong>in</strong>f<strong>in</strong>ity.<br />

We will discuss several features of computer arithmetic <strong>in</strong> the rest of this section. The<br />

discussion is easier to follow if we use the familiar base 10 representation of numbers <strong>in</strong>stead<br />

of base 2. To this end, we <strong>in</strong>troduce the normalized decimal float<strong>in</strong>g-po<strong>in</strong>t representation:<br />

±0.d 1 d 2 ...d k × 10 n<br />

where 1 ≤ d 1 ≤ 9, 0 ≤ d i ≤ 9 for all i =2, 3, ..., k. Informally, we call these numbers k−digit<br />

decimal mach<strong>in</strong>e numbers.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!