Top Banner
1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.
44

1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Dec 30, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

1

Bill Gates

• I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Page 2: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

2

CPS118 – Introductory Programming to Scientists

Maryam Davoudpour

Office : ENG 241 www.scs.ryerson.ca/~mdavoud

Course Texts:

• Gilat, Amos (2010). MATLAB: An Introduction with Applications, 5th Edition. Wiley.

The official course website : http://cps118.scs.ryerson.ca/

Page 3: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

3

Introduction to Computer Science

Page 4: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

4

50000 to 20000 B.C.E.

• Computing with digits, pebbles and bones.• pebble = calculus

• 2000 B.C.E.• First use of the abacus

Page 5: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

5

The Historyof Computing

Page 6: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

6

6000 B.C.E.• In the Indian Vedah, a verse (Richa) mentions the numerals of 12 (dwawash), 2 (treemi), and 300 (trishat). That was one of the earliest recordings of a decimal numeral system

Page 7: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

7

2000 B.C.E.• First use of the abacus

Page 8: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

8

780-850

• Muhammed ibn Musa Al-KhwarizmiTashkent cleric, mathematician and professor introduced the Hindu positional, decimal system and the use of zero into Arabic mathematics.

• About a thousand years later Ada Lovelace honoured him when she coined the word Algorithm.

Page 9: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

9

And…• 1642 : At age 19, Blaise Pascal invents the first calculator: the pascaline.

• 1780 : Benjamin Franklin discovers electricity.

• 1804 : Joseph-Marie Jacquard builds the first automatic weaving loom programmed with punched cards.

Page 10: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

10

History of Computing

• Charles Babbage (1791-1871) was an English Mathematician,philosopher,inventor Known to some as the "Father of Computing" for his contributions to the basic design of the computer through his Analytical machine. His previous Difference Engine was a special purpose device intended for the production of tables.

He originated the concept of a programmable computer.

Page 11: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

11

• Ada Lovelace (1815-1852) she is mainly known for having written a description of Charles Babbage's early mechanical general-purpose computer, the analytical engine. She is today appreciated as the "first programmer" since she was writing programs that is, manipulating symbols according to rules for a machine that Babbage had not yet built. She also foresaw the capability of computers to go beyond mere calculating or number-crunching while others, including Babbage himself, focused only on these capabilities.

Page 12: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

1854

•George Boole creates the algebra that bears his name today (boolean).

AND T F

T T F

F F F

OR T F

T T T

F T F12

Page 13: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

•1874 : The QWERTY keyboard, was present on the very first typewriter... The Sholes & Glidden, made by E. Remington & Sons

•1937: Alan Mathison Turing defines the notion of algorithm and introduces the concept of the universal machine now known as « Turing machines ».

•1939: John Atanasoff and Clifford Berry conceive a digital computer using electromagnetic relays.

13

Page 14: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

• 1939-1945

• During WWII, Germany used the Enigma machine to encode its transmissions.

14

Page 15: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

• 1945 : John Presper Ecker and John Mauchly build the first electronic computer: the ENIAC. The ENIAC weighed 30 tons!

• It was placed in a sort of U of 6 meters wide by 12 meters long. Energy consumption: 200 KW! The lights of the whole city of Philadelphia dimmed when it was turned on!

15

Page 16: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

• 1945 : The first bug! –• found on Sep 9th at 15:45 by Grace Hopper, then working on the Mark II computer at Harvard University. She became the highest ranking female Navy person of her time (Rear Admiral) and a role model to thousands of young women. The bug now resides at the National Museum of American History in Washington DC.

16

Page 17: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

17

• Dennis Ritchie in 1972Invents the C programming language as a tool to interface with the Unix OS.

Page 18: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

• 1977 : Steve Wozniak and Steve Jobs found the Apple Computer Company.

• 1981 : IBM launches the PC.• 1982 : Time Magazine eschewed its Man of the Year Award in favour of Machine of the Year: The Computer.

• 1984 :Apple introduces the Macintosh, the first commercially successful computer using a graphical interface.

18

Page 19: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

19

In 1989

• ANSI (American National Standards Institute) publishes the first standard for the C programming language.

• Microsoft Corporation introduces the Windows graphical interface.

Page 20: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

20

1991• Linus Torvalds was a

computer science student at the University of Helsinki when he wrote the operating system Linux in 1991.

Page 21: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

21

1994• Marc Andreesen, creates the Web browser known as Mosaic at the University of Illinois.

• Later co-founder of Netscape Corporation.

Page 22: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

22

1995• The Internet explodes with a ton of new services and applications.

Page 23: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

23

1996-1998• New services still!

Page 24: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

24

1999

• The concept of blogging is introduced

A blog (Web log) is a Web site, usually maintained

by an individual, with regular entries of commentary, descriptions of events, or other material such as graphics or video. Blogs have since gained increasing notice and coverage for their role in breaking, shaping, and spinning news stories.

Page 25: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

25

1999Wi-Fi is introduced• We can now use wireless networking, also called WiFi or 802.11 networking, to connect our computer to the internet.

Page 26: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

26

2000• Microsoft releases Windows XP

• Apple launches its iPod. A modern version of a walkman storing music in Mp3 format on a small 5Gb internal hard disk.

Page 27: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

27

2002• Dr. Isaac Chuang, research staff member at IBM's Almaden Research Center (San Jose, Calif.), holds a quantum computer -- the glass tube contains specially designed molecules.

• Quantum computers promised to solve some of the most difficult mathematical problems exponentially faster than a conventional computer.

• As of 2013, it is still in experimental phase.

Page 28: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

28

• 2003-2006 : The Internet becomes social!

Page 29: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

29

2007• Smart phones revolutionize the way we access the internet and how we perceive computers.

Page 30: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

30

2010• Tablets like the iPad are introduced, another way to access the internet and do computing.

Page 31: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

2014

Mobile devices use for web traffic overtake desktop computers use for the first time

Page 32: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

32

Page 33: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

33

Computer Systems

• Computers are electronic systems that can transmit, store and manipulate information (data).

• Data can be numeric, character, graphic and sound.

• For beginner programmers, the two most important are character and numeric.

• To manipulate data, a computer needs a set of instructions called a program.

• To write such programs is the object of thiscourse.

Page 34: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

34

Algorithms

An algorithm is a series of instructions on how to solve the problem. We need algorithms before we can write programs.

Algorithms have the following characteristics:• Precision: must give the correct results.• Uniqueness: same inputs will give the same results.• Finiteness: it must stop eventually.• Input: most algorithms need input.• Output: the answers are the outputs.• Generality: must work with multiple data sets

Page 35: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

35

Computer Systems

3 types of computer systems:

• Mainframes and minicomputers• Workstations• Personal computers

Page 36: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

A. HardwarePhysical components that together provide the functionality required by a computing machineCPU (Central Processing Unit) - ALU (Arithmetic Logic Unit) - Internal RegistersMemory - RAM (Random Access Memory) aka Read/Write Memory - ROM (Read Only Memory) -CacheI/O Device -Keyboard -Mouse -Display -Printer

36

INTRODUCTION - A LOOK AT DIGITAL COMPUTATION

Page 37: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

37

B. SoftwareProgramming LanguagesProcedural

• Pascal• Fortran• Basic• Turing• C

Object Oriented• Java• C++

Applications• Word Processors• Spreadsheets• SAS• MATLAB

Operating Systems• Windows• Unix• Linux• MAC-OS

Page 38: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

38

DIGITAL SYSTEMS Digital systems: Systems that use a binary-like notation,

Number representation can be done in different bases, the most frequently used include:

• Base 2 - Binary Number RepresentationAll numbers are shown using only 2 digits, i.e., 0 and 1

• Base 8 - Octal Representation (Oct for short) All numbers are shown using only 8 digits, i.e., 0, 1, 2, …, 6, 7

• Base 10 - Decimal RepresentationAll numbers are shown using only 10 digits, i.e., 0, 1, 2, …, 8, 9

• Base 16 - Hexadecimal representation (Hex for short)

All numbers are shown using only 16 digits, i.e., 0, 1, …, 8, 9, A, B, C, D, E, F

Page 39: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Integer numbers shown in different basesDecimal Binary Oct Hex

0 0 0 0

1 1 1 1

2 10 2 2

3 11 3 3

4 100 4 4

5 101 5 5

6 110 6 6

7 111 7 7

8 1000 10 8

9 1001 11 9

10 1010 12 A

11 1011 13 B

12 1100 14 C

13 1101 15 D

14 1110 16 E

15 1111 17 F

16 10000 20 10

17 10001 21 11 39

Page 40: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Integer Numbers (Unsigned)All numbers are converted in binary:

ex: 9 = 1001

So 9, the integer in a 32-bit system, would look like:(the spaces between the groups of 4 bits are only there for clarity)0000 0000 0000 0000 0000 0000 0000 1001

Always place the number on the right and pad the unused bits with zeros.

Can you find the decimal value of this number?0000 0000 0000 0000 0000 0000 0010 1101

Page 41: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

A. Other bases to Decimal

For any given number (M) in base (n) such as

M)n=md-1 md-2 md-3 … m1 m0

the conversion can be easily as follows:M)10= md-1 x nd-1 + md-2 x nd-2 + md-3 x nd-3 + … + m1 x n1 + m0

For example:725)8=7x82+2x81+5=469)10

101001)2=1x25+1X23+1=41)10

1FBA)16=1x163+Fx162+Bx161+A

=1X4096+15x256+11x16+10=8122)10

41

BASE CONVERSIONS

Page 42: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

B. Conversion Decimal to other basesCan be easily done by consecutive division where dividend is the number itself, the divisor is the new base and the quotient is being discarded and at each step of division the reminder is noted.

For example:

25)10 =?)2

• 25/2=12 1 (This the least significant bit)• 12/2=6 0• 6/2=3 0• 3/2=1 1• 1/2=0 1 (This the most significant bit)

• 25)10 =11001)2

Page 43: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Integer Numbers (Signed)There are many ways to represent negative integers. The simplest method is called sign-and-magnitude. It means using the leftmost bit as a sign bit (1 for negative, 0 for positive). In a 32-bit system that means that the first bit represents the sign, and the other 31 the absolute value of the number.

For example –9 would be:1000 0000 0000 0000 0000 0000 0000 1001

This method has one major drawback, it would allow for two zero values –0, and +0. For that reason, it is not used.

+0: 0000 0000 0000 0000 0000 0000 0000 0000

–0: 1000 0000 0000 0000 0000 0000 0000 0000

Page 44: 1 Bill Gates I BELIEVE IN INNOVATION AND THAT THE WAY YOU GET INNOVATION IS YOU FUND RESEARCH AND YOU LEARN THE BASIC FACTS.

Integer Numbers (Signed) Without a doubt, your personal computer uses a method known as two's complement. A little more complicated than sign-and-magnitude but not that much and it has only one zero value.

To have –9 in two's complement, you invert all the bits in the representation of 9 and add 1.

You can achieve the same result by starting from the right; find the first 1 and invert all the bits to the left of that one.

+9 = 0000 0000 0000 0000 0000 0000 0000 1001

–9 = 1111 1111 1111 1111 1111 1111 1111 0111