CPS120 Introduction to Computer Science

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Logic Gates.
CT455: Computer Organization Logic gate
Computer Science 210 Computer Organization Introduction to Logic Circuits.
Programmable Logic Controllers.
Computer Systems 1 Fundamentals of Computing
INTRODUCTION LOGICAL OPERATIONS TRUTH TABLE AND RULES.
1 4. Computer Maths and Logic 4.2 Boolean Logic Boolean Operators.
Boolean Algebra and Logic Gate
10/22/2004EE 42 fall 2004 lecture 221 Lecture #22 Truth tables and gates This week: Circuits for digital devices.
Chapter 4 Logic Gates and Boolean Algebra. Introduction Logic gates are the actual physical implementations of the logical operators. These gates form.
Logic Gates Circuits to manipulate 0’s and 1’s. 0’s and 1’s used for numbers Also to make decisions within the computer. In that context, 1 corresponds.
Computer Science 101 Boolean Algebra. What’s next? A new type of algebra – Helps us A new type of algebra – Helps us With logical reasoningWith logical.
22C:19 Discrete Math Boolean Algebra & Digital Logic Fall 2010 Sukumar Ghosh.
Digital Logic Circuits – Chapter 1 Section 1-3, 1-2.
Logical Circuit Design Week 5: Combinational Logic Circuits Mentor Hamiti, MSc Office ,
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
Today’s Agenda 1.Research Paper –Rough draft due Mon, Feb. 11 –Peer edit session on Wed, Feb. 13 –Final version due Wed, Feb. 20 –Oral presentation Tues,
CPS120: Introduction to Computer Science Decision Making in Programs.
 In studying digital integrated circuits, one must start with the simplest group of circuit, the SSIs or Small Scale Integrated Circuits. Since these.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
D75P 34R - HNC Computer Architecture Week 6 Boolean Logic © C Nyssen/Aberdeen College 2004 All images © C Nyssen /Aberdeen College unless otherwise stated.
CPS120: Introduction to Computer Science Operations Lecture 9.
A-Level Computing#BristolMet Session Objectives#6 MUST understand and produce simple logic diagrams using the operations NOT, AND and OR SHOULD explain.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
CPS120: Introduction to Computer Science Decision Making in Programs.
CPS120: Introduction to Computer Science Decision Making in Programs.
BOOLEAN ALGEBRA LOGIC GATES. Introduction British mathematician George Boole( ) was successful in finding the link between logic and mathematics.
Logic Simplification-Using Boolean Laws Logic Design Laboratory EE 2121 Lectures By Manesh T EE2121-In Charge
DIGITAL ELECTRONICS. Everything in digital world is based on binary system. Numerically it involves only two symbols 0 or 1. –0 = False = No –1 = True.
CPS120: Introduction to Computer Science Session 5.
NAND, NOR, and EXOR (more primitive logical gates) CS Computer Architecture David Mayer.
Logic Gates and Boolean Algebra Introduction to Logic II.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Boolean Algebra. LO:  Understand why Boolean algebra is used  Understand basic Boolean algebra notation  Understand why Boolean algebra is used  Understand.
Types, Truth, and Expressions Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Computer Programming Boolean Logic.
Logic gates.
Morgan Kaufmann Publishers
Computer Code.
Logic Gates and Boolean Algebra
Computer Science 210 Computer Organization
CS Chapter 3 (3A and ) Part 1 of 8
Bool operators and, or, not
A mechanism for deciding whether an action should be taken
Logic Gates.
CS Chapter 3 (3A and ) Part 1 of 8
Basic Logical Operations (Fascinating)
4-1 LOGIC OPERATIONS In Chapter 3 we discussed the fact that data inside a computer is stored as patterns of bits. Logic operations refer to those operations.
University of Gujrat Department of Computer Science
Aberdeen Grammar School
Introduction To Robot Decision Making
Computer Science 210 Computer Organization
Agenda – 2/12/18 Questions? Readings: CSI 4, P
Computer Science 210 Computer Organization
Dr. Clincy Professor of CS
Logic Gates.
Boolean Logic Boolean Logic is considered to be the basic of digital electronics. We know that a computer’s most basic operation is based on digital electronics.
GCSE Computer Science – Logic Gates & Boolean Expressions
Introduction To Robot Decision Making
ECB2212-Digital Electronics Boolean algebra
Chapter 4 Gates and Circuits.
Some basic electronics and truth tables
XOR Function Logic Symbol  Description  Truth Table 
Truth tables Mrs. Palmer.
Digital Logic Design Basics Combinational Circuits Sequential Circuits.
Computer Programming Boolean Logic Trade & Industrial Education
Conditionals.
Types, Truth, and Expressions
Presentation transcript:

CPS120 Introduction to Computer Science Boolean Logic

Decision Making In Computers A circuit quite simply allows one out of two choices to be made depending on its inputs When decisions are made in a computer program, they are simply the result of a computation in which the final result is either TRUE or FALSE The value zero (0) is considered to be FALSE. Any positive or negative value is considered to be TRUE (usually represented by 1)

Using Logical Operators When complex decisions must be coded into an algorithm, it may be necessary to "chain together" a few relational expressions (that use relational operators) This is done with logical operators (also called Boolean operators.) && is the logical AND operator || is the logical OR operator ! is the logical NOT operator

Boolean Logic The term Boolean or simply BOOL is named for a 19th century mathematician named George Boole. Boole is recognized for applying concepts of algebra to human logic. Boole moved concepts of human thought process away from the metaphysical or abstract logic of Aristotle to more tangible mathematical principles.

I Know This Concept If you have ever taken a True or False test, you have used Boolean logic. In the Boolean system an object can exist in only one of two states, there is no third choice This is a central concept in programming.

What are the different Boolean Operators? Depending on code being used the operators come with different names and use. Some languages support more Boolean Operators, some less. There are some basic standard operators. The result of any Boolean operation should be a TRUE or FALSE

AND Two or more items must agree (be evaluated to the same result) for the expression to be true. 1 AND 1 would evaluate to TRUE 0 AND 1 would evaluate to FALSE 1 AND 0 would evaluate to FALSE 0 AND 0 would evaluate to FALSE 1 AND 1 AND 1 would evaluate to TRUE 1 AND 1 AND 0 would evaluate to FALSE

OR One, both or more items must agree. If both inputs are FALSE, the result it FALSE. 1 OR 1 would evaluate to TRUE 0 OR 1 would evaluate to TRUE 0 OR 0 would evaluate to FALSE

NOT Reverses the input. If TRUE is input, the result id FALSE; if FALSE is input, the result is TRUE. 1 would evaluate to FALSE 0 would evaluate to TRUE

XOR (eXclusive OR) Only one input may be TRUE, if both are TRUE the entire result id FALSE. 1 XOR 1 would evaluate to FALSE 1 XOR 0 would evaluate to TRUE 0 XOR 1 would evaluate to TRUE 0 XOR 0 would evaluate to FALSE

NAND (Not AND) This basically negates AND: 1 NAND 1 would evaluate to FALSE 1 NAND 0 would evaluate to TRUE 0 NAND 0 would evaluate to TRUE 0 NAND 1 would evaluate to TRUE

Truth Tables Use this truth table to determine the results of the logical operators. In this table, 1 represents TRUE and 0 represents FALSE. Note that the ! symbol (the logical NOT operator) changes a TRUE to a FALSE. AND OR NOT A B A && B A || B !A 1 1 1 1 1 1 1 1 1