Z--Daisy-CS100M SP08-FVL-Chap4

Z--Daisy-CS100M SP08-FVL-Chap4 - Chapter 4 The Discrete...

This preview shows pages 1–3. Sign up to view the full content.

Chapter 4 The Discrete Versus the Continuous 4.1 Connecting Dots Plotting Continuous Functions 4.2 From Cyan to Magenta Color Computations 4.3 Inexact Arithmetic The Floating Point Environment It easy to forget that there is something of a boundary between continuous mathe- matics and digital computing: Display monitors are an array of dots. However, the dots are so tiny that the depiction of a continuous function like sin( x ) actually looks continuous on the screen. The number of possible display colors is limited. However, the number is so large that for all intents and purposes it looks like we are free to choose from anywhere in the continuous color spectrum. Computer arithmetic is inexact. However, the hardware can support so many digits of numerical precision that there is the appearance of perfect computa- tion. We begin to think that one-third is .333333333333333. In this chapter we build a respect for these illusions and an appreciation for what they hide. Visualization an essential feature computational science and engineering. In many applications, the volume of numerical data that makes up “the answer” is too much for the human mind to assimilate in tabular form. On the other hand, the visual display of results enables us to spot patterns that would otherwise be hidden. To illustrate these points we consider in § 4.1 the practical exercise of plotting a simple function across an interval. Screen granularity and human perception a f ect how we think about the underlying table of function evaluations. What does it take to make a smooth function look smooth? 1

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

View Full Document
2 Chapter 4. The Discrete Versus the Continuous Related issues emerge when attempting to shade an area and the color is to vary from (say) light to dark red. Is it possible for the variation to look continuous or will the displayed area look like it is tiled with paint chips? The representation of color as a triplet of numbers and how to compute with these triplets is taken up in § 4.2 Similar issues attend the boundary between exact arithmetic and computer arithmetic which we discuss in § 4.3. Thinking of the computer as a kind of telescopic instrument, rounding errors a f ect its resolution. Just as dish vibrations are taken into account by radio astronomers, so should the aberrations of computer arithmetic be taken into consideration by the computational scientist. 4.1 Connecting Dots Problem Statement Write a script that displays a plot of the function f ( x )= sin(5 x )exp( x/ 2) 1+ x 2 across the interval [ 2 , 3]. Program Development Let us f rst consider a much simpler problem: the plotting of the sine function across the interval [0 , 2 π ]. Even more, let us consider how we would approach such a problem “by hand.” First, we would produce a table of values, e.g., x 0.000 1.571 3.142 4.712 6.283 sin( x ) 0.000 1.000 0.000 -1.000 0.000 We would then connect the f ve “dots” P 1 =(0 . 000 , 0 . 000) P 2 =(1 . 571 , 1 . 000) P 3 =(3 . 142 , 0 . 000) P 4 =(4 . 712 , 1 . 000) P 5 =(6 . 283 , 0 . 000) obtaining the simple plot that is illustrated in Figure 4.1. It is hard to be happy with such a coarse depiction of such a smooth function. Five evenly distributed
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/30/2008 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell.

Page1 / 24

Z--Daisy-CS100M SP08-FVL-Chap4 - Chapter 4 The Discrete...

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

View Full Document
Ask a homework question - tutors are online