计算机科学概述 Introduction to Computer Science

36
计计计计计计计 Introduction to Computer Science 计计计 计计计计计计 计计计计 www.jiahenglu.net

description

计算机科学概述 Introduction to Computer Science. 陆嘉恒 中国人民大学 信息学院 www.jiahenglu.net. About the course. This course is an introduction to computer science for computer science and other science and engineering majors having little or no prior programming experience. - PowerPoint PPT Presentation

Transcript of 计算机科学概述 Introduction to Computer Science

Page 1: 计算机科学概述 Introduction to Computer Science

计算机科学概述Introduction to Computer Science

陆嘉恒

中国人民大学 信息学院

www.jiahenglu.net

Page 2: 计算机科学概述 Introduction to Computer Science

About the course

• This course is an introduction to computer science for computer science and other science and engineering majors having little or no prior programming experience.

• The goals of this course are to teach students: – knowledge of the fundamental concepts in computer

science – algorithmic program-solving capabilities – fundamental Java programming skills

Page 3: 计算机科学概述 Introduction to Computer Science

Course homepage

http://datasearch.ruc.edu.cn/jsjgl/

• Please check the course homepage frequently for important announcements and changes to the reading assignments

Page 4: 计算机科学概述 Introduction to Computer Science

Grading

• Homeworks: 50%

• Final exam: 35%

• Research project: 15%

• These are “guidelines” for the final grade

Page 5: 计算机科学概述 Introduction to Computer Science

Homeworks

• There will be five homework assignments

• Each homework (generally) has two parts:– Theory– Programming

• Homeworks will be posted on the course homepage and announced in class

Page 6: 计算机科学概述 Introduction to Computer Science

Exams

• An in-class final exam will be held on the last day of class: Wednesday, July 1

• Exam covers material from readings and lectures (so come to class!)

Page 7: 计算机科学概述 Introduction to Computer Science

Textbooks

• Schneider & Gersting Invitation to Computer Science, Java Version, Third Edition

• Cay Horstmann Big Java, Third Edition

• Both available at Renmin Bookstore

Page 8: 计算机科学概述 Introduction to Computer Science

8

What is Computer Science?(计算机科学的定义)

Page 9: 计算机科学概述 Introduction to Computer Science

9

Let AB and CD be the two given numbers not relatively prime. It is required to find the greatest common measure of AB and CD.

If now CD measures AB, since it also measures itself, then CD is a common measure of CD and AB. And it is manifest that it is also the greatest, for no greater number than CD measures CD.

Euclid’s Elements, Book VII, Proposition 2 (300BC)

Page 10: 计算机科学概述 Introduction to Computer Science

10

What is the difference between

Euclid and Ada?

“It depends on what your definition of ‘is’ is.”

Bill Gates (at Microsoft’santi-trust trial)

Page 11: 计算机科学概述 Introduction to Computer Science

11

Geometry vs. Computer Science(几何与计算机科学)

• Geometry (mathematics) is about declarative knowledge: “what is”

If now CD measures AB, since it also measures itself, then CD is a common measure of CD and AB

• Computer Science is about imperative knowledge: “how to”

Computer Science has little to do with beige (or translucent blue) boxes called “computers” and is not a real science.

Page 12: 计算机科学概述 Introduction to Computer Science

12

Computer Science

“How to” knowledge:

• Ways of describing information processes (computations)

• Ways of predicting properties of information processes

Language

Logic

What kinds of things do we want to predict?

Page 13: 计算机科学概述 Introduction to Computer Science

13

Science, Engineering, Other?(计算机是工程还是科学)

Page 14: 计算机科学概述 Introduction to Computer Science

14

Science?

• Understanding Nature through Observation– About real things like bowling balls, black

holes, antimatter, electrons, comets, etc.

• Math and Computer Science are about fake things like numbers, graphs, functions, lists, etc.– Computer Science is a useful tool for doing

real science, but not a real science

Page 15: 计算机科学概述 Introduction to Computer Science

15

Engineering?

“Engineering is design under constraint… Engineering is synthetic - it strives to create what can be, but it is constrained by nature, by cost, by concerns of safety, reliability, environmental impact, manufacturability, maintainability and many other such 'ilities.' ...”

William Wulf

Page 16: 计算机科学概述 Introduction to Computer Science

16

Apollo Guidance Computer, 1969

1 Cubic FootWhy did they need to fit the guidance computer in the rocket?

Page 17: 计算机科学概述 Introduction to Computer Science

17

Measuring Computers

• 1 bit = smallest unit of information– True or False– 0 or 1– If we start with 2 possible choices, and get 1

bit, we can eliminate one of the choices

Page 18: 计算机科学概述 Introduction to Computer Science

18

How much power?

• Apollo Computer: 30720 bits of changeable memory • Lab machines have 1 GB (RAM)

– 1 Gigabyte = 1024 Megabytes, 1 Megabyte = 1024 Kilobytes, 1 Kilobyte = 1024 Bytes, 1 Byte = 8 bits

> (* 1024 1024 1024 8)

8589934592 ~ 8.6 Billion bits> (round (/ (* 1024 1024 1024 8) 30720))279620

If Apollo Guidance Computer power is 1 inch, you have 4.4 miles!

You have 105 404 times more power than AGC

You will understand thisnotation soon…but don’t worryif you don’t now

Page 19: 计算机科学概述 Introduction to Computer Science

19

0

10,000,000

20,000,000

30,000,000

40,000,000

50,000,000

60,000,000

70,000,000

80,000,000

1969

1972

1975

1978

1981

1984

1987

1990

1993

1996

1999

2002

2005

2008

Computing Power 1969-2008(in Apollo Control Computer Units)

Moore’s “Law”: computing power roughly doubles every 18 months!

Page 20: 计算机科学概述 Introduction to Computer Science

20

Constraints Computer Scientists Face

• Not like those for engineers:– Cost, weight, physics, etc.– If ~20 Million times what people had in 1969 isn’t

enough for you, wait until 2010 and you will have 80 Million times…

• More like those for Musicians and Poets:– Imagination and Creativity– Complexity of what we can understand

Page 21: 计算机科学概述 Introduction to Computer Science

21

So, what is computer science?

• Science– No: its about fake things like numbers, not about

observing and understanding nature

• Engineering– No: we don’t have to deal with engineering-type

constraints

• Liberal Art

Page 22: 计算机科学概述 Introduction to Computer Science

22

Liberal Arts: ~1100

• Illiberal Arts– arts for the non-free: pursued for economic reasons

• Liberal Arts– arts for the free: pursued for intrinsic reasons

Page 23: 计算机科学概述 Introduction to Computer Science

23

The Liberal Arts

Trivium (3 roads)

language

Quadrivium (4 roads)

numbers

Grammarstudy of meaning in written expression

Rhetoriccomprehension of discourse

Logicargument for discovering truth

Arithmetic

Geometryquantification of space

Musicnumber in time

Astronomy

We will see all of these in this class!

Page 24: 计算机科学概述 Introduction to Computer Science

24

Course Expectations

Page 25: 计算机科学概述 Introduction to Computer Science

25

Like Drinking from a Firehose

It may hurt a little bit, and a lot of water will go by you, but you won’t go away

thirsty!

Don’t be overwhelmed!You will do fine.

Page 26: 计算机科学概述 Introduction to Computer Science

26

Help Available

• Me: Jiaheng Lu • Office Hours will be posted (after your

surveys)– Always available by email, if I don’t reply in 24

hours, send again and complain

• Web site: http://datasearch.ruc.edu.cn/jsjgl/– Everything goes on the web, you should visit it often

• Your classmates

Page 27: 计算机科学概述 Introduction to Computer Science

27

What I Expect of You

1. Everything on the Course You should actually read it not just sign it

(you will lose points on PS1 if your submission reveals that you didn’t read it!)

2. You are a “Good Student”

1.Believe knowledge is powerful2.Interested in lots of things, ahead of your

time3.Want to use what you learn to do good

things4.Care more about what you learn than

grades and degree requirements

Page 28: 计算机科学概述 Introduction to Computer Science

28

Background Expected

• Language:– Reasonable reading and writing in English– Understanding of subject, verb and object

• Math:– Numbers, add, subtract, multiply, divide– Exponentiation, logarithms (we will review)

• Logic: and, or, not

• Computer Literacy: read email, browse webIf I ever appear to expect anything else, stop me!

Page 29: 计算机科学概述 Introduction to Computer Science

29

A Course for Everyone!

• No background expected…but challenging even for students with lots of previous CS courses

• Computer Science (future-) majors…but worthwhile even if you don’t take another CS course

Page 30: 计算机科学概述 Introduction to Computer Science

30

First Main Theme:Recursive Definitions

(计算机科学中的递归概念)

Page 31: 计算机科学概述 Introduction to Computer Science

31

What is the longest word in the English language?

Page 32: 计算机科学概述 Introduction to Computer Science

32

According to Guinness

floccipoccinihilipilification

the act of rendering useless

Page 33: 计算机科学概述 Introduction to Computer Science

33

Making Longer Words

antifloccipoccinihilipilification the act of rendering not useless

antiantifloccipoccinihilipilificationthe act of rendering useless

Page 34: 计算机科学概述 Introduction to Computer Science

34

Language is Recursive

No matter what word you think is the longest word, I can always make up a longer one!

word ::= anti-wordIf you have a word, you can always make up a new word by adding anti in front. Since the result is a word, you can make a longer new word by adding anti- in front again.

Page 35: 计算机科学概述 Introduction to Computer Science

35

Recursive Definitions

• We can define things in terms of themselves

• Recursive definitions are different from circular definitions: they eventually end with something real

word ::= anti-word

word ::= floccipoccinihilipilification

Page 36: 计算机科学概述 Introduction to Computer Science

36

Recursive Definitions

Allow us to express infinitely many things starting with a few.

This is powerful!We will see lots of examples in this course.