1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Software Solutionsfor for engineers and scientist ppt

946 502 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Software Solutions for Engineers and Scientists
Tác giả Julio Sanchez, Maria P. Canton
Trường học Boca Raton, London, New York
Chuyên ngành Engineering, Science
Thể loại Book
Năm xuất bản 2008
Thành phố Boca Raton
Định dạng
Số trang 946
Dung lượng 4,95 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

One intriguing question is whether a positional counting systemthat includes the zero symbol is a natural and predictable step in the evolution ofour mathematical thought, or whether its

Trang 2

Software Solutions

Trang 4

CRC Press is an imprint of the Taylor & Francis Group, an informa business

Boca Raton London New York

Trang 5

Boca Raton, FL 33487‑2742

© 2008 by Taylor & Francis Group, LLC

CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S Government works

Printed in the United States of America on acid‑free paper

10 9 8 7 6 5 4 3 2 1

International Standard Book Number‑13: 978‑1‑4200‑4302‑0 (Hardcover)

This book contains information obtained from authentic and highly regarded sources Reprinted material is quoted

with permission, and sources are indicated A wide variety of references are listed Reasonable efforts have been made to

publish reliable data and information, but the author and the publisher cannot assume responsibility for the validity of

all materials or for the consequences of their use

No part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or

other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any informa‑

tion storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://

www.copyright.com/) or contact the Copyright Clearance Center, Inc (CCC) 222 Rosewood Drive, Danvers, MA 01923,

978‑750‑8400 CCC is a not‑for‑profit organization that provides licenses and registration for a variety of users For orga‑

nizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for

identification and explanation without intent to infringe.

Library of Congress Cataloging‑in‑Publication Data

Sanchez, Julio, 1938‑

Software solutions for engineers and scientists / authors, Julio Sanchez and Maria P Canton.

p cm.

Includes bibliographical references and index.

ISBN 978‑1‑4200‑4302‑0 (alk paper)

1 Engineering‑‑Data processing 2 Science‑‑Data processing I Canton, Maria P II Title.

Trang 6

v

Trang 7

2.3.2 Floating-Point Representations 41

2.4.2 Floating-Point Exponent in ANSI/IEEE 754 Single Format 432.4.3 Floating-Point Significand in ANSI/IEEE 754 Single Format 44

3.3.2 Comparison, Bit Scan, and Bit Test Instructions 68

3.3.3 Increment, Decrement, and Sign Extension Instructions 71

Trang 8

Chapter 5 — Floating-Point Hardware

Chapter 6 — Floating Point Data and Conversions

6.2.2 Initializing Data with DD and DQ Directives 124

Trang 9

Chapter 7 — Math Unit Architecture and Instruction Set

Chapter 8 — Transcendental Primitives

Trang 10

Chapter 9 — General Mathematical Functions

9.2.2 Real and Complex Roots of a Quadratic Equation 240

Chapter 10 — Financial Calculations

Trang 11

Chapter 12 — Interpolation, Differentiation, and Integration

Least-Squares Linear Interpolation Function 321

Chapter 13 — Linear Systems

13.0.2 Matrix Representations of Linear Systems 344

Trang 12

Chapter 14 — Solving and Parsing Equations

Trang 13

PART II — APPLICATION DEVELOPMENT Chapter 16 — The C++ Language on the PC

Chapter 17 — Event-Driven Programming

Trang 14

Chapter 20 — Text Display

Trang 15

20.4.3 Paragraph Formatting 511

Chapter 21 — Keyboard and Mouse Programming

Chapter 22 — Graphical User Interface Elements

Trang 16

22.5.5 Combo Box in a Toolbar 591

Chapter 23 — Drawing Lines and Curves

Chapter 24 — Drawing Solid Figures

Trang 17

24.2.7 Drawing with PolyPolygon() 649

24.5.1 Creating or Modifying a Clipping Region 672

24.6.1 Creating, Deleting, and Converting Paths 678

Chapter 25 — Displaying Bit-Mapped Images

Trang 18

PART III — PROJECT ENGINEERING Chapter 26 — Fundamentals of Systems Engineering

26.2.5 Malleability and Anticipation of Change 736

Chapter 27 — Description and Specification

Trang 19

27.2.1 The Requirements Analysis Phase 757

Multiple Inheritance in Gen-Spec Structures 800

Trang 20

Appendix B — Accuracy of Exponential Functions

Appendix C — C++ Indirection

Trang 21

AC.0 Indirection in C++ 833

Appendix D — Multiple File Programs

Appendix E — The MATH32 Library

Appendix F — Windows Structures

Trang 22

Bibliography 895

Trang 24

Our book was conceived as a programming toolkit and a problem-solving resource forprofessional engineers and scientists who take on the role of programmers Thebook’s original idea was based on the fact that engineers and scientists often need todevelop software to suit their particular needs, but hardly ever are they “super-programmers” at the start On the other hand, the scientist/engineer who becomes animprovised programmer is often the originator of major software products: whoknows better what the software must accomplish than the person who is an expert inthe field of application and the intended user of the product? Who can better designand code the bridge-building program than the bridge builder?

At the same time, scientists and engineers are intellectuals, trained in the ences, with good mathematical backgrounds, and who already know the many com-plexities involved in scientific and technological calculations They constitute agroup of readers who do not accept black boxes or unexplained methodologies Fur-nishing software and development tools for them requires finding a balance that, onone hand, does not ignore their scientific, technical, and mathematical competence,and on the other one, provides practical shortcuts that avoid unnecessary complica-tions We have attempted to achieve this balance in our book

sci-The software requirements of applications intended for engineering and scientificuses are almost always computational The typical scientific and engineering pro-gram has a strong number-crunching component But the computational capabilities

of conventional programming languages are limited and often not well documented.For example, the mathematical functions that are part of the C++ language barelyinclude the common trigonometric and logarithmic functions An engineering appli-cation that requires calculating a statistical function, or that performs basic differ-entiation or integration, cannot be easily developed in this or most otherprogramming languages Consequently, the scientist/engineer software developer isforced to search for or develop algorithms and methods to perform the required cal-culations, often ending up with untested, undocumented, and unreliable routines.Providing these numerical tools has been our primary objective in this book

But it does not end with the tool, algorithm, or even the canned routine thatsolves a computational problem The engineering or scientific application must exe-cute in a modern computer and do so with professional appearance and functional-ity In a very few cases is a minimal, text-based program sufficient for the purpose athand To be effective, the program must execute in a graphical operating systemsuch as Windows; therefore the engineer/scientist programmer must also have ac-cess to these skills

xxiii

Trang 25

Furthermore, the scientist/engineer programmer must also be capable of lyzing and designing the application using state-of-the-art tools and technology.The “make it up as you go along” approach does not work for digging a mountaintunnel or for crafting a computer program This means that project engineeringskills will also be necessary, as they are for any other engineering or scientific en-terprise.

ana-Book Structure

The requirements just listed account for the three principal parts of the book Part I,

titled Techniques and Code, starts at the most elementary level: number systems,

storage of numerical data, and basic machine arithmetic A discussion ofbinary-coded decimal numbers and the development of high-precision arithmeticroutines in floating-point follows Then come chapters on the Intel math unit archi-tecture, data conversions, and the details of math unit programming With thisframework established, the remainder of the first part is devoted to developing rou-tines useful in engineering and scientific code These routines include general math-ematics, financial calculations, statistics, differentiation and integration, linearsystems, equation parsing, and topics in artificial intelligence

Part II is titled Application Development Starting with Chapter 16 we cover

the actual implementation of a C++ program on the PC The first chapter of Part II

is an introduction of the PC implementations of C++, flowcharting as a programdevelopment tool, and the use of Microsoft’s Developer Studio in creating atext-based program, called a Console Application The remaining chapters of Part

II are a tutorial on Windows programming The intention of this part is to provideessential skills that will allow the reader to create a professional quality programwhile avoiding topics and details that have little interest for the engineer/scientistprogrammer

Part III, titled Project Engineering, covers topics quite familiar to the

scien-tist/engineer programmer since a software product is created following ing principles that are similar to those used in any engineering endeavor The firstchapter of Part III is an overview of the software engineering field and describesits most common qualities, principles, and paradigms This is followed by a dis-cussion of the description and specification of software projects The remainder

engineer-of this part is about the object-oriented approach to sengineer-oftware development andthe use of object-orientation as an analysis tool Object-oriented programminghas proven itself in the past 20 years and the scientist/engineer programmershould have some familiarity with the possible uses of this development model

The final part of the book contains several appendices that either cover topics

of general interest in the field of scientific programming or provide useful toolsfor the developer Included in the topics covered is an overview of math unit pro-gramming, the accuracy of exponential functions, the use of pointers and indirec-tion in C++, and the use of multiple files in applications Also in Part IV is anappendix listing of all the primitives contained in the MATH32 library furnished inthe book’s software package and an appendix that lists the Windows structuresmentioned in the text

Trang 26

Languages and Environment

The principal programming language used in the book is C++, but some primitive tions are coded in Intel Assembly Language This is necessary since the Intel mathunit, which is the number-crunching engine on the PC, can only be programmed inlow-level code However, all machine-level routines discussed in the text are accessi-ble from C++ by means of furnished interface functions This ensures that readers notfluent in Assembly Language can still understand the material and put the software towork

func-Microsoft’s Visual C++ and MASM were used in developing the software The text

is compatible with Visual C++ versions 5, 6, and 7 The code adopts the flat, 32-bitmemory model, which makes it compatible with both Visual C++ Console Applica-tions and Windows programs

Software On-line

The book includes a software package, furnished on-line, with all the sample grams developed in the text Also included are the source and object files for the 32-bitnumerical library named MATH32.LIB, and for an MS DOS numerical library namedMATH16.LIB The procedures in the MATH32 library are listed in Appendix E Thedemonstration programs test and exercise the primitives and functions developed inthe text and serve as an illustration on how to use these resources in the reader’s owncode The publisher’s web site is:

pro-www.taylorandfrancis.com

Julio Sanchez

Maria P Canton

Trang 28

Techniques and Code

1

Trang 30

Computer Number Systems

Chapter Summary

One of the fundamental applications of a computer system is the processing and ing of numeric data, sometimes called “number crunching.” In order to perform moreefficient digital operations on numeric data, mathematicians have devised systemsand structures that differ from those used traditionally This chapter presents thebackground material necessary for understanding and using the number systems andnumeric data storage structures employed in digital computers The material includeslow- and high-level integer conversion routines

stor-1.0 Counting

The origin and the fundamental application of a number system is counting Imagine aprimitive hunter using his or her fingers to show other members of the tribe how manymammoth were spotted during a scouting trip By this simple scheme the hunter isable to transmit a unique type of information The information the hunter wishes toconvey does not relate to the species, size, or color of the animals, but to their num-bers This is possible because our minds are able to isolate the notion of “oneness”from other properties of objects

The most primitive method of counting consists of using a common object to resent the degrees of oneness The hunter uses one finger to represent each mam-moth Alternatively, the hunter could have resorted to pebbles, sticks, lines on theground, or scratches on the cave wall to show how many units there were of the ob-ject, independently of any other characteristic or attribute

rep-1.0.1 The Tally System

The first number system probably started from notches on a stick or scratches on a

cave wall In the simplest form, sometimes called a tally system, each scratch, notch,

or line represents an object The method is so simple and intuitive that we continue sorting to it, even after mastering the intricacies of the calculi Tallying is based on aone-to-one correspondence between objects and their representation The huntercounts the mammoth hiding in the ravine by making notches on a stick, at the rate ofone notch for each mammoth In order to share this information with other members

re-3

Trang 31

of the tribe, the hunter can later transfer the notches on a stick to lines or scratches

on the cave wall Tallying requires no knowledge of quantity and no elaborate bols Had there been 12 mammoth in the ravine the cave wall would have appeared

I, II, III, IIII, and V

The Roman symbol V is conceivably a simplification of the tally encoding using

a diagonal line to complete the grouping Table 1.1 shows the decimal value of theRoman symbols

Trang 32

1.1 The Origins of Our Number System

The one element of our civilization which has transcended all cultural and social ferences, is a system of numbers While mankind is yet to agree on the most desirablepolitical order, on generally acceptable rules of moral behavior, or on a universal lan-guage, the Hindu-Arabic numerals have been adopted by practically all the nations andcultures of the world There must be something extraordinary about this number sys-tem for it to achieve such general acceptance

dif-By the year 800 A.D the Arabs were using a ten-symbol positional system of bers which included the special symbol for 0 This system (later called theHindu-Arabic numerals) was introduced into Europe during the 8th century, proba-bly through Spain Pope Sylvester II, who had studied the Hindu-Arabic numbers inSpain, was the first European scholar known to adopt and teach them The Latin ti-

num-tle of the first book on the subject of “Indian numbers” is Liber Algorismi de Numero Indorum.The author is the Arab mathematician al-Khuwarizmi

In spite of the evident advantages of this number system its adoption in Europetook place only after considerable debate and controversy Many scholars of thetime still considered that Roman numerals were easier to learn and more convenientfor operations on the abacus The supporters of the Roman numeral system, called

abacists , engaged in intellectual combat with the algorist, who were in favor of the

Hindu-Arabic numerals as described by al-Khuwarizmi For several centuriesabacists and algorists debated about the advantages of their systems, with the Cath-olic church often siding with the abacists This controversy explains why theHindu-Arabic numerals were not accepted into general use in Europe until the be-ginning of the 16th century

It is often said that the reason for there being ten symbols in the Hindu-Arabic merals is related to the fact that we have ten fingers However, if we make aone-to-one correlation between the Hindu-Arabic numerals and our fingers, we findthat the last finger must be represented by a combination of two symbols (10) Also,one Hindu-Arabic symbol (0) cannot be matched to an individual finger In fact, thedecimal system of numbers, as used in a positional notation that includes a zerodigit, is a refined and abstract scheme which should be considered one of the great-est achievements of human intelligence We will never know for certain if the

Trang 33

nu-Hindu-Arabic numerals are related to the fact that we have ten fingers, but its foundness and usefulness clearly transcends this biological fact.

pro-The most significant feature of the Hindu-Arabic numerals is the presence of aspecial symbol (0) which by itself represents no quantity Nevertheless, the spe-cial symbol 0 is combined with the other ones In this manner the nine other sym-bols are reused to represent larger quantities Another characteristic of decimalnumbers is that the value of each digit depends on its position in a digit string.This positional characteristic, in conjunction with the use of the special symbol 0

as a placeholder, allow the following representations:

1 = one

10 = ten

100 = hundred

1000 = thousand

The result is a counting scheme where the value of each symbol is determined

by its column position This positional feature requires the use of an cal symbol (0), which does not correspond to any unit-amount, but is used as aplace-holder in multi column representations We must marvel at the intelligence,abstraction capability, and even the sense of humor of the mind that conceived acounting system that has a symbol that represents nothing We must also wonderabout the evolution of mathematics, science, and technology had this system notbeen invented One intriguing question is whether a positional counting systemthat includes the zero symbol is a natural and predictable step in the evolution ofour mathematical thought, or whether its invention was a stroke of genius thatcould have been missed for the next two thousand years

almost-magi-1.1.1 Number Systems for Digital-Electronics

The computers built in the United States during the early 1940s operated on decimalnumbers However, in 1946, von Neumann, Burks, and Goldstine published a

trend-setting paper titled Preliminary Discussion of the Logical Design of an tronic Computing Instrument, in which they state:

Elec-“In a discussion of the arithmetic organs of a computing machine one is urally led to a consideration of the number system to be adopted In spite of the long-standing tradition of building digital machines in the decimal sys- tem, we must feel strongly in favor of the binary system for our device.”

nat-In their paper, von Neumann, Burks, and Goldstein also consider the possibility

of a computing device that uses binary-coded decimal numbers However, theidea is discarded in favor of a pure binary encoding The argument is that binarynumbers are more compact than binary-coded decimals Later in this book youwill see that binary-coded decimal numbers (called BCD) are used today in sometypes of computer calculations

The use of the binary number system in digital calculators and computers wasmade possible by previous research on number systems and on numerical repre-sentations, starting with an article by G.W Leibniz published in Paris in 1703 Re-searchers concluded that it is possible to count and perform arithmetic

Trang 34

operations using any set of symbols as long as the set contains at least two symbols,one of which must be zero.

In digital electronics the binary symbol 1 is equated with the electronic state ON,and the binary symbol 0 with the state OFF The two symbols of the binary systemcan also represent conducting and non-conducting states, positive or negative, orany other bi-valued condition It was the binary system that presented theHindu-Arabic decimal number system with the first challenge in 800 years In digi-tal-electronics two steady states are easier to implement and more reliable than aten-digit encoding

1.1.2 Positional Characteristics

All modern number systems, including the decimal, the hexadecimal, and the binarysystems, are positional It is the positional feature that is used to determine the totalvalue of a multi-digit representation For example, the digits in the decimal number

4359 have the following positional weights:

9 ——— 9 unit

In any positional number system the weight of each column is determined by the total

number of symbols in the set, including zero This is called the base or radix of the

sys-tem The base of the decimal system is 10, the base of the binary system is 2, and the

base of the hexadecimal system is 16 The positional value or weight (P) of a digit in a

multi digit number is determined by the formula

P= ×d B c

where d is the digit, B is the base or radix, and c is the zero-based column number,starting from right to left Notice that the increase in column weight from right to left ispurely conventional You could easily conceive a number system in which the columnweights increase in the opposite direction In fact, in the original Hindu notation themost significant digit was placed at the right

Trang 35

In radix-positional terms a decimal number can be expressed as a sum of digitsexpressed by the formula

The summation formula for a binary radix, positional representation is as lows

fol-where i is the system’s range and n is its limit.

1.2 Types of Numbers

By the adoption of special representations for different types of numbers the ness of a positional number system can be extended beyond the simple countingfunction

useful-1.2.1 Whole Numbers

The digits of a number system, called the positive integers or natural numbers, are

an ordered set of symbols The notion of an ordered set means that the numericalsymbols are assigned a predetermined sequence A positional system of numbersalso requires a special digit, named zero The special symbol 0, by itself, representsthe absence of oneness, or nothing, and thus is not included in the set of naturalnumbers However, 0 assumes a cardinal function when it is combined with otherdigits, for instance, 10 or 30 The whole numbers are the set of natural numbers, in-cluding the number zero

1.2.2 Signed Numbers

A number system also represents direction We generally use the + and – signs torepresent opposite numerical directions The typical illustration for a set of signednumbers is as follows:

-9 -8 -7 -6 -5 -4 -3 -2 -1 0 +1 +2 +3 +4 +5 +6 +7 +8 +9

negative numbers <— zero —> positive numbers

The number zero, which separates the positive and the negative numbers, has

no sign of its own Although in some binary encodings, which are discussed later

in this book, we end up with a negative and a positive zero

1.2.3 Rational and Irrational Numbers

A number system also represents parts of a whole For example, when a carpentercuts one board into two boards of equal length we can represent the result with thefraction ½; the fraction ½ represents 1 of the two parts which make up the object

0

2 for 0 or 1

n i

Trang 36

Rational numbersare those expressed as a ratio of two integers, for example, 1/2, 2/3,

5/248 Note that this use of the word rational is related to the mathematical concept of

a ratio, not to reason

The denominator of a rational number expresses the number of potential parts Inthis sense 2/5 indicates two of five possible parts There is no reason why the num-ber 1 cannot be used to indicate the number of potential parts, for example 2/1,

128/1 In this case the ratio x/1 indicates x elements of an undivided part Therefore,

it follows that x/1 = x The implication is that the set of rational numbers includes

the integers, since an integer can be expressed as a ratio by using a unit tor

denomina-But not all non-integer numbers can be written as an exact ratio of two integers

The discovery of the first irrational number is usually associated with the

investi-gation of a right triangle by the Greek mathematician Pythagoras (approximately

600 BC) Here again, irrational refers to not-a-ratio, not to “unreasonable.” The thagorean theorem states that in any right triangle the square of the longest side (hy-potenuse) is equal to the sum of the squares of the other two sides

Py-For this triangle, the Pythagorean theorem states that

1.2.4 Real and Complex Numbers

The set of numbers that includes the natural numbers, the whole numbers, and the

ra-tional and irrara-tional numbers is called the real numbers Most common mathematical

problems are solved using real numbers However, during the investigation of squaresand roots we notice the following interesting peculiarity

a = 1

b = 1 c

Trang 37

+2 * +2 = 4 -2 * -2 = 4

Since the square of a positive number is positive and the square of a negativenumber is also positive, there can be no real number whose square is negative.Therefore, √–2 and √–4 do not exist in the real number system But mathemati-cians of the 18th century extended the number system to include operations with

roots of negative numbers They defined the imaginary unit as

i 2

= -1

or, i = √-1

This gives rise to a new set of numbers, called complex numbers, that consist

of a real part and an imaginary part One of the uses of complex numbers is infinding the solution of a quadratic equation Complex numbers are also useful invector analysis, graphics, and in solving many engineering, scientific, and mathe-matical problems

1.3 Radix Representations

The radix of a number system is the number of symbols in the set, including zero In

this manner, the radix of the decimal system is 10, and the radix of the binary system

is 2 For certain applications, the decimal system is not ideal Computing machinesare based on electronic circuits that can be in one of two stable states Therefore, anumber system based on two symbols is better suited for computer work, sinceeach state can be represented by a digit

1.3.1 Decimal Versus Binary Numbers

The binary system of numbers uses only two symbols, 1 and 0 It is the simplest sible set of symbols with which we can count and perform arithmetic Most of thedifficulties in learning and using the binary system is a result of this simplicity Fig-ure 1.1 shows sixteen groups of four electronic cells each in all possible combina-tions of two states

pos-Figure 1.1 Electronic Cells and Binary Numbers

Trang 38

Note that the representation in binary numbers matches the physical state ofeach electronic cell If we think of each cell as a miniature light bulb, then the binarynumber 1 can be used to represent the state of a charged cell (light ON) and the bi-nary number 0 to represent the state of an uncharged cell (light OFF).

1.3.2 Octal and Hexadecimal Numbers

Binary numbers are convenient in digital-electronics; however, one of their backs is the number of symbols required to encode a large value For example, thenumber 9134 is represented in four decimal digits However, the binary equivalent

draw-10001110101110 requires 14 digits By the same token, large binary numbers are cult to remember

diffi-One possible way of compensating for these limitations of binary numbers is touse individual symbols to represent groups of binary digits For example, a group ofthree binary numbers allow eight possible combinations In this case we can use thedecimal digits 0 to 7 to represent each possible combination of three binary digits.This grouping of three binary digits gives rise to the octal number system, shown inthe following table:

bi-Hexadecimal numbers (base 16) are used for representing values encoded in fourbinary digits Since there are only ten decimal digits, the hexadecimal system bor-rows the first six letters of the alphabet (A, B, C, D, E, and F) The result is a set ofsixteen symbols, as follows:

Trang 39

Most modern computers are designed with memory cells, registers, and datapaths in multiples of four binary digits Table 1.2 lists some common units ofmemory storage.

Table 1.2

Units of Memory Storage

UNIT BITS HEX DIGITS HEX RANGE

In most digital-electronic devices memory addressing is organized in multiples

of four binary digits Here again, the hexadecimal number system provides a venient way to represent addresses Table 1.3 lists some common memory ad-dressing units and their hexadecimal and decimal range

con-Table 1.3

Units of Memory Addressing

UNIT DATA PATH ADDRESS RANGE

IN BITS DECIMAL HEXADECIMAL

1.4 General Theory of Counting

Mathematics originates in our intuitive sense of oneness If you could not guish between one object and two objects, as a characteristic unrelated to the prop-erties of the objects themselves, you could not count Without counting there couldnot be arithmetic, algebra, or calculus Counting is an abstract process, which im-plies the following assumptions:

distin-1 The counter uses a set of symbols, which are successively assigned to the units beingcounted

2 There must be a first symbol in this set The counting process always begins with thissymbol

3 The remaining symbols in the set must be ordered; 2 follows 1, 3 follows 2, and soforth

4 The set of symbols must be finite: there is a last symbol in the set

Trang 40

Usually counting proceeds beyond the last symbol of the set If not, we could onlycount up to nine units in the decimal system Counting beyond the last symbol in the

set requires additional rules One counting scheme, known as the positional tem, aligns the digits in columns that are assigned different weights In this scheme

sys-a specisys-al digit nsys-amed zero is used sys-as sys-a plsys-ace-holder Counting in sys-a zero-bsys-ased

posi-tional implies the following addiposi-tional rule:

5 There is a special symbol, called zero, which by itself represents no units

Counting starts with the first symbol of the set and proceeds along the set of bols until the last symbol of the set In the decimal system we count

sym-1 2 3 4 5 6 7 8 9

We can continue counting, past the last symbol of the set, using the properties of

a positional, zero-based system If column weight increases from right to left (as isthe case in our common systems) we count past the last symbol in the set by settingthe right-most column to zero, then bumping the column to the left to the next sym-bol of the set According to this scheme, the number following 9 is 10

Because we are so familiar with decimal counting, these rules may appear trivial.However, the rules apply to any zero-based positional system, such as binary, octal,

or hexadecimal Counting in binary has the peculiarity that the first symbol of theset (1) is also the last symbol of the set The rules of counting can be applied to anynumber system, for example:

The first unit is represented with the first symbol of the set

binary decimal octal hexadecimal

We proceed along the set of symbols until we reach the last symbol of the set

binary decimal octal hexadecimal

Ngày đăng: 05/03/2014, 19:20

TỪ KHÓA LIÊN QUAN