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

Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
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)
1 9/24/07CS150 Introduction to Computer Science 1 Relational Operators and the If Statement.
James Tam Basic Logical Operations (Fascinating) In this section you will learn some basic logical operations and how to evaluate expressions Image from.
James Tam Making Decisions In Pascal In this section of notes you will learn how to have your Pascal programs choose between alternative courses of action.
1 CS150 Introduction to Computer Science 1 Relational Operators and the If Statement 9/22/08.
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
James Tam Making Decisions In Pascal In this section of notes you will learn how to have your Pascal programs choose between alternative courses of action.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Computer Science 101 Circuit Design Algorithm. Circuit Design - The Problem The problem is to design a circuit that accomplishes a specified task. The.
Test #1 rescheduled to next Tuesday, 09/20/05 The contents will cover chapter 1, 2, and part of Chapter 4. The contents will cover chapter 1, 2, and part.
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.
Copyright © Curt Hill Truth Tables A way to show Boolean Operations.
© Jalal Kawash 2010 Logic Peeking into Computer Science.
Dale Roberts Program Control using Java - Boolean Expressions Dale Roberts, Lecturer Computer Science, IUPUI Department of.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
© Jalal Kawash Logic Peeking into Computer Science.
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
4. Computer Maths and Logic 4.2 Boolean Logic Simplifying Boolean Expressions.
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.
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.
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
Relational Operator and Operations
CPS120 Introduction to Computer Science
GCSE OCR Computing A451 Binary logic Computing hardware 6.
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.
Computer Science 210 Computer Organization
CS Chapter 3 (3A and ) Part 1 of 8
AND.
Thinking Mathematically
Sequence, Selection, Iteration The IF Statement
Bool operators and, or, not
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.
Logic Gates.
Classwork/Homework Classwork – Page 90 (11 – 49 odd)
Chapter 2.3 Binary Logic.
CS Chapter 3 (3A and ) Part 1 of 8
Basic Logical Operations (Fascinating)
Teaching KS3 Computing Session 4 Theory: Boolean logic AND/OR/NOT
Computer Science 210 Computer Organization
Teaching Computing to GCSE
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Computers & Programming Languages
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.
Teaching KS3 Computing Session 4 Theory: Boolean logic AND/OR/NOT
DESICION TABLE Decision tables are precise and compact way to model complicated logic. Decision table is useful when input and output data can be.
Computer Science 210 Computer Organization
Boolean Logic In today’s lesson we will look at:
CS Chapter 3 (3A and ) Part 3 of 8
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.
Gates Type AND denoted by X.Y OR denoted by X + Y NOR denoted by X + Y
GCSE Computer Science – Logic Gates & Boolean Expressions
Expressions.
Lab Instructors will overview the MSP430
Truth tables Mrs. Palmer.
Selection—Making Decisions
Topics discussed in this section:
Boolean Logic.
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 ( ) Fascinating 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! Logic: not just ‘geeks’ who use it Image of James Tam courtesy of James Tam

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 Boolean (true or false) values as input Can only produce a Boolean (true or false) value as output

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

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

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) C1 C2 C1 AND C2 False True

Logical AND: Three Input Truth Table C1 AND C2 AND C3 False True

Logical AND: An Example T F AND

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 9

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 C1 C2 C1 OR C2 False True

Logical OR: Three Input Truth Table C1 OR C2 OR C3 False True

Logical OR: An Example T F OR T F AND

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 13

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: .....NOT!!! Statement (logical condition) Negation of the statement/condition Truth table S Not S False True

Evaluating More Complex Logical Expressions Order of operation (left to right evaluation if the ‘level’ is equal) Brackets (inner first) Negation AND 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 True False 15

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

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

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