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

Preview:

Citation preview

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.

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

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!

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

Programming For Science

This course considers all 5 stepsAll needed for success with computers

What kind of problems are good for computers?

Bad Jobs

Nuclear Weapon Tester Hurricane Spotter New Medicine Tester Economist

Volunteers?

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!

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

Simulation Example

Simulation Example

Simulator Accuracy

Off by almost 100 miles only 24 hours in advance

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

Your Turn

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

Recommended