44
Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Embed Size (px)

Citation preview

Page 1: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Copyright © 2012 Pearson Education, Inc.

Chapter 1

INTRODUCTION

TO COMPUTING

AND ENGINEERING

PROBLEM SOLVING

Page 2: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Copyright © 2012 Pearson Education, Inc.

Outline

Objectives

1.Historical Perspective

2.Recent Engineering Achievements

3.Computing Systems

4.Data Representation and Storage

5.An Engineering Problem-Solving Methodology

Page 3: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Copyright © 2012 Pearson Education, Inc.

Objectives

Introduce computing and engineering problem solving, including:

• A brief history

• Recent engineering achievements

• A discussion of Numbering Systems

• A discussion of hardware and software

• A five-step problem-solving methodology

Page 4: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Historical Perspective

Copyright © 2012 Pearson Education, Inc.

Charles Babbage, (1792-1871, above)

designed the Analytical Engine (left) to process

decimal numbers.

Augusta Ada Byron (1815-1852, below) wrote the first computer program.

Page 5: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Charles Babbage, Esq.1792-1871

• English mathematician.

• Designed the Analytical Engine in the early 1800s.

• Published “Of the Analytical Engine” in 1864.

Copyright © 2012 Pearson Education, Inc.

Page 6: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Analytical Engine

• Designed to process base ten numbers.

• Consisted of four parts:– Storage unit– Processing unit– Input device– Output device

Copyright © 2012 Pearson Education, Inc.

Page 7: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Analytical Engine

• Luigi F. Menabrea, French engineer and mathematician, described Babbage’s vision of a machine capable of solving any problem using: – Inputs– Outputs– Programs written on punch cards

Copyright © 2012 Pearson Education, Inc.

Page 8: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Augusta Ada Byron1815-1852

• Wrote the English translation of Menabrea’s Sketch of the Analytical Engine.

• Envisioned the multidisciplinary potential of the Analytical Engine.

• Wrote detailed instructions for performing numerical computations using the Analytical Engine.

Copyright © 2012 Pearson Education, Inc.

Page 9: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Digital Computers

• ABC (Atanasoff Berry Computer)• Developed at Iowa State University between 1939

and 1942 by John Atanasoff and Clifford Berry.• Weighed 700 pounds.• Executed one instruction every 15 seconds.

Copyright © 2012 Pearson Education, Inc.

Page 10: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Digital Computers

• ENIAC(Electronic Numerical Integrator And Calculator)

• Developed by research team lead by John Mauchly and J. Presper Eckert during the early 1940s.

• Weighed 30 tons.• Executed hundreds of instructions every second.

Copyright © 2012 Pearson Education, Inc.

Page 11: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

ENIAC vs. Intel Pentium 4

Copyright © 2012 Pearson Education, Inc.

ENIAC executes hundreds of operations per second (30 tons)

Today’s processors execute trillions of operations per second and weigh ounces.

Page 12: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Recent Engineering Achievements

Copyright © 2012 Pearson Education, Inc. Image credits: NASA/JPL/Malin Space Science Systems.

Page 13: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Recent Engineering Achievements

• Extraterrestrial Explorations– First manned lunar

landing (July 21, 1969)– Mars Global Surveyor,

Mars Reconnaissance Orbiter, and Mars Exploration Rovers

• Terrestrial Application Satellites

• Computer Axial Tomography (CAT) Scanners

• Computer simulations• Advanced composite

materials.• Speech understanding• Weather, climate, and

global change predictionCopyright © 2012 Pearson Education, Inc.

Page 14: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Recent Engineering Achievements

• Digital computers facilitate multidisciplinary engineering achievements that:– Improve our lives.– Expanded the

possibilities for our future.

• Changing engineering environment requires engineers with:– Communication skills.– Skills for working in

interdisciplinary teams.– An awareness of ethic

issues and environmental concerns.

– A global perspective.

Copyright © 2012 Pearson Education, Inc.

Page 15: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Computing Systems

Copyright © 2012 Pearson Education, Inc.

The von Neumann Computing Model

Page 16: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Computing Systems

• A computing system is a complete working system that includes:– Hardware– Software

Copyright © 2012 Pearson Education, Inc.

Page 17: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Hardware

Hardware refers to the physical parts off the computing system that have mass (i.e. they can actually be touched):

– Computer– Display– Mouse– Printer– …

Copyright © 2012 Pearson Education, Inc.

Page 18: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Hardware

Jon von Neumann computing model– Input device(s)– Output device(s)– Memory Unit– CPU (Central Processing

Unit) consisting of:• Control Unit• ALU (Arithmetic Logic Unit)

Copyright © 2012 Pearson Education, Inc.

Page 19: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Software Interface to Computer Hardware

Copyright © 2012 Pearson Education, Inc.

Page 20: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Software

Computer software refers to programs that reside and execute electronically on the hardware.

– Compilers– Translate source code

– Operating systems– Provide the HCI (Human Computer Interface)

– Application programs– Provide problem solutions

Copyright © 2012 Pearson Education, Inc.

Page 21: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Building a Program

• Computers only understand machine language. High-level languages like C++ must be translated to machine language for execution.

Copyright © 2012 Pearson Education, Inc.

Page 22: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Key Terms

• Source Program– printable/Readable Program file

• Object Program– nonprintable machine readable file

• Executable Program– nonprintable executable code

Copyright © 2012 Pearson Education, Inc.

Page 23: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Errors in Programs

• Syntax/Parse Errors– Mistakes with the language.– Always reported by the compiler

• Linking Errors– Missing pieces prevent the final assembly of an

executable program.

• Run-time Errors– Occur when program is executing.– May or may not be reported.

Copyright © 2012 Pearson Education, Inc.

Page 24: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Logic Errors

• Can be difficult to find.

• Debugging can be time consuming.– Better tools for find bugs

• It is important to carefully check the output of your programs for errors.– Even programs that appear to work correctly

may have bugs!

Copyright © 2012 Pearson Education, Inc.

Page 25: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Debugging

• Process of eliminating logic errors(i.e. bugs) from programs.

• User-friendly programming environments such as Microsoft Visual C++ integrate the compiler with – text processors and code editors– special tools to help find bugs in programs (debugger)– testing tools– and much more…

Copyright © 2012 Pearson Education, Inc.

Page 26: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Representationand Storage

00110101001001001010101111101110

10101011111011100011010100100100

11000110110101011111001001001010

10101011111101001001000101110001

00100110111110101010001101010011

01001001001010101111101110001101

10100001101010010010111010011111Copyright © 2012 Pearson Education, Inc.

Page 27: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Representationand Storage

• Digital computers store information as a sequence of bits (binary digits).

• The value or state of a bit at any given time can be 0 or 1 (off or on).

• Data is stored as a sequence of bytes. – A byte is a sequence of 8 bits.

Copyright © 2012 Pearson Education, Inc.

Page 28: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Memory Diagram

Address Space = 8

Word Size = 16

Copyright © 2012 Pearson Education, Inc.

Address Sixteen Bit Word

000 0000101011011101

001 1010001011010100

010 1011010010100101

011 0101001101010101

010 0101000111001110

010 1100110000111010

110 0100011101001001

111 0101110001001000

Page 29: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Representation

• Right most bit is referred to as the least significant bit.

• Left most bit is referred to as the most significant bit.

• Value stored at address 000 is 00001010110111012 = 278110 But what does

it represent?

Copyright © 2012 Pearson Education, Inc.

Page 30: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Numbering Systems

• Base ten number system• Ten decimal digits (0,1,2,3,4,5,6,7,8,9)• Each digit multiplies a power of ten

– Example:

Copyright © 2012 Pearson Education, Inc.

24510 = 2*102 + 4*101 + 5*100

Page 31: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Numbering Systems• Base two (binary) number system

• Two binary digits (0,1)• Each digit multiplies a power of two

– Example:

Copyright © 2012 Pearson Education, Inc.

101102 = 1*24 + 0*23 + 1*22 + 1*21 + 0*20

= 1*16 + 0*8 + 1*4 + 1*2 + 0*1 = 16 + 0 + 4 + 2 + 0 = 2210

Page 32: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Numbering Systems

• Base eight number system• Eight octal digits (0,1,2,3,4,5,6,7)• Each digit multiplies a power of eight

– Example:

Copyright © 2012 Pearson Education, Inc.

2458 = 2*82 + 4*81 + 5*80

= 2*64 + 4*8 + 5*1 = 128 + 32 + 5 = 1658

Page 33: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Numbering Systems

• Base sixteen number system• Sixteen hex digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)• Each digit multiplies a power of sixteen

– Example:

Copyright © 2012 Pearson Education, Inc.

2FB16 = 2*162 + F*161 + B*160

= 2*256 + F*16 + B*1 = 512 + 240 + 11 = 76310

Page 34: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Practice with Number Systems

1002 = ?8

37168 = ?2

1101001112 = ?10

3A1B16 = ?2

Copyright © 2012 Pearson Education, Inc.

Page 35: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Practice with Number Systems

1002 = 48

37168 = 011 111 001 1102

1101001112 = 42310

3A1B16 = 0011 1010 0001 10112

Copyright © 2012 Pearson Education, Inc.

Page 36: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Types

• Integer Data Type:– Often represented in 4 bytes (System

Dependent)– Left most bit is reserved for the sign of the

number– Remaining 31 bits represent the magnitude

of the number.

Copyright © 2012 Pearson Education, Inc.

Page 37: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Types

• Representation of data affects the efficiency of arithmetic and logic operations.

• For efficiency, negative integers are often represented in their 2’s complement form.

• The 2’s complement of an integer is formed by negating all of the bits and adding one.

Copyright © 2012 Pearson Education, Inc.

Page 38: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Two’s Complement

• Form the 2’s complement representation for the value -12710 assuming a word size of 8 bits for simplicity.12710 = 011111112

Negate bits: 10000000

Add 1: 10000001

• 2’s complement is 1000 00012

Copyright © 2012 Pearson Education, Inc.

Page 39: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Two’s Complement

• Add 12710 to -12710

Copyright © 2012 Pearson Education, Inc.

011111112 12710

+ 100000012 + -12710

= 000000002 = 010

Page 40: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Data Types

• Floating Point Data– Floating point types represent real numbers,

such as 1.25, that include a decimal point.– Digits to the right of the decimal point form the

fractional part of the number.– Digits to the left of the decimal point form the

integral part of the number.

Copyright © 2012 Pearson Education, Inc.

Page 41: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Practice with Decimals

Convert 12.2510 to binary.

Copyright © 2012 Pearson Education, Inc.

Page 42: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Practice with Decimals

Convert 12.2510 to binary.

First convert the integer part:

1210=11002

Then repeatedly multiply the fractional part by 2:

.25*2=0.5C0

.50*2=1.0C1

Therefore:

12.2510 =1100.012

Copyright © 2012 Pearson Education, Inc.

Page 43: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Engineering Problem-Solving

Methodology

Copyright © 2012 Pearson Education, Inc.

Page 44: Copyright © 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Five Step Problem-Solving

Methodology

1. State the problem clearly.

2. Describe the input and output.

3. Work a hand example.

4. Develop a solution.

5. Test your solution.Copyright © 2012 Pearson Education, Inc.