Computer Programming Boolean Logic Trade & Industrial Education

Slides:



Advertisements
Similar presentations
1 Computer Programming Boolean Logic Copyright © Texas Education Agency, 2013.
Advertisements

INTRODUCTION LOGICAL OPERATIONS TRUTH TABLE AND RULES.
ALGEBRA 1 BASICS CHEAT SHEET THINGS YOU SHOULD KNOW . . .
Thirteen conditional expressions: letting programs make “decisions”
CSI 101 Elements of Computing Spring 2009 Lecture #1 – From Math to Computers Wednesday, January 21, 2009.
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2010 Hawkes Learning Systems. All rights reserved. Hawkes Learning Systems: College Algebra.
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.
Digital Logic Circuits – Chapter 1 Section 1-3, 1-2.
Logical Circuit Design Week 5: Combinational Logic Circuits Mentor Hamiti, MSc Office ,
AP Examination Alert The APCS Examination includes a variety of Boolean Logic questions. Many questions require indirect knowledge of Boolean Logic, and.
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.
Lecture 7 How computers process data (Number Systems) PRESENTED BY MD. MAHBUBUL ALAM, PHD 1.
Boolean Algebra By Lindsey Curtis & Tomas Filip. Boolean Algebra An abstract mathematical system used to describe relationships between sets Mainly used.
The Language of Algebra
By: Kenzie Ashekian & Edgar Chant. What is a linear equation? A linear equation is an algebraic equation where the goal is to get the variable by itself,
Use order of operations Evaluate algebraic expressions.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
1.4 Solving Equations ●A variable is a letter which represents an unknown number. Any letter can be used as a variable. ●An algebraic expression contains.
True, False, and Open Sentences An introduction to algebraic equations, also called open sentences.
Algebraic Expressions Unit 1-1. Key Words:  Algebraic Expression: An expression that contains at least one variable. Ex. 2x 3x 2 + 3y – 5  Like Terms:
Semester 1 Final Review Lesson 1.1 Variables in Algebra Evaluate the variable expression when x = x.
CPS120: Introduction to Computer Science Operations Lecture 9.
Chapter 1: The Language of Algebra You will learn: To use variables to represent unknown quantities Words to Learn: Variables: letters used to ______________.
CSC 107 – Programming For Science. George Boole  Mathematician from English middle-class  Lived from 1815 – 1864  Started work at age 16 as a teaching.
MM150 Unit 3 Seminar Agenda Seminar Topics Order of Operations Linear Equations in One Variable Formulas Applications of Linear Equations.
Writing & Solving Equations
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
Computer Programming Boolean Logic Trade & Industrial Education
Chapter 4 Fundamentals of Computer Logic 1 Chapter 4: Fundamental of Computer Logic - IE337.
§ 1.9 Exponents, Parentheses and Order of Operations.
Write as an Algebraic Expression The product of a number and 6 added to a.
Operators.
Logical Thinking CS 104 9/12/11. Agenda Today  College Board survey reminder  Note: Simple “how to” guide on Scratch posted on eLearning  Review HW.
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.
3 + 6a The product of a number and 6 added to 3
Math 094 Section 1.3 Exponents, Order of Operations, and Variable Expressions.
Opener: Find three consecutive odd integers whose sum is -63 Integer #1 = n Integer #2 = n + 2 Integer #3 = n + 4 (n) + (n + 2) + (n + 4) = -63 3n + 6.
Computer Programming Boolean Logic.
Logic gates.
CPS120 Introduction to Computer Science
Computer Code.
Computer Science 210 Computer Organization
Logic Gates and Boolean Algebra
Section 7.1 Logical Operators
1-5 Equations Goals: Solve equations with one variable
Order of Operations in Math
Introduction To Robot Decision Making
JavaScript conditional
Boolean Algebra Digital Electronics
Computer Science 210 Computer Organization
GCSE Computer Science – Logic Gates & Boolean Expressions
Introduction To Robot Decision Making
Evaluating Algebraic Expressions
Chapter 1 Section 1 Algebraic Expressions, Real Numbers, and Interval Notation.
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
Sec 1.1 – Order of Operations
ECS15 boolean.
Truth tables Mrs. Palmer.
Section 6.1 Order of Operations
Selection—Making Decisions
Topics discussed in this section:
Section 6.1 Order of Operations
BOOLEAN ALGEBRA.
Algebra: Variables and Expressions
5.03 Apply operators and Boolean expressions
Conditionals.
Bell Work!!! Directions: Write out the exponent in word form. 3^6 6^4
Presentation transcript:

Computer Programming Boolean Logic Trade & Industrial Education Copyright © Texas Education Agency, 2013 Trade & Industrial Education

What is Boolean Logic? Boolean logic is a system for determining the truth of a statement (or expression) based on whether certain variables are true or false. For example: In the statement, “I will go for a walk if it is sunny,” the decision is based on whether it is true that it is ‘sunny.’ © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 2 Trade & Industrial Education

Historical Note George Boole (1815-1864) was an English mathematician who devised a system of symbols and equations to represent logical decisions. Boolean Algebra was not widely used until the invention of computers. Boolean logic expressions are used to design electronic circuits and to represent decision-making in software Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 3 Trade & Industrial Education

How is Boolean Logic used? A combination of conditions, variables, and operators are used to determine if an expression is True or False. It can also be used to determine which elements can be members of a given set. Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 4 Trade & Industrial Education

How are these categories different? Brown-eyed AND Male Brown-eyed OR Male Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 5 Trade & Industrial Education

Who would be in these groups? NOT male AND wearing jeans NOT <16 Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 6 Trade & Industrial Education

Like Mathematics, Boolean logic has operators Mathematic Operators + - x / = Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 7 Trade & Industrial Education

Like Math, Boolean logic has an order of operations Mathematic Order of Operations is PEMDAS Parentheses first Exponents next Multiplication and Division Addition and Subtraction Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 8 Trade & Industrial Education

Order of Boolean Operations 1. Parentheses are not operators, but indicate grouping, consider these first. 2. == 3. != 4. not 5. and 6. or is considered last. p == q p != q not p p and q p or q © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 9 Trade & Industrial Education

not Tall and Blonde or Rich Consider the NOT first. Not Tall is short. Consider the AND next. Not Tall and Blonde, in other words, Short and Blonde. Consider the OR next. This person can be either Short and Blonde, or they can be Rich. They can also be Short, Blonde, and Rich. Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 10 Trade & Industrial Education

Order of Operations Parentheses first, then not, then and, then or Not Tall and Blonde or Rich Not (Tall and Blonde) or Rich Not Tall and not Blonde or Rich Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 11 Trade & Industrial Education

Venn Diagrams Venn Diagrams can be used to visualize Boolean expressions. Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 12 Trade & Industrial Education

Venn Diagram B A A and B Trade & Industrial Education Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 13 Trade & Industrial Education

Where is not A? B A Trade & Industrial Education Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 14 Trade & Industrial Education

Truth Tables Truth tables are used to evaluate possible combinations of variables and operators. Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 15 Trade & Industrial Education

A OR B A B A or B True False Trade & Industrial Education © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 16 Trade & Industrial Education

A AND B A B A and B True False Trade & Industrial Education © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 17 Trade & Industrial Education

NOT A A not A True False Trade & Industrial Education © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 18 Trade & Industrial Education

not A or B A B not A or B True False Trade & Industrial Education © UNT in partnership with TEA Copyright © Texas Education Agency, 2013 IT: [Computer Programming] - [Boolean Logic] 19 Trade & Industrial Education

Check for Understanding Determining the results of a Boolean expression is known as evaluating it. All Boolean expressions evaluate to either True or False Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 20 Trade & Industrial Education

Evaluate: What would be printed, A or B? blonde = False if blonde: print ‘A' if not blonde: print ‘B‘ Answer is B Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 21 Trade & Industrial Education

Evaluate: What would be printed, A or B? tall = False female = True if ( female and tall): print 'A' if ( female or tall): print 'B‘ Answer is B Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 22 Trade & Industrial Education

Evaluate: What would be printed, A or B? x = False y = True if ( x and y): print ‘A’ if ( not x and y): print ‘B’ Answer: B Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 23 Trade & Industrial Education

Shade in A and not B B A Trade & Industrial Education Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 24 Trade & Industrial Education

Shade in not A and not B B A Trade & Industrial Education Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 25 Trade & Industrial Education

Will it print? x = True y = False if ( x and not y): print ‘a’ Yes Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 26 Trade & Industrial Education

Will it print? x = True y = False if (not x or y): print ‘a’ Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 27 Trade & Industrial Education

With what you know… Can you evaluate a boolean expression? Copyright © Texas Education Agency, 2013 © UNT in partnership with TEA IT: [Computer Programming] - [Boolean Logic] 28 Trade & Industrial Education