14
CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Embed Size (px)

Citation preview

Page 1: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

CSC 107 -Programming for Science

Lecture 3:

Simulations & Program Lifecycle

Page 2: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Problem of the Day

Why are manhole covers round?

It is the only shape that guarantees that the cover can not fall in.

Page 3: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Solving Problems

Problem solving key to science & engineeringPhysics -- How does an atom work?Engineering -- Will the bridge collapse?Biology -- What is crawling up my leg?

Computer science investigates how computers can be used to solve problems

Page 4: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Etter’s Problem Solving Method

1. State the problem clearly Will splitting an atom cause unstoppable

explosion?

2. Describe input and output information Input: E = mc2; U235 Output:

3. Work problem by hand or with calculator for simple set of data

Physicists at Manhattan Project did this!

Page 5: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Etter’s Problem Solving Method

4. Develop solution and convert to computer program

Classified by Dept. of Energy

5. Test solution with variety of data Currently happening in Iran & North Korea

Page 6: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Programming For Science

This course considers all 5 stepsAll needed for success with computers

What kind of problems are good for computers?

Page 7: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Bad Jobs

Nuclear Weapon Tester Hurricane Spotter New Medicine Tester Economist

Volunteers?

Page 8: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Problem

Jobs may be dangerous or illegal, or require psychic abilities

Experiments may be costly or unethicalCannot vaccinate people without knowing

side-effects Decisions may be irrevocable

Cannot undo an atomic explosion!

Page 9: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

What is a Simulator?

Emulate system in a way that enables observing the changes/outcomesSystem could be:

single subatomic particle E. coli bacteria Earth’s weather Elevators in Old Main Galaxies

Page 10: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Simulation Example

Page 11: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Simulation Example

Page 12: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Simulator Accuracy

Off by almost 100 miles only 24 hours in advance

Page 13: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

What went wrong?

Real-world systems are very complexEquations have too many variables than we

can write in a programMust simplify world to generate results in

timely mannerMay overlook important variables

Page 14: CSC 107 - Programming for Science Lecture 3: Simulations & Program Lifecycle

Your Turn

Get back into groups of 3 and complete the following (off-line) simulation