CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

35
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers

Transcript of CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Page 1: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

CMPF144FUNDAMENTALS OF COMPUTING THEORY

Module 2: Abilities of Computers

Page 2: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 2

Objectives

Present an overview of the abilities of computers.Present an overview on the intelligence of computersPresent the concepts of Boolean approach and their impact on computer abilitiesPresent the concepts of yes /no tree

Page 3: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 3

Basic Computer Abilities

Read and write

Arithmetic

Process

Communication

Store data

Page 4: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 4

Examples on using computer

Document preparation Communication Industry

Banking and Finance

Retailing

Modelling /Simulation

Page 5: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 5

Computer Intelligence

Definition of IntelligenceReferring to Oxford Dictionary, Intelligent is understanding or quickness of understanding.

o Another definition:- is the computational part of the ability to

achieve goals in the world. Computer Intelligence means computer that

can be programmed to perform intelligence tasks that do not necessarily required any independent thinking.

Page 6: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 6

Computer Intelligence (cont.)

Intelligence varies among people, animals and machines (computers)

People reading/learning/natural

Animals training/natural

Computers ??

Page 7: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 7

How to determine the intelligence

According to De Silva, an intelligent system possesses one or more of the following characteristics and capabilities.

  Sensory perception

   Pattern recognition

   Learning and knowledge acquisition

   Inference from incomplete information

  Ability to deal with unfamiliar situations

   Common sense

   Inductive reasoning

  Inventiveness

  Display of emotions

Page 8: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 8

Continue..

Computer program operate using algorithms step by step to generate solutionsThe Turing Test is used as a gauge to determine whether or not an artificially intelligent being is intelligent or not. If the machine could successfully pretend to be human to a knowledgeable observer then you certainly should consider it intelligent. The Turing test is a one-sided test. A machine that passes the test should certainly be considered intelligent

Page 9: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 9

Example

Develop an algorithm for a robot/computer to cross the road at the zebra crossing with traffic light

Page 10: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 10

Boolean Logic

Has two values, True and False (Binary: 1 and 0, Electronic/Electrical: 5V and 0V) Three basic logics/operators;

AND,OR,NOTVenn diagrams can be used to illustrate the concepts of Boolean

Page 11: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 11

Examples

The diagram below shows the documents that the information is about Apple and Banana . Some documents, the ‘A’ region, having information about Apple only, some documents, the ‘B’ region having information about Banana only, while the C region is having both information on Apple and Banana.

BC Banana

A

Apple

Page 12: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 12

AND

AND means "I want only documents that contain both information on Apple and Banana."

Document that has both words ‘Apple’ and ‘Banana’ can be found under ‘C’ region.Diagram below shows the result.

BC Banana

A

AppleApple+

Banana

Page 13: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 13

OR OR means "I want documents that contain either information on Apple or Banana”, either one not both. In diagram 3 below, the information can be from ‘A‘ region or ‘B’ region.

A

Apple

B

Banana

Page 14: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 14

NOT

NOT means, “ I want document that contains information on Apple only, not Banana”.

In the diagram 4 below, the documents only can be found on ‘A’ region.

A

Apple Banana

Page 15: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 15

Mixed Boolean operation

 Boolean operators can be combined.

When combined the operators, we need to evaluate it based on order of evaluation or precedence.We can use parentheses (), in order to specify proper combination.

Page 16: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 16

Continue..

Operators Order of evaluation (precedence)

() Evaluated first. If the parentheses (), are nested the expression in the innermost pair is evaluated first.If there are several pairs of parentheses “on the same level” (not nested), they are evaluated left to right.

*, / , % Evaluated second.If there are several, they are evaluated left to right.

 

+, -Evaluated last.If there are several, they are evaluated left to right. 

Page 17: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 17

Continue…

•Cats AND (Dogs OR Rabbits)

The statement in parentheses - ' Dogs OR Rabbits’ - is processed first. Followed by the rest of the sentence.

Page 18: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 18

Continue..

If parentheses were omitted,

Cats AND Dogs OR Rabbits

The AND operation should process first, since based on precedence rules, the operation will start from left to right, anyway it varies among system, some will process AND first before OR. Therefore it is very important to use parentheses when we want to specify which operation should do first.

Page 19: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 19

Continue…

Page 20: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 20

Continue…•(Dogs OR Rabbits) NOT Cats

The statement in parentheses - 'Dogs OR Rabbits ‘- is processed first. Followed by the rest of the sentence.

Page 21: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 21

Complex Logic NAND,XOR, NOR and XNOR.

•The example below is using the Boolean algebra. Two variables will be used to store the data, which are A and B, while another one variable will keep the result of the operation, determined by Q.

• Example on OR and AND operator using the Boolean algebra.

OR

If both A and B is 0, therefore the result in Q will be 0.

If either A or B is 1, therefore the result stored in Q will be 1

Page 22: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 22

AND 

AND

• In AND, if both A and B is having a value of 0, therefore the value stored in Q will be 0.

• If either one is having a value of 1 or 0, therefore the value in Q is still 0. The value in Q will only be 1 if both A and B having 1 as their value.

Page 23: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 23

Example: OR and AND

A B Q

0

0 1 1

1 0 1

1 1 1

0 0

OR AND 

0

A B Q

0 0

0 1 0

1 0 0

1 1 1

Page 24: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 24

NOR

NOR - is a combination between NOT and OR. It’s simply an inversions of OR logic.If in OR, A=0,B=0 therefore Q = 0. But as inversion of OR, the result in Q will become 1.If the result in OR is 0, in NOR it will be 1, vice versa.

A B Q

0

0 1 1

1 0 1

1 1 1

00

OR

A B Q

0 0 1

0 1 0

1 0 0

1 1 0

NOR

Page 25: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 25

NAND

NAND is a combination between NOT and AND logics. It is simply an inversion of AND logic. Example 1:  If A = 0, B=0 , using the AND operator, Q=0. However, as NAND is an inversion of AND, the answer in Q = 1. 

Page 26: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 26

Example on NAND

0

A B Q

0 0

0 1 0

1 0 0

1 1 1

AND

A B Q

0 0 1

0 1 1

1 0 1

1 1 0

NAND

Page 27: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 27

XOR and XNOR

• XOR - "exclusive or “- If either A OR B is 1, but NOT both, Q is 1.

• XNOR- "exclusive nor" - If A=0,B=0 or A=1,B=1, therefore Q =1.If either one of the operand is 0 or 1, NOT both, therefore Q will be 0.XNOR is an inversion of XOR.

Page 28: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 28

A B Q

0 0

0 1 1

1 0 1

1 1 0

Example on XOR and XNOR

0

XOR

A B Q

0 0 1

0 1 0

1 0 0

1 1 1

XNOR

Page 29: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 29

Boolean Expression.

A Boolean expression is used to construct queries that represent concepts. Boolean expressions (also known as conditions or predicates) are expressions that have two possible values - TRUE and FALSE

   Example:

2 < 5 (2 is less than 5)

Page 30: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 30

Continue…

Boolean expressions are also called comparison expressions, conditional expressions, and relational expressions

We can combine regular numeric, string and other expressions into Boolean conditions by comparing them to each other.

Page 31: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 31

Continue…

expression < expression Less than

expression > expression Greater than

expression = expression Eventually

expression != expressionexpression <> expression

Not equals

expression <= expression Less than or equals

expression >= expression Greater than or equals

Page 32: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 32

Yes/No Trees

Boolean approaches can be applied to develop a yes/no trees. The value of 1 can be represented by yes and 0 for no.

The basic idea regarding yes/no trees is to find the solutions on certain questions based on these two data, yes/no answer. The reasons is to make the students think in order to cache the right answer by provide their solution pertaining to the mention scenario.

Page 33: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 33

Example:To guess the name of animal.Question: Does it have hair?Answer: yesQuestion: can it fly?Answer: noQuestion: Does it eat meat?Answer: YesQuestion: Does it have a claw?Answer: YesQuestion: Does it have a dark spots?Answer: NoQuestion: Does it have black strips and tawny color?Answer: YesQuestion: Is it tiger?Answer: Yes. 

Page 34: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 34

Example: Yes/No tree

Exp 1

Exp 2

Exp 2.1

Exp 2.2

Exp 3

n

y

y

n

Page 35: CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 2: Abilities of Computers.

Module 2 CMPF144 Fundamentals of Computing Theory

Slide 35

Suggested Reading

Sprankle,Maureen.(2001).Problem Solving and programming Concepts.5th ed. Prentice-HallCashman Waggoner, Shelly.(2000)Discovering Computers 2000. International Thompson Publishinghttp://www.webopedia.com/TERM/B/Boolean_expression.htmlhttp://www.shx.us/_notes/source/lang.boolean.htmlhttp://ww.ee.surrey.ac.uk/Projects/Labview/boolalgebra/http://www.lib.csubak.edu/infocomp/search/boolean/venn.htm.htmhttp://www.meadjohnson.com/products/hcp-adult-med/decision8.html