COMPUTER SKILLS LESSON 3

Save this PDF as:

Size: px
Start display at page:

Transcription

1 COMPUTER SKILLS LESSON 3 Prof. Valeria Cardellini Prof. Emiliano Casalicchio

2 Computer Skills - Lesson 3 - V. Cardellini 2 The professors Valeria Cardellini, Module A Emiliano Casalicchio, Module B Office hours Mod. A When: Thursday 12:00-13:30 Where: room D1-17 (1 st floor), Ingegneria dell Informazione building Office hours Mod. B When: Monday 16:00-18:00 Where: room D1-17 (1 st floor), Ingegneria dell Informazione building

3 Computer Skills - Lesson 3 - V. Cardellini 3 Objectives of this lesson We ll discuss Variables and assignment statements Characters and encoding Numerical data types Integer Floating point Numerical expressions

4 Computer Skills - Lesson 3 - V. Cardellini 4 Octave: open source alternative to MATLAB GNU Octave High-level interpreted language, primarily intended for numerical computations Provides capabilities for numerical solution of linear and nonlinear problems, and for performing other numerical experiments Provides extensive graphics capabilities for data visualization and manipulation Normally used through its interactive command line interface The Octave language is quite similar to MATLAB so that most programs are easily portable

5 Computer Skills - Lesson 3 - V. Cardellini 5 Variables and assignment statements Assignment statement variablename = expression! = is the assignment operator; it does not mean equal. Syntax similar to conventional algebra but a different meaning! z = x + y! z = 4*x - y! Algebraic interpretation: implied relationship between x and y by addition and simplification: 2y = 3x Programming: I changed my mind about what I wanted to store in the variable z. (x and y must have values)

6 Computer Skills - Lesson 3 - V. Cardellini 6 Variable name Must always be on the left and the expression on the right Can be any combination of uppercase and lower case alphabetic letters, digits and the special characters _ and \$ but it cannot have a space Must begin with a letter of the alphabet myfirstvariable! myfirstvar! my_1st_var! 1stvarofmine! NO MATLAB is case sensitive: variables mynum, MYNUM and Mynum are different! Reserved words or keywords cannot be used as variable names

7 Computer Skills - Lesson 3 - V. Cardellini 7 Useful commands namelengthmax! who! whos! clear! clear variablename! clear variablename1 variablename2!

8 Computer Skills - Lesson 3 - V. Cardellini 8 Data typing How a programming language treats data stored in a variable untyped typed, e.g. C, Fortran, Java both name and type must be specified weak typing strong typing a Meter; b Second; c,d MeterPerSecond; a+b, b+a,c+a KO c=a*b + d OK

9 Computer Skills - Lesson 3 - V. Cardellini 9 Data typing MATLAB is both typed and untyped Untyped case >> a = [2 3]!% a is a vector with two elements! a =! 2 3! >> x=0.5*a! x =! e e+00! Typed case >> ai = uint8(a)!%for more info on the uint8 function!!!!%type «help uint8» on the console!!!!% or browse the online documentation! ai =! 2 3! >> x = 0.5*ai! x =! 1 2!

10 Computer Skills - Lesson 3 - V. Cardellini 10 Untyped use of MATLAB letter is char (character) >> letter = A! letter is double letter = A! >> letter = letter+1! letter = 66!

11 Computer Skills - Lesson 3 - V. Cardellini 11 MATLAB data types Let s play with types...

12 Computer Skills - Lesson 3 - V. Cardellini 12 Default data type By default, MATLAB stores all numeric variables as double-precision floating-point values. Additional data types store text, integer or singleprecision values, or a combination of related data in a single variable >> thisnumber= 42.0 %A variable is an instance of an object storing values! thisnumber =! 42!!!! >> whos thisnumber!! Name Size Bytes Class Attributes! thisnumber 1x1 8 double!

13 Computer Skills - Lesson 3 - V. Cardellini 13 The first problem Create a script derived from the Pythagorean theorem to compute the hypotenuse of a right triangle: H 2 = A 2 + B 2 where A and B are the sides adjacent to the right angle, and H is the hypotenuse opposite. clear! clc!! A = 3; % the first side of a triangle! B = 4; % the second side of a triangle! hypsq = A^2 + B^2; % the square of the hypotenuse! H = sqrt(hypsq) % the answer! B A H

14 Computer Skills - Lesson 3 - V. Cardellini 14 Characters and encoding A character in MATLAB is represented using single quotes 'a', 'x', '3'! Characters are put in an order using a character encoding The most common character encoding is ASCII Numeric functions to convert a character to its equivalent numerical value >> numequiv = double('a')! numequiv = 97!

15 Computer Skills - Lesson 3 - V. Cardellini 15 Additional reading: the ASCII code ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or ASCII was developed a long time ago and now the non-printing characters are rarely used for their original purpose. Below is the ASCII character table and this includes descriptions of the first 32 non-printing characters. ASCII was actually designed for use with teletypes and so the descriptions are somewhat obscure. If someone says they want your CV however in ASCII format, all this means is they want 'plain' text with no formatting such as tabs, bold or underscoring - the raw format that any computer can understand. This is usually so they can easily import the file into their own applications without issues. notepad.exe creates ASCII text, or in MS Word you can save a file as 'text only'

16 Computer Skills - Lesson 3 - V. Cardellini 16 Additional reading: the ASCII table

17 Computer Skills - Lesson 3 - V. Cardellini 17 Integer data type To know the range of an integer data type use the intmin and intmax built-in functions, e.g. intmin( int16 )! MATLAB stores numeric data as double by default: to store data as integer, you need to convert from double to the desired integer type Use one of the conversion functions shown above

18 Computer Skills - Lesson 3 - V. Cardellini 18 Double à Integer Example: store 325 as a 16-bit signed integer assigned to variable x >> x = int16(325);! If the number being converted to an integer has a fractional part, MATLAB rounds to the nearest integer. If the fractional part is exactly 0.5, then from the two equally nearby integers, MATLAB chooses the one for which the absolute value is larger in magnitude:! >> x = ;! >> int16(x)! ans = 325!! >> x = x +.001;! >> int16(x)! ans = 326!

19 Computer Skills - Lesson 3 - V. Cardellini 19 Double à Integer: overriding rounding scheme If you need to round a number using a rounding scheme other than the default, MATLAB provides four rounding functions: round: towards nearest int fix: towards zero floor: towards -infinity ceil: toward infinity >> x = 325.9;! >> int16(fix(x))! ans = 325!

20 Computer Skills - Lesson 3 - V. Cardellini 20 Floating point data type Double-precision (or double) data type: IEEE Standard 754 for double precision; any value stored as a double requires 64 bits. Single-precision (or single) data type: IEEE Standard 754 for single precision; any value stored as a single requires 32 bits. Numbers of type single are represented with less precision than numbers of type double.

21 Computer Skills - Lesson 3 - V. Cardellini 21 Numerical expressions Expressions can be created using values, variables, operators, built-in functions and parentheses >> 2 * sin(1.4)! Operators Two kinds: unary and binary Unary operators: operate on a single value Binary operators: operate on two values or operands Some common operators with numerical expressions: + addition - negation, subtraction * multiplication / division (divided by) \ division (divided into) ^ exponentiation

22 Computer Skills - Lesson 3 - V. Cardellini 22 Numerical expressions Some operators have precedence over others Using parentheses can change the precedence >> * 3! >> (4 + 5) * 3! Operator precedence (from highest to lowest) () parentheses ^ exponentiation - negation *, /, \ all multiplication and division +, - addition and subtraction

23 Computer Skills - Lesson 3 - V. Cardellini 23 Examples of operator precedence 1\2! -5^2! (-5)^2! 10-6/2! 5*4/2*3!

24 Computer Skills - Lesson 3 - V. Cardellini 24 Relational expressions Expressions that are true or false (Boolean or logical expressions) > greater than < less than >= greater than or equals <= less than or equals == equality ~= inequality 0 for false, 1 for true >> 'd'<'g'!!!>> ~(2<3)! ans = 1!!!ans = 0!!

25 Computer Skills - Lesson 3 - V. Cardellini 25 Relational expressions Logical operators or && and ~ not >> 2 < 4 'x' == 'y'! ans = 1! Built-in function xor! >> xor('c' > 'b', 5 > 2)! ans = 0!

26 Computer Skills - Lesson 3 - V. Cardellini 26 Review: Boolean algebra In mathematics and mathematical logic, Boolean algebra is the subarea of algebra in which the values of the variables are: the truth values true (T) and false (F), usually denoted by 1 and 0 respectively The basic operations of Boolean algebra are: the conjunction (AND), denoted by the disjunction (OR), denoted by the negation (NOT), denoted by The exclusive OR (XOR) is a logical operators that outputs true whenever both inputs differ

27 Computer Skills - Lesson 3 - V. Cardellini 27 Review: logical operators NOT ~! AND &&! OR!

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

Introduction to Programming (in C++) Data types and visibility. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC

Introduction to Programming (in C++) Data types and visibility Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC Outline Data types Type conversion Visibility Introduction to

Chapter 2: Problem Solving Using C++

Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

School of Informatics, University of Edinburgh

CS1Ah Lecture Note 5 Java Expressions Many Java statements can contain expressions, which are program phrases that tell how to compute a data value. Expressions can involve arithmetic calculation and method

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

Primitive Data Types Summer 2010 Margaret Reid-Miller

Primitive Data Types 15-110 Summer 2010 Margaret Reid-Miller Data Types Data stored in memory is a string of bits (0 or 1). What does 1000010 mean? 66? 'B'? 9.2E-44? How the computer interprets the string

Computer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1

Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions

Excel and Visual Basic

Excel and Visual Basic Chapter I The Visual Basic Language Before we start Computers store information in memory. The basic memory element is the byte (a set of 8 bits, each bit can have the value 0 or

Dept. of CSE, IIT KGP

Programming in C: Basics CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of variable We must declare the

Activity 2: Arithmetic

Activity 2: Arithmetic Now that you ve written a few programs, let s take a step back and discuss how to do basic arithmetic. But first, there s something important to know about why you re working in

Data Storage: Each time you create a variable in memory, a certain amount of memory is allocated for that variable based on its data type (or class).

Data Storage: Computers are made of many small parts, including transistors, capacitors, resistors, magnetic materials, etc. Somehow they have to store information in these materials both temporarily (RAM,

Unit 2: Number Systems, Codes and Logic Functions

Unit 2: Number Systems, Codes and Logic Functions Introduction A digital computer manipulates discrete elements of data and that these elements are represented in the binary forms. Operands used for calculations

JAVA PRIMITIVE DATA TYPE

JAVA PRIMITIVE DATA TYPE Description Not everything in Java is an object. There is a special group of data types (also known as primitive types) that will be used quite often in programming. For performance

Introduction to Java CS 1124, Media Computation November 10, 2008 Steve Harrison

Introduction to Java CS 1124, Media Computation November 10, 2008 Steve Harrison DrJava? DrJava is a free integrated development environment for doing Java programming From Rice University It is written

Bits, Data Types, and Operations. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

Bits, Data Types, and Operations University of Texas at Austin CS3H - Computer Organization Spring 2 Don Fussell How do we represent data in a computer? At the lowest level, a computer is an electronic

Outline TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA. What is DrJava? Dr Java

1 Outline TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

Number Representation

Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk

DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued

Number Representation

Number Representation Number System :: The Basics We are accustomed to using the so-called decimal number system Ten digits ::,,,3,4,5,6,7,8,9 Every digit position has a weight which is a power of Base

a c Pythagorean Theorem: a 2 + b 2 = c 2

Section 2.1: The Pythagorean Theorem The Pythagorean Theorem is a formula that gives a relationship between the sides of a right triangle The Pythagorean Theorem only applies to RIGHT triangles. A RIGHT

Number Systems and. Data Representation

Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

Quiz for Chapter 3 Arithmetic for Computers 3.10

Date: Quiz for Chapter 3 Arithmetic for Computers 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in RED

CME 192: Introduction to Matlab

CME 192: Introduction to Matlab Matlab Basics Brett Naul January 7, 2015 What is Matlab? Computing & programming environment Visualization and mathematical prototyping tool Why Matlab? Comparison with

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

Today s topics. Java programs. Java Virtual Machine (JVM) Bytecodes. HelloWorld.java javac HelloWorld.class

Today s topics Java programs Parsing Java Programming Notes from Tammy Bailey Reading Great Ideas, Chapter 3 & 4 Java programs are created as text files using a text editor (like emacs) Save to disk with.java

The Fundamentals of C++

The Fundamentals of C++ Basic programming elements and concepts JPC and JWD 2002 McGraw-Hill, Inc. Program Organization Program statement Definition Declaration Action Executable unit Named set of program

Solution for Homework 2

Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

Logic Design. Dr. Yosry A. Azzam

Logic Design Dr. Yosry A. Azzam Binary systems Chapter 1 Agenda Binary Systems : Binary Numbers, Binary Codes, Binary Logic ASCII Code (American Standard Code for Information Interchange) Boolean Algebra

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

Two s Complement Arithmetic

Two s Complement Arithmetic We now address the issue of representing integers as binary strings in a computer. There are four formats that have been used in the past; only one is of interest to us. The

Chapter 2: Elements of Java

Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 47 2.2 Positional Numbering Systems 48 2.3 Converting Between Bases 48 2.3.1 Converting Unsigned Whole Numbers 49 2.3.2 Converting Fractions

Note The format function affects only how numbers are displayed, not how MATLAB computes or saves them.

MATLAB Function Reference Set display for output Graphical Interface As an alternative to, use preferences. Select Preferences from the File menu in the MATLAB desktop and use Command Window preferences.

This section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects.

Application Note 154 LabVIEW Data Storage Introduction This Application Note describes the formats in which you can save data. This information is most useful to advanced users, such as those using shared

Borland C++ Compiler: Operators

Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,

198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

Going from Python to C

Going from Python to C Darin Brezeale December 8, 2011 Python is a high-level, interpreted language. C has many of the same types of programming constructs as in Python: arrays, loops, conditionals, functions,

PROGRAMMING REFRESHER MODULE. Delivered by Ana Cavalcanti and Alvaro Miyazawa Prepared by Dr Lilian Blot

PROGRAMMING REFRESHER MODULE Delivered by Ana Cavalcanti and Alvaro Miyazawa Prepared by Dr Lilian Blot The Rules Everything in PREF (Week 1) is optional. From week 2 of APRC and JAPC, we assume that all

Radix Number Systems. Number Systems. Number Systems 4/26/2010. basic idea of a radix number system how do we count:

Number Systems binary, octal, and hexadecimal numbers why used conversions, including to/from decimal negative binary numbers floating point numbers character codes basic idea of a radix number system

CITS2401 Computer Analysis & Visualisation

FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Lectures 4 and 5 Introduction to Matlab Material from MATLAB

NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120

NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120 First, a reminder of how we represent base ten numbers. Base ten uses ten (decimal) digits: 0, 1, 2,3, 4, 5, 6, 7, 8, 9. In base ten, 10 means ten. Numbers

Introduction to Computers and Programming

16.070 Introduction to Computers and Programming March 14 Recitation 6 Spring 2002 Topics: Quick review of PS4 issues Fundamental Data types ASCII / Arithmetic Conversion Number Systems / Logical Operation

Bit operations carry* 0110 a 0111 b a+b. 1 and 3 exclusive OR (^) 2 and 4 and (&) 5 or ( )

Bit operations 1 and 3 exclusive OR (^) 2 and 4 and (&) 5 or ( ) 01100 carry* 0110 a 0111 b 01101 a+b * Always start with a carry-in of 0 Did it work? What is a? What is b? What is a+b? What if 8 bits

1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

1.3 Data Representation

8628-28 r4 vs.fm Page 9 Thursday, January 2, 2 2:4 PM.3 Data Representation 9 appears at Level 3, uses short mnemonics such as ADD, SUB, and MOV, which are easily translated to the ISA level. Assembly

Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic

Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic Syedur Rahman Lecturer, CSE Department North South University syedur.rahman@wolfson.oon.org Acknowledgements

Object Oriented Software Design

Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

MIPS floating-point arithmetic

MIPS floating-point arithmetic Floating-point computations are vital for many applications, but correct implementation of floating-point hardware and software is very tricky. Today we ll study the IEEE

Mathematics of Cryptography

CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter

Object Oriented Software Design

Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

Chapter II Binary Data Representation

Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Integer Numbers The Number Bases of Integers Textbook Chapter 3 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better:

G E O M E T R Y CHAPTER 9 RIGHT TRIANGLES AND TRIGONOMETRY. Notes & Study Guide

G E O M E T R Y CHAPTER 9 RIGHT TRIANGLES AND TRIGONOMETRY Notes & Study Guide 2 TABLE OF CONTENTS SIMILAR RIGHT TRIANGLES... 3 THE PYTHAGOREAN THEOREM... 4 SPECIAL RIGHT TRIANGLES... 5 TRIGONOMETRIC RATIOS...

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables CMSC 131 - Lecture Outlines - set

Problem Solving With C++ Ninth Edition

CISC 1600/1610 Computer Science I Programming in C++ Professor Daniel Leeds dleeds@fordham.edu JMH 328A Introduction to programming with C++ Learn Fundamental programming concepts Key techniques Basic

CS101 Computer programming and utilization

CS101 Computer programming and utilization Dr Deepak B Phatak Subrao Nilekani Chair Professor Department of CSE, Kanwal Rekhi Building IIT Bombay Lecture 3, Basic features of C++ Tuesday, 2 August 2011

Encoding Systems: Combining Bits to form Bytes

Encoding Systems: Combining Bits to form Bytes Alphanumeric characters are represented in computer storage by combining strings of bits to form unique bit configuration for each character, also called

Chapter 3: Elementary Number Theory and Methods of Proof. January 31, 2010

Chapter 3: Elementary Number Theory and Methods of Proof January 31, 2010 3.4 - Direct Proof and Counterexample IV: Division into Cases and the Quotient-Remainder Theorem Quotient-Remainder Theorem Given

Chapter 6 Character Strings. Copyright 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 6 Character Strings Outline 6.1 Character String Concepts: Mapping and Casting 6.2 MATLAB Implementation 6.3 Format Conversion Functions 6.4 Character String Operations 6.5 Arrays of Strings Introduction

Chapter 1: Scalar Variables and Data Types

Chapter 1: Scalar Variables and Data Types 1. Python as a calculator The Python interpreter acts as a simple calculator: you can type an expression at it and it will write the value. Expression syntax

Y = abc = a b c.2 0

Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human

4 Operations On Data

4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++

Adjusted/Modified by Nicole Tobias Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types

Presented By: Ms. Poonam Anand

Presented By: Ms. Poonam Anand Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert base 10 numbers into numbers of other bases Describe the

Instructions for SA Completion

Instructions for SA Completion 1- Take notes on these Pythagorean Theorem Course Materials then do and check the associated practice questions for an explanation on how to do the Pythagorean Theorem Substantive

Chapter 4. Computer Arithmetic

Chapter 4 Computer Arithmetic 4.1 Number Systems A number system uses a specific radix (base). Radices that are power of 2 are widely used in digital systems. These radices include binary (base 2), quaternary

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

Binary Numbers. X. Zhang Fordham Univ.

Binary Numbers X. Zhang Fordham Univ. 1 Numeral System! A way for expressing numbers, using symbols in a consistent manner.!! "11" can be interpreted differently:!! in the binary symbol: three!! in the

Scripting with TCL, Part 1

Scripting with TCL, Part 1 Axel Kohlmeyer Center for Molecular Modeling University of Pennsylvania SBS 2007 @ JNCASR, Bangalore The VMD Execution Model GUI (FLTK) Internal State Visualization Python Interpreter

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

Vectors Math 122 Calculus III D Joyce, Fall 2012

Vectors Math 122 Calculus III D Joyce, Fall 2012 Vectors in the plane R 2. A vector v can be interpreted as an arro in the plane R 2 ith a certain length and a certain direction. The same vector can be

Floating point numbers in Scilab

Floating point numbers in Scilab Michaël Baudin May 2011 Abstract This document is a small introduction to floating point numbers in Scilab. In the first part, we describe the theory of floating point

CPE 323 Data Types and Number Representations

CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as

+ addition - subtraction and unary minus * multiplication / division mod modulo

Chapter 4 Basic types We examine in this chapter the Caml basic types. 4.1 Numbers Caml Light provides two numeric types: integers (type int) and floating-point numbers (type float). Integers are limited

The largest has a 0 in the sign position and 0's in all other positions:

10.2 Sign Magnitude Representation Sign Magnitude is straight-forward method for representing both positive and negative integers. It uses the most significant digit of the digit string to indicate the

Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

Activity 1: Bits and Bytes

ICS3U (Java): Introduction to Computer Science, Grade 11, University Preparation Activity 1: Bits and Bytes The Binary Number System Computers use electrical circuits that include many transistors and

C Programming Dr. Hasan Demirel

C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

1 Basic Computing Concepts (4) Data Representations

1 Basic Computing Concepts (4) Data Representations The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The

C++ Language Tutorial

cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

22C:19 Discrete Math. So. What is it? Why discrete math? Fall 2009 Hantao Zhang

22C:19 Discrete Math Fall 2009 Hantao Zhang So. What is it? Discrete mathematics is the study of mathematical structures that are fundamentally discrete, in the sense of not supporting or requiring the

Data Representation in Computers

Chapter 3 Data Representation in Computers After studying this chapter the student will be able to: *Learn about binary, octal, decimal and hexadecimal number systems *Learn conversions between two different

Lecture 1 Notes: Introduction

Introduction to C++ January 4, 2011 Massachusetts Institute of Technology 6.096 Lecture 1 Notes: Introduction 1 Compiled Languages and C++ 1.1 Why Use a Language Like C++? At its core, a computer is just

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

Math 016. Materials With Exercises

Math 06 Materials With Exercises June 00, nd version TABLE OF CONTENTS Lesson Natural numbers; Operations on natural numbers: Multiplication by powers of 0; Opposite operations; Commutative Property of

Data Storage 3.1. Foundations of Computer Science Cengage Learning

3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

VistaPro User Guide Custom Variable Expressions IES Virtual Environment Copyright 2015 Integrated Environmental Solutions Limited. All rights reserved. No part of the manual is to be copied or reproduced

Using Java 5.0 BigDecimal

Using Java 5.0 BigDecimal Mike Cowlishaw IBM Fellow http://www2.hursley.ibm.com/decimal Mike Cowlishaw Using Java 5.0 BigDecimal Page 1 Overview Background Why decimal arithmetic is important New standards

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 2: Basic Elements of C++

C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with the basic components of a C++ program,

,!7IA3C1-dcahfj!:t;K;k;K;k. Addison-Wesley s JavaScript Reference Card. Kathleen M. Goelz and Carol J. Schwartz, Rutgers University VARIABLES

Addison-Wesley s JavaScript Reference Card Kathleen M. Goelz and Carol J. Schwartz, Rutgers University Javascript: A scripting language designed to be integrated into HTML code to produce enhanced, dynamic,

Part 1 Theory Fundamentals

Part 1 Theory Fundamentals 2 Chapter 1 Information Representation Learning objectives By the end of this chapter you should be able to: show understanding of the basis of different number systems show

By the end of the lecture, you should be able to:

Extra Lecture: Number Systems Objectives - To understand: Base of number systems: decimal, binary, octal and hexadecimal Textual information stored as ASCII Binary addition/subtraction, multiplication