cs107 computing for math cs107 computing for math and
play

CS107: Computing for Math CS107: Computing for Math and Science - PowerPoint PPT Presentation

CS107: Computing for Math CS107: Computing for Math and Science and Science Instructor: Prof. Louis Steinberg office: Hill 401 email: lou@cs.rutgers.edu Office hours: by appointment TAs: Andre Cohen acohen @


  1. CS107: Computing for Math CS107: Computing for Math and Science and Science • Instructor: Prof. Louis Steinberg – office: Hill 401 – email: lou@cs.rutgers.edu – Office hours: by appointment • TAs: – Andre Cohen acohen @ cs.rutgers.edu – Xiaoye xiaoye @ cs.rutgers.edu CS107, Prof. Steinberg, f10 Lecture 01 1

  2. CS107: Computing for Math CS107: Computing for Math and Science and Science • Instructor: Prof. Apostolos Gerasoulis – office: Core 328 – email: grasoul@cs.rutgers.edu – Office hours: by appointment • TA: – Nader Boushehrinejadmoradi naderb@cs.rutgers.edu CS107, Prof. Steinberg, f10 Lecture 01 2

  3. CS107: Computing for Math CS107: Computing for Math and Science and Science • Course will use the computer for communication and instruction as much as possible CS107, Prof. Steinberg, f10 Lecture 01 3

  4. Class Web Pages Class Web Pages • http:// http://remus remus. .rutgers rutgers. .edu edu/CS107 /CS107 • – Policies – Syllabus – Assignments – Lecture notes – etc.... – You are assumed to know anything posted. CS107, Prof. Steinberg, f10 Lecture 01 4

  5. Class Web Pages Class Web Pages • Sakai: Sakai: cs cs 107, Fall 2010 107, Fall 2010 • – Announcements – Posting grades – Chat room – Etc. – You are assumed to know anything posted. CS107, Prof. Steinberg, f10 Lecture 01 5

  6. What is CS107? What is CS107? • A course about using computers • Aimed at majors in Math and Science • After this class you should know • Methods for using the computer that will be useful for mathematicians & scientists • Some key ideas in computer science • CS 107 does not prepare you to take further courses in the CS Dept. CS107, Prof. Steinberg, f10 Lecture 01 6

  7. Prerequisite Prerequisite • Calc I – 640:135 or 151 or 153 or 191 – Grade of C or better • No previous programming experience is assumed • We will assume you do know how to use a mouse, web browser, etc. CS107, Prof. Steinberg, f10 Lecture 01 7

  8. Should you take CS107? Should you take CS107? • Math or science major, had calc I: YES • Exceptions: – Computer Science major or minor: NO – Except: unsure about CS: MAYBE – Option B: The Computer-Oriented Mathematics Major: NO CS107, Prof. Steinberg, f10 Lecture 01 8

  9. Grade based on Grade based on • Homework • Midterm exam • In-lecture quizzes • Final exam CS107, Prof. Steinberg, f10 Lecture 01 9

  10. Textbooks Textbooks Introduction to Scientific Computation and Programming Daniel T Kaplan Brooks/Cole The Maple Book Frank Garman Chapman & Hall/CRC CS107, Prof. Steinberg, f10 Lecture 01 10

  11. What is a computer? What is a computer? CS107, Prof. Steinberg, f10 Lecture 01 11

  12. What is a computer? What is a computer? • A machine that follows instructions • Note the anthropomorphism here CS107, Prof. Steinberg, f10 Lecture 01 12

  13. Anthropomorphism: Anthropomorphism: Use of a term normally applied to people when speaking of something that is not a person • An analogy • Useful but dangerous – What is the same – What is different CS107, Prof. Steinberg, f10 Lecture 01 13

  14. How can a machine follow How can a machine follow instructions? instructions? • Example: Washing machine controller – Controls hot water, cold water, drain, motor CS107, Prof. Steinberg, f10 Lecture 01 14

  15. Hot Wash, Warm Rinse Hot Wash, Warm Rinse Peg H C D M No Peg CS107, Prof. Steinberg, f10 Lecture 01 15

  16. Washing Machine Instructions Washing Machine Instructions • A pattern of physical objects (pegs) – Physically causes the specified behavior CS107, Prof. Steinberg, f10 Lecture 01 16

  17. Computer Instructions Instructions Computer • A pattern of electrical voltages – Physically causes the specified behavior Random Access Memory 5 volts 0 volts CS107, Prof. Steinberg, f10 Lecture 01 17

  18. Washing Machine Language Washing Machine Language • People can read, write, think about the pattern without really having the pegs • Patterns can be thought of as a language for expressing washing machine instructions CS107, Prof. Steinberg, f10 Lecture 01 18

  19. Anthropomorphism Alert Anthropomorphism Alert • How is washing machine language like a human (“natural”) language? • How is it different? CS107, Prof. Steinberg, f10 Lecture 01 19

  20. Computer Machine Language Machine Language Computer • People can read, write, think about the pattern without really having the voltages • Patterns can be thought of as a language for expressing computer instructions CS107, Prof. Steinberg, f10 Lecture 01 20

  21. Washing Machine Languages Washing Machine Languages • Each washing machine operation does a very small amount of work • People would find it tedious and error prone to instruct their washers in this language • So, we have a higher level language – Warm wash, cold rinse CS107, Prof. Steinberg, f10 Lecture 01 21

  22. Computer Languages Languages Computer • Each computer operation does a very small amount of work • People would find it tedious and error prone to instruct their computers in this language • So, we have a higher level language – Matlab – Java, Basic, Fortran, C, Lisp, ... CS107, Prof. Steinberg, f10 Lecture 01 22

  23. Washing Machine Languages Washing Machine Languages • There is a fixed set of primitive operations – Hot, Cold, Drain, Motor • And a way of combining operations – Rows obeyed in sequence • We have to build behavior we want out of the primitives available – Hot + Cold => Warm CS107, Prof. Steinberg, f10 Lecture 01 23

  24. Computer Languages Languages Computer • There is a fixed set of primitive operations • And a way of combining operations • We have to build behavior we want out of the primitives available CS107, Prof. Steinberg, f10 Lecture 01 24

  25. Is a Washing Machine a Is a Washing Machine a Computer? Computer? • A computer is a machine that follows instructions and processes data CS107, Prof. Steinberg, f10 Lecture 01 25

  26. Data Data • Numbers, words, pictures, … • Data processing – What Kaplan text calls “computation” – Any process that transforms some data into other data, e.g. addition CS107, Prof. Steinberg, f10 Lecture 01 26

  27. Representation Representation • In a computer, data embodied as charge or voltage – E.g.: 0 volts means 0, 5 volts means 1 – A “bit”: a 2-way choice, e.g. 0 volts vs 5 volts • Data is represented by groups of bits – E.g.: 3 bits gives 8 patterns: 000 001 010 011 100 101 110 111 CS107, Prof. Steinberg, f10 Lecture 01 27

  28. Translation Translation • Problem: pegs & switches understand only machine language • How can we get instructions in higher level language obeyed? • Translation: – “warm wash, cold rinse” dial selects a set of pegs CS107, Prof. Steinberg, f10 Lecture 01 28

  29. Translation Translation • Problem: transistors understand only machine language • How can we get instructions in higher level language obeyed? • Translation: – Instructions are also data – A program does the translation CS107, Prof. Steinberg, f10 Lecture 01 29

  30. Grammar Grammar • To make it easier to translate, a program must have a structure that obeys a grammar – simple but rigid rules CS107, Prof. Steinberg, f10 Lecture 01 30

  31. A Program A Program is more like a mechanism you build than a sentence you say. CS107, Prof. Steinberg, f10 Lecture 01 31

  32. Kinds of Knowledge Kinds of Knowledge • Knowing that – Knowing a fact, e.g. rules of Chess • Knowing how – Knowing how to use facts to achieve a goal, e.g. how to win at chess CS107, Prof. Steinberg, f10 Lecture 01 32

  33. E.G., Algebra E.G., Algebra • Knowing that If X = Y then X + a = Y + a • Knowing how – To solve 3*x - 5 = 10, start by adding 5 to both sides of the equation 3*x - 5 + 5 = 10 + 5 3*x = 15 CS107, Prof. Steinberg, f10 Lecture 01 33

  34. To Construct a Program To Construct a Program Is 5% “Know that” and 95% “Know how” CS107, Prof. Steinberg, f10 Lecture 01 34

  35. Learning “ “Knowing How Knowing How” ” Learning • The only way to learn “How” is practice • Only way to learn most of the course material is to do homework • Purpose of lecture and textbook is to prepare you to do this work CS107, Prof. Steinberg, f10 Lecture 01 35

  36. Extra Help Extra Help • For some people writing a program is very hard. – Even some people who do very well in other courses • Extra help will be available – See Prof. Steinberg or a TA – Do so as soon as possible if you find the homework extremely hard • Everyone should be able to pass this class, with hard work. CS107, Prof. Steinberg, f10 Lecture 01 36

  37. Matlab Matlab • Matlab is: – A programming language – A library of programs and pieces – An Interactive Development Environment (IDE) – A program that helps you build and test programs CS107, Prof. Steinberg, f10 Lecture 01 37

  38. Matlab as a Calculator as a Calculator Matlab • E.g., convert 75 degrees Fahrenheit to Celsius • E.g. convert $100 to Euros ($1 = .79 Eur.) • E.g. wall area of a room 10’ x 12’ x 8’ • Note: precedence • Note: infix vs prefix form • Note: lack of units CS107, Prof. Steinberg, f10 Lecture 01 38

Recommend


More recommend