Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.

Slides:



Advertisements
Similar presentations
Computer Science 210 Computer Organization Introduction to Logic Circuits.
Advertisements

1 If Control Construct A mechanism for deciding whether an action should be taken JPC and JWD © 2002 McGraw-Hill, Inc.
1 4. Computer Maths and Logic 4.2 Boolean Logic Boolean Operators.
Basic Logical Operations (fascinating)
This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed.
Basic Logical Operations (Fascinating)
CPSC 322, Lecture 20Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Computer Science cpsc322, Lecture 20 (Textbook.
Boolean Types & Compound Conditionals CSC 1401: Introduction to Programming with Java Lecture 4 – Part 3 Wanda M. Kunkle.
James Tam Basic Logical Operations (Fascinating) In this section you will learn some basic logical operations and how to evaluate expressions Image from.
CSRU 1100 Logic. Logic is concerned with determining: Is it True? Is it False?
James Tam Basic Logical Operations (Fascinating) In this section you will learn what are the basic logical operations and how to evaluate different logical.
Computer Processing CSCE 110 J. Michael Moore.
James Tam AND OR NOT NAND NOR XOR Basic logic operations (fascinating)
James Tam Basic Logical Operations (Fascinating) In this section you will learn what are the basic logical operations and how to evaluate different expressions.
James Tam Basic Logical Operations (Fascinating) In this section you will learn some basic logical operations and how to evaluate expressions Image from.
Making Decisions In Python
J. Michael Moore Computer Processing CSCE 110. J. Michael Moore ProcessorInputOutput Memory Storage.
Boolean Logic Chapter 4 (Sections 4.1 and 4.2). The Roots: Logic 1848 George Boole The Calculus of Logic chocolate and  nuts and mint.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Logic Gate A logic gate is an electronic circuit which makes logic decisions. It has one output and one or more inputs. The output signal appears only.
Formal Theories SIE 550 Lecture Matt Dube Doctoral Student - Spatial.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
Copyright © Curt Hill Truth Tables A way to show Boolean Operations.
James Tam Number systems and logic What is the decimal based number system How does the binary number system work Converting between decimal and binary.
© Jalal Kawash 2010 Logic Peeking into Computer Science.
Dale Roberts Program Control using Java - Boolean Expressions Dale Roberts, Lecturer Computer Science, IUPUI Department of.
© 2006 Pearson Education 1 Obj: to use compound Boolean statements HW: p.184 True/False #1 – 6 (skip 3)  Do Now: 1.Test your “Charge Account Statement”
Mt263f-11 Discrete Structures Li Tak Sing( 李德成 ) Room A
© Jalal Kawash Logic Peeking into Computer Science.
Logic Disjunction A disjunction is a compound statement formed by combining two simple sentences using the word “OR”. A disjunction is true when at.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
Combination of logic gates  Logic gates can be combined to produce more complex functions.  They can also be combined to substitute one type of gate.
MATH 224 – Discrete Mathematics
1 Compound Assignment C++ has a large set of operators for applying an operation to an object and then storing the result back into the object Examples.
CSC 1051 M.A. Papalaskari, Villanova University Conditional Statements Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University.
Teaching Computing to GCSE Level with Python Session 3.
Thinking Mathematically
1 Chapter 4, Part 1 If Control Construct A mechanism for deciding whether an action should be taken JPC and JWD © 2002 McGraw-Hill, Inc. Modified by S.
IB Computer Science – Logic
James Tam Making Decisions In Python In this section of notes you will learn how to have your programs choose between alternative courses of action.
1 CS161 Introduction to Computer Science Topic #6.
James Tam Making Decisions In Python In this section of notes you will learn how to have your programs choose between alternative courses of action.
Notions & Notations - 1ICOM 4075 (Fall 2010) UPRM Department of Electrical and Computer Engineering University of Puerto Rico at Mayagüez Fall 2010 ICOM.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
CPS120 Introduction to Computer Science
Activity 1 5 minutes Grab a whiteboard and pen, come to the front and work out the Truth Table for the following circuit: R A B C Q.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Logical Functions Excel Lesson 10.
Computer Science 210 Computer Organization
AND.
Thinking Mathematically
Sequence, Selection, Iteration The IF Statement
Section 7.1 Logical Operators
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Classwork/Homework Classwork – Page 90 (11 – 49 odd)
Basic Logical Operations (Fascinating)
Computer Science 210 Computer Organization
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
3.4 Computer systems Boolean logic Lesson 2.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
DESICION TABLE Decision tables are precise and compact way to model complicated logic. Decision table is useful when input and output data can be.
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.
Gates Type AND denoted by X.Y OR denoted by X + Y NOR denoted by X + Y
GCSE Computer Science – Logic Gates & Boolean Expressions
Find the reference angle for the angle measuring {image}
Truth tables Mrs. Palmer.
Selection—Making Decisions
Topics discussed in this section:
Presentation transcript:

Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming sections)

Logic: Not Just Theory ( ) Example (an actual question from an computer science student): – “Why is when I type your full name [JT: “James Tam”] that I get fewer search results than just with your last name?” – This is an example of how you actually apply a logical operation in your day-to-day activities! Fascinating Image of James Tam courtesy of James Tam Logic: not just ‘geeks’ who use it

Logical Operators Similar to mathematical operators they take one or two inputs and product an output. Mathematical operators: – Take numbers as input, produce a number as output Two input 3 * 2 One input (negation) -(2) Logical operators (in this section AND, OR, NOT): – Can only take true or false values as input – Can only produce a true or false value as output

Truth Tables Examples (input columns specifying all possible combinations of TRUE, FALSE) Column 1Column 2 FALSE TRUE FALSE TRUE Column 1Column 2Column 3 FALSE TRUE FALSETRUEFALSE TRUE FALSE TRUEFALSETRUE FALSE TRUE

Truth Tables (2) Can be used for evaluating logical operations Column 1Column 2Result of (Column 1) OPERATION (COLUMN 2) FALSE TRUE OR FALSE FALSETRUETRUE OR FALSE TRUEFALSETRUE OR FALSE TRUE TRUE OR FALSE

Logical AND The popular usage of the logical AND applies when ALL conditions must be met. Example: –Pick up your son AND pick up your daughter after school today. Logical AND can be specified more formally in the form of a true table. Condition I Condition II Truth table (AND) C1C2C1 AND C2 False TrueFalse TrueFalse True

Logical AND: Three Input Truth Table Truth table C1C2C3C1 AND C2 AND C3 False TrueFalse TrueFalse True False TrueFalse TrueFalseTrueFalse True False True

Logical AND: An Example TTFFTF ANDFTFTTF FTFFTF

Evaluating Logical AND Expressions For ‘AND’, ‘OR’ the order of operation is left to right True AND True AND True False AND True AND True True AND True AND True AND True True AND True AND True AND False

Logical OR The correct everyday usage of the logical OR applies when ATLEAST one condition must be met. Example: –You are using additional recommended resources for this course: the online textbook OR the paper textbook available in the bookstore. Similar to AND, logical OR can be specified more formally in the form of a truth table. Condition I Condition II Truth table C1C2C1 OR C2 False True FalseTrue

Logical OR: Three Input Truth Table Truth table C1C2C3C1 OR C2 OR C3 False True FalseTrueFalseTrue FalseTrue False True FalseTrue FalseTrue

Logical NOT: An Example TFFT NOTFTTF

Evaluating Logical OR Expressions True OR True OR True False OR True OR True False OR False OR False OR True False OR False OR False OR False

Logical NOT The everyday usage of logical NOT negates (or reverses) a statement. Example: –I am finding this class quite stimulating and exciting The truth table for logical NOT is quite simple: Truth table SNot S FalseTrue False Statement (logical condition) Negation of the statement/condition.....NOT!!!

Evaluating More Complex Logical Expressions Order of operation (left to right evaluation if the ‘level’ is equal) 1.Brackets (inner first) 2.Negation 3.AND 4.OR True OR False AND False NOT (False OR True) OR True (False AND False) OR (False AND True) False OR (False OR True) AND False NOT NOT True NOT NOT False NOT NOT NOT False

Evaluating More Complex Logic: Truth Table C1C2C1 AND C2NOT (C1 AND C2)(C1 OR C2)NOT(C1 AND C2) AND (C1 OR C2) FALSE TRUE FALSE TRUE

Evaluating More Complex Logic: Truth Table C1C2C1 AND C2NOT (C1 AND C2)(C1 OR C2)NOT(C1 AND C2) AND (C1 OR C2) FALSE TRUEFALSE TRUEFALSETRUE FALSE TRUE FALSETRUEFALSE

After This Section You Should Now Know Three logical operators: AND, OR, NOT How to evaluate logical expressions regardless the method of specification e.g., truth table