L1intro - Introduction to Computing Using Matlab CS1112...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computing Using Matlab CS1112 Fall 2011 (CIS1121) Dr. K.-Y. Daisy Fan http://www.cs.cornell.edu/courses/cs1112/
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lecture 1 3 Today’s lecture An illuminating problem CS1112 philosophies & syllabus What is computer programming? Choosing between CS111 2 & CS111 0 Course logistics/policies (highlights)
Image of page 2
Lecture 1 5 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 length—that is Idea: Make a square with area A Real task: Make a sequence of increasingly square rectangles, each with area A A
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lecture 1 6 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
Image of page 4
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.
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lecture 1 8 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...
Image of page 6
The progression of rectangles with area 10 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
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lecture 1 10 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)
Image of page 8
Lecture 1 11 Course Goals Develop your “ computational senses ,” senses that you need in computer problem-solving Develop a facility with the Matlab programming environment
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lecture 1 12 A sense of geometry
Image of page 10
A sense of complexity What is the best itinerary to visit Boston, Miami, LA, Dallas ? 3! = 6 possibilities Add Seattle, NYC Austin, Denver 7! = 5040 If a computer can process 1 billion itineraries a second, how long does it take to solve a 100-city problem?
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
A sense of complexity What is the best itinerary to visit Boston, Miami, LA, Dallas ?
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern