Please try all of the TRY THIS problems throughout this document. When done, do the following:

Similar documents
Geometry Note-Sheet Overview

Summer Assignment for AP Computer Science. Room 302

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Winter

AP Computer Science A Summer Assignment

III SEMESTER B. A. PHILOSOPHY PHL3B04 - SYMBOLIC LOGIC AND INFORMATICS QUESTION BANK FOR INTERNAL ASSESSMENT. Multiple Choice Questions

Statements Truth Tables. Definition of a Statement

AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018

Summary of Course Coverage

L05 - Negating Statements

Commas Rule with some Comma Rules

AP Computer Science A Summer Assignment

Mathematical Logic Part One

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 9 Normal Forms

AP Computer Science Unit 1. Writing Programs Using BlueJ

Hey there, I m (name) and today I m gonna talk to you about rate of change and slope.

Introduction to Java Unit 1. Using BlueJ to Write Programs

How to make a "hello world" program in Java with Eclipse *

AP Computer Science Summer Work Mrs. Kaelin

CS 380/480 Foundations of Artificial Intelligence Winter 2007 Assignment 2 Solutions to Selected Problems

St. Edmund Preparatory High School Brooklyn, NY

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

AP Computer Science Unit 1. Writing Programs Using BlueJ

Honors Geometry Chapter 2 Test * Required

Mathematical Logic Part One

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

Advanced Algebra I Simplifying Expressions

Math Week in Review #5. A proposition, or statement, is a declarative sentence that can be classified as either true or false, but not both.

COMP Intro to Logic for Computer Scientists. Lecture 2

Note: For #10 I have written out the solutions in more detail than you would be required to give.

Department: Course: Chapter 1

Computer Science 1 Ah

Commas. Review Mini Lesson

Solutions to Selected Exercises

Informatics 1 - Computation & Logic: Tutorial 3

Grad AI Fall, 2007 Homework 1

DR. H S 4 RULES. I have whittled the list down to 4 essential rules for college writing:

Section 1.1 Logic LOGIC

CIS 194: Homework 8. Due Wednesday, 8 April. Propositional Logic. Implication

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

CS 2223 B15 Term. Homework 1 (100 pts.)

This is a copy of the notes used in the module CI01.

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

April 25, Lesson 8.2B

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Answer Key #1 Phil 414 JL Shaheen Fall 2010

Algebra Funct assign 33 writing functions, IV DV, notation.notebook

Simplifying Expressions

Chapter 9 Deductive Arguments II Truth-Functional Logic. Tutorial: Truth Tables

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010

Logical statements and. Lecture 1 ICOM 4075

Enrico s holiday job

Conversion Between Number Bases

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Unit 2: Boolean Logic

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

What is the study of logic?

Introduction to Sets and Logic (MATH 1190)

Declarative Programming. 2: theoretical backgrounds

Introduction to Computers and Engineering Problem Solving 1.00 / Fall 2004

Thomas Jefferson High School for Science and Technology Program of Studies TJ Math 1

The Effects on Read Performance from the Addition of a Long Term Read Buffer to YAFFS2. Sam Neubardt

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

STUDENT LESSON A14 Boolean Algebra and Loop Boundaries

Algebraic Reasoning. Participant Materials

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

Mixed Integer Linear Programming

CS40-S13: Functional Completeness

Summer Math Learning Packet for Students Entering. Grade 6. SFTitle I

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

Program Verification & Testing; Review of Propositional Logic

CS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013

Simplifying Logical Formulas

LESSON 5 - DECIMALS INTRODUCTION

The Mathematics of Banking and Finance By Dennis Cox and Michael Cox Copyright 2006 John Wiley & Sons Ltd

ALICE: An introduction to progamming

COSC 1010 Introduction to Computer Programming

AICE Mathematics AS Level Summer Review

LECTURE 2 An Introduction to Boolean Algebra

COMP-202 Unit 0: Course Details

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims

Propositional Logic. Part I

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

7 th Pre-AP REVIEW for TEST1 1 st Six Weeks

CSC 501 Semantics of Programming Languages

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

1001ICT Introduction To Programming Lecture Notes

2. Unlock the Customization Features: The Edit Button Click the "Edit" button on the Dashboard Home Page to unlock the customization features.

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

CSC116: Introduction to Computing - Java

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

MNU 3-08a - Proportion

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

Math 55 - Spring 04 - Lecture notes # 1 - Jan 20 (Tuesday)

For Students Entering Investigations into Mathematics (IM)

Some Sample AP Computer Science A Questions - Solutions

Grade 7/8 Math Circles Fall November 6/7/8 Boolean Logic

Introduction to Boolean Algebra

Transcription:

AP Computer Science Summer Assignment Dr. Rabadi-Room 1315 New Rochelle High School nrabadi@nredlearn.org One great resource for any course is YouTube. Please watch videos to help you with any of the summer homework. Please try all of the TRY THIS problems throughout this document. When done, do the following: Watch the Youtube video Java tutorial 1: hello Java! Getting started with eclipse by Maxwell Sanchez Download the program eclipse. You should look for the following icon: Run the program "Hello World" You can go to the video and type it. Go to File New Java Project Name the project, then return to; go to File New Class. Type in the program below: public class Intro { } public static void main(string[] args) { System.out.println("Hello World"); } Hit the play (run) button when done. Experiment by changing Hello World to any phrase you want. Finally, read chapter 1 from the link below. These are the basics about computers. http://math.hws.edu/eck/cs124/downloads/javanotes5-linked.pdf Answer the questions at the end of the chapter named quiz on chapter 1. This is found on page 17 of the chapter but page 31 on the pdf document. Please send me an email to rrabadi@nredlearn.org if you need clarification or assistance with anything. Have a great summer.

Decimal base 10 Binary base 2 Hexadecimal base 16 It is very important to know how to convert from decimal to binary and binary to decimal. Converting to Hexadecimal will be taught during the first week of class, but please feel free to learn about them. Please take some time to read the following: To convert the number (decimal) 57 to binary (base 2), you should make a box and write down Binary number : Power of 2: 2 6 2 5 2 4 2 3 2 2 2 1 2 0 Since I know 2 6 is 64, I know I went over. Therefore I only need up to 2 5. Binary numbers can only take on the two numbers 1 and 0. You cannot use any other value. Take a look at the chart below to see how 57 (base 10) is 111001 2 binary number: 1 1 1 0 0 1 power of 2: 2 5 2 4 2 3 2 2 2 1 2 0 111001 2 = 1 2 5 +1 2 4 +1 2 3 +0 2 2 +0 2 1 +1 2 0 = 57 Similarly, if you have the binary 111001 2 then what you should do is make a 6 lines (because in this example there are six numbers) and below the lines you write the powers of 2. 2 5 2 4 2 3 2 2 2 1 2 0 Then place the binary on top of each one and compute the value as shown in the table above. 1 1 1 0 0 1 2 5 2 4 2 3 2 2 2 1 2 0 When you understand try the following examples. The answers are below the examples so that you can check your work. NOTE: Some answers have many zeros in the beginning and that is because many people write binary using 8 digits. However, the zeros in the beginning are not necessary and it is not recommended that you put them there. Again if you need more help, please watch a YouTube video. There are many great ones.

TRY THIS: Problem Set 1: Convert from Binary numbers to Decimal 1. 11001011 2. 00110101 3. 10000011 4. 10001111 5. 11100011 6. 00000100 7. 00010010 8. 00111111 9. 10101010 10. 01010101

Answers Binary to Decimal 1. 11001011 203 2. 00110101 53 3. 10000011 131 4. 10001111 143 5. 11100011 227 6. 00000100 4 7. 00010010 18 8. 00111111 63 9. 10101010 170 10.01010101 85

Problem Set 2: Convert from Decimal to Binary 11. 213 12. 9 13. 67 14. 99 15. 23 16. 143 17. 6 18. 1 19. 197 20.252

Answers for converting Decimal to Binary 11. 213 11010101 12. 9 00001001 13. 67 01000011 14. 99 01100011 15. 23 00010111 16. 143 10001111 17. 6 00000110 18. 1 00000001 19. 197 11000101 20. 252 11111100

Logic Section A statement can either be true or false. We usually represent a statement with a letter that is associated to the statement somehow. For example, Aaron went to the store. Aaron purchased eggs and bacon can be represented as: Let S: represent Aaron went to the store. Let E: represent Aaron purchased eggs. Let B: represent Aaron purchased bacon. Notice that we do not use A for Aaron because Aaron comes up in more than one sentence. Some logic that we should know: Conjunction is the truth-functional connective which forms compound propositions which are true if and only if both statements are true. Also known as the and statement, it is represented in mathematics by the symbol ^. The only way a conjunction can be true is if both statements are true. In computer programming, the symbol for and is a double ampersand &&. T T Disjunction is a connective which forms compound propositions which is true if one statement is true Also known as the or statement, it is represented in mathematics by the symbol V. T. The only way a disjunction can be True if one statement is True. In computer programming, the symbol for or is a double line. Negation: The negation statement is the not statement. It changes the value from true to false and false to true. The mathematical symbol for negation is ~. In computer programming, we use the! symbol to represent negation. Demorgan s Law are rules of logic that show what happens when you negate a conjunction or negate a disjunction. This is very important to remember. ~(p q) is logically equivalent to ~p ~q ~(p q) is logically equivalent to ~p ~q

This can be shown by creating the following truth table 1 2 3 4 5 6 7 p q p q ~(p q) ~p ~q ~p ~q T T T F F F F T F F T F T T F T F T T F T F F F T T T T Column 4 and column 7 are equivalent showing that the two statements are equivalent. To do this, I dissected each part. In other words, I asked myself, what parts of the puzzle do I need to show that this is true. Well, you needed the parts that I put in the column. TRY THIS: Show this for the second statement. That is, show ~(p V q) is logically equivalent to ~p ~q. Fill in the chart. p q p q ~(p q) ~p ~q ~p ~q T T T F F T F F Law of Contrapositive: Also logically equivalent to an original statement is its contrapositive (switching the statements around and negating them). p q is logically equivalent to ~q ~p Law of Disjunctive Inference is when you are given two statements that are compounded with an or. Only one of the two statements will happen. Depending on the statement, the conclusion is the opposite. For example, Law of Disjunctive Inference: Statement 1: I will drink milk OR I will drink water. Statement 2: I will not drink milk Conclusion: I will drink water. Using symbols, this looks like Statement 1: M W

Statement 2: ~W Conclusion: M Law of Syllogism (Chain Rule): Statement 1: If I go to the movies, then I will buy popcorn Statement 2: If I buy popcorn, then I will buy soda. Conclusion: If I go to the movies, then I will buy soda. This can be written symbolically in the following way, Statement 1: M P Statement 2: P S Conclusion: M S Law of Detachment Statement 1: If I drive to the park, I will need gas for my car. Statement 2: I drive to the park. Conclusion: I will need gas for my car. Law of Modus Tollens (denying the consequent): It makes more sense if we take a look at this by example. If a watchdog detects an intruder then the watchdog will bark. The watchdog does not bark. Therefore, the watchdog did not detect the intruder. Symbolically shown: Statement 1: D B Statement 2: ~B Conclusion: ~D Putting all these laws together, let s try the following example Given: If I get a summer job, then I will earn money. If I fail mathematics, then I will not earn money. I get a summer job or I am not happy. I am happy or I am not successful. I am successful.

Prove: I did not fail mathematics. Statement 1) If I get a summer job, then I will earn money. 2) If I fail mathematics, then I will not earn money. 3) I get a summer job or I am not happy. 4) I am happy or I am not successful. 5) I am successful. Reason Given 6) I am not happy Disjunctive inference (using statements 4, 5) 7) I get a summer job Disjunctive inference (using statements 3, 6) 8) I will earn money Detachment (using statements 7 and 1) 9) I will not fail mathematics Modus Tollens (using statements 2 and 8) TRY THIS: A ~B D ~C (~D ~E) F C v B A ~F Prove: E TRY THIS: Use statement-reason method to prove it. Given: Beta is not true Alpha is true or beta is true If gamma is not true, then alpha is not true If sigma is not true, then delta is true If gamma is true, then delta is not true or epsilon is not true or epsilon is not true Epsilon is true Prove: Sigma is true

TRY THIS: Given: If I save money, then I buy a car. If I do not save money, then I will take the train. If I buy a car and I buy a bike, then I need insurance. I do not need insurance. I buy a bike. Prove: I take the train.