First Semester in Numerical Analysis with Julia, 2020a
First Semester in Numerical Analysis with Julia, 2020a
First Semester in Numerical Analysis with Julia, 2020a
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHAPTER 4. NUMERICAL QUADRATURE AND DIFFERENTIATION 174<br />
<strong>Numerical</strong> differentiation and roundoff error<br />
Arya and the mysterious black box<br />
College life is full of mysteries, and Arya<br />
faces one <strong>in</strong> an eng<strong>in</strong>eer<strong>in</strong>g class: a black<br />
box! What is a black box? It is a computer<br />
program, or some device, which produces<br />
an output when an <strong>in</strong>put is provided.<br />
We do not know the <strong>in</strong>ner work<strong>in</strong>gs of the<br />
system, hence comes the name black box.<br />
Let’s th<strong>in</strong>k of the black box as a function<br />
f, and represent the <strong>in</strong>put and output as<br />
x, f(x). Of course, we do not have a formula<br />
for f.<br />
What Arya’s eng<strong>in</strong>eer<strong>in</strong>g classmates want to do is compute the derivative <strong>in</strong>formation<br />
of the black box, that is, f ′ (x), whenx =2. (The <strong>in</strong>put to this black box can be any<br />
real number.) Students want to use the three-po<strong>in</strong>t midpo<strong>in</strong>t formula to estimate f ′ (2):<br />
f ′ (2) ≈ 1 [f(2 + h) − f(2 − h)] .<br />
2h<br />
They argue how to pick h <strong>in</strong> this formula. One of them says they should make h as<br />
small as possible, like 10 −8 . Arya is skeptical. She mutters to herself, "I know I slept<br />
through some of my numerical analysis lectures, but not all!"