New Mexico Computer Science For All Booleans and Logic Maureen Psaila-Dombrowski.

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

Computer Science 210 Computer Organization Introduction to Logic Circuits.
INTRODUCTION LOGICAL OPERATIONS TRUTH TABLE AND RULES.
Selection Structures Tonga Institute of Higher Education.
Data Storage – Part 1 CS 1 Introduction to Computers and Computer Technology Rick Graziani Fall 2013.
Chapter 4 Logic Gates and Boolean Algebra. Introduction Logic gates are the actual physical implementations of the logical operators. These gates form.
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.
New Mexico Computer Science For All Statements and Expressions in NetLogo Maureen Psaila-Dombrowski.
CSci 125 Lecture 10 Martin van Bommel. Simple Statements Expression followed by semicolon Assignments total = n1 + n2; Function calls printf(”Hello.\n”);
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Chapter 2: Binary Logic.
Logic gates & Boolean Algebra. Introduction Certain components (called logic elements) of the computer combine electric pulses using a set of rules. Electric.
CSC 107 – Programming For Science. Follow-Up From Last Lecture.
Lecture 7 Topics –Boolean Algebra 1. Logic and Bits Operation Computers represent information by bit A bit has two possible values, namely zero and one.
 In studying digital integrated circuits, one must start with the simplest group of circuit, the SSIs or Small Scale Integrated Circuits. Since these.
Selection Structures Tonga Institute of Higher Education.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
Selection Boolean What is Boolean ? Boolean is a set with only two values : –true –false true and false are standard identifiers in Pascal, called Boolean.
CSC 107 – Programming For Science. Announcements.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /05/2013 Lecture 4: Basics of Logic Design Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
Logic Gates Shashidhara H S Dept. of ISE MSRIT. Basic Logic Design and Boolean Algebra GATES = basic digital building blocks which correspond to and perform.
Boolean Algebra & Logic Prepared by Dr P Marais (Modified by D Burford)
CSC 107 – Programming For Science. George Boole  Mathematician from English middle-class  Lived from 1815 – 1864  Started work at age 16 as a teaching.
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
CONTROL FLOW The order in which blocks are executed is called the “control flow” of the script So far all our scripts have just executed blocks in the.
IB Computer Science – Logic
Figure 2.6. A truth table for the AND and OR operations. 2.3 Truth Tables 1.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
8. DECISION STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
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.
Selection Part 2 Using Logical Operators, how strings are compared and random numbers.
Types, Truth, and Expressions Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Logic gates.
Computer Architecture & Operations I
Computer Architecture & Operations I
Boolean Algebra & Logic Gates
CPS120 Introduction to Computer Science
GCSE OCR Computing A451 Binary logic Computing hardware 6.
Morgan Kaufmann Publishers
Logic Gates and Boolean Algebra
Computer Science 210 Computer Organization
Section 7.1 Logical Operators
Basic Logical Operations (Fascinating)
Digital Signals Digital Signals have two basic states:
JavaScript conditional
Aberdeen Grammar School
Introduction To Robot Decision Making
Computer Science 210 Computer Organization
JavaScript conditional
Computers & Programming Languages
Dr. Clincy Professor of CS
Relational Operators Operator Meaning < Less than > Greater than
Computer Science 210 Computer Organization
CS Chapter 3 (3A and ) Part 3 of 8
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.
CS Chapter 3 (3A and ) – Part 2 of 5
Introduction to Decision Structures and Boolean Variables
Introduction To Robot Decision Making
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
JavaScript conditional
Relational Operators.
Truth tables Mrs. Palmer.
Topics discussed in this section:
Digital Logic Design Basics Combinational Circuits Sequential Circuits.
DIGITAL ELECTRONICS AND LOGIC GATES. ANALOG SIGNAL:- Analog signal is continuous time varying current or voltage signal.
boolean Expressions Relational, Equality, and Logical Operators
Conditionals.
Presentation transcript:

New Mexico Computer Science For All Booleans and Logic Maureen Psaila-Dombrowski

Boolean Boolean - EASY  Can have one of two values ▫true or false ▫on or off ▫1 or 0 Boolean Expressions  Evaluate to be true or false Boolean Operators  Operators that are used with Booleans Boolean Math/Algebra or Boolean Logic  Uses Booleans and Boolean operators  Used in computers

Boolean Expressions A simple use of Boolean concept Expressions that evaluate to True or False They use comparison operators (=,, =)  Compare two sides – numbers, variables, expressions  Ask a specific question – Is the expression TRUE or FALSE ? You have used them in math before = ? Addition  = 37 ? Boolean  true = 40 ? Boolean  false

Boolean Expressions (continued) Expression (Comparison Operator) Question Asked L=RThe left equals the right, True or False? 3 + 5= equals 8, True or False?  TRUE L<RThe left is less than the right, True or False? 16/4<316/4 is less than 3, True or False?  FALSE L>RThe left is greater than the right, True or False? 50*100>50050*100 is greater than 500, True or False?  TRUE

Boolean Operators Three basic ones: AND, OR, NOT  Most other operators are based on these Compares Boolean values or expressions or change them Evaluates to a Boolean (True or False, On or Off, 1 or 0) Rules for each operator are different Boolean Value Or Expression (True or False) Boolean Operator Boolean Value Or Expression (True or False) Boolean Value (True or False)

Boolean Logic Also know as Boolean Algebra or Boolean Math What is it? ▫Only two values. ▫The Math of comparing and manipulating Booleans So what? ▫Most important principle of modern computers. Developed in the 1850s by George Boole ▫A founder of computer science

Boolean Logic Expression: A AND B For A AND B to be true BOTH A AND B must be true (Both Sides Must Be True) AND Truth Table: Boolean Logic (continued) AND A Boolean Expression Boolean Operator B Boolean Expression Evaluates to TRUEANDTRUE ANDFALSE ANDTRUEFALSE ANDFALSE

Boolean Logic Lets look at an example: Marbles

Boolean Logic Lets look at an example: Marbles Blue? = false Red? = true Marble? = true Blue? = false Red? = true Marble? = true

Boolean Logic We can group the marbles: Is there a set of Marble? = true Marble? = true

Boolean Logic Blue? = true Red? = true We can also group the marbles: The marble is Blue? = true ? The marble is Red? = true ?

Boolean Logic Blue? = true Red? = true Is there a set: (Marble? = true) AND (Blue? = true) is true Is there a set: (Blue? = true) AND (Red? = true) is true?

Blue? = true Red? = true Boolean Logic Find the set with (Blue? = true) AND (Red? = true) Find the set with (Blue? = true) AND (Green? = true) Find the set with (Purple? = true) AND (Green? = true)

For A OR B to be true EITHER A OR B can be true (Only One Side Needs to be True) OR Truth Table: Boolean Logic (continued) OR A Boolean Expression Boolean Operator B Boolean Expression Evaluates to TRUEORTRUE ORFALSETRUE FALSEORTRUE FALSEORFALSE

Blue? = true Red? = true Find the set with (Blue? = true) OR (Red? = true) Boolean Logic (continued)

Find the set with (Blue? = true) OR (Red? = true) Find the set with (Blue? = true) OR (Green? = true) Find the set with (Purple? = true) OR (Green? = true) Boolean Logic (continued)

NOT Boolean Operator Boolean Expression Evaluates to NOTTRUEFALSE NOTFALSETRUE NOT is really easy – it just gives you the opposite value

Blue? = true Red? = true Find the set with (NOT Blue? = true) Find the set with (NOT Red? = true) Find the set with (NOT Purple? = true) Boolean Logic (continued)

Find the set with (NOT Red? = true) Find the set with (NOT Blue? = true) Find the set with (NOT Purple? = true) Boolean Logic (continued)

Order of Operation 1.Parenthesis 2.NOT 3.AND 4.OR Examples: NOT true AND true  false AND true  FALSE NOT ( false AND true )  NOT false  TRUE true OR false AND true  true OR false  TRUE ( true OR false ) AND true  true AND true  TRUE Boolean Logic (continued)

Booleans in Computer Science Search Engines (Average User) ▫Use Boolean Logic to limit: AND, OR, NOT ▫Boolean Order of Operations holds Conditionals (Programmer) ▫Boolean Expressions and Boolean Logic ▫Used in Conditionals

Booleans in Computer Science Digital Gates (Boolean Gates) in Chips/Circuits (Hardware Engineer) ▫Fundamental building block of a computer ▫Uses Booleans  True and False  1’s and 0’s ▫Boolean Logic  To figure out if gate is open/closed

Summary Booleans can have only two values Boolean expressions  Use comparison operators (=, )  Evaluate to TRUE or FALSE Boolean Operators  Three Basic Operators: AND, OR, NOT  Compare Boolean values/expressions or change them  Evaluate to TRUE or FALSE Boolean Logic Use Boolean Operators: AND, OR, NOT The math of comparing and manipulating Booleans. Order of Operation: ( ), NOT, AND, OR