This preview shows pages 1–12. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Introduction to Computing Using Matlab CS1112 Fall 2009 (CIS1121) Professors C. Van Loan & D. Fan http://www.cs.cornell.edu/courses/cs1112/ August 27, 2009 Lecture 1 2 Todays lecture An illuminating problem CS1112 philosophies & syllabus What is computer programming? Choosing between CS111 2 & CS111 Course logistics/policies (highlights) August 27, 2009 Lecture 1 3 An illuminating problem: computing square roots Suppose A > 0 Observation: If A is the area of a square, then I can just measure the side lengththat is Idea: Make a square with area A Real task: Make a sequence of increasingly square rectangles, each with area A A August 27, 2009 Lecture 1 4 How to make a rectangle more square? If a square and a rectangle both have area A then is between the length and width of the rectangle A A/L Recipe: L new = (L + A/L) / 2 Current: Next: L L new A/L new An improvement strategy The average of the length and width. August 27, 2009 Lecture 1 6 A Matlab program to make increasingly square rectangles % The first rectangle... L1 = A; W1 = 1; % The second rectangle... L2 = (L1+W1)/2; W2 = A/L2; % The third rectangle... L3 = (L2+W2)/2; W3 = A/L3; % and so on... The progression of rectangles Length Width 9.000000000000000 1.000000000000000 5.000000000000000 1.800000000000000 3.400000000000000 2.647058823529412 3.023529411764706 2.976653696498055 3.000091554131380 2.999908448662588 3.000000001396984 2.999999998603016 August 27, 2009 Lecture 1 8 Some conclusions from square root finding problem It paid to have a geometric sense A complicated computation was reduced to a sequence of elementary calculations A program is like a formula (or sequence of formulas) August 27, 2009 Lecture 1 9 Course Goals Develop your computational senses , senses that you need in computer problemsolving Develop a facility with the Matlab programming environment August 27, 2009 Lecture 1 10 A sense of geometry August 27, 2009 Lecture 1 12 A sense of complexity What is the best itinerary to visit Boston, Miami, LA, Dallas ?...
View
Full
Document
 Fall '08
 DAISYFAN
 Computer Programming

Click to edit the document details