Lecture 1: Introduction to CS 3220 David Bindel 24 Jan 2011 Plan - - PowerPoint PPT Presentation

lecture 1 introduction to cs 3220
SMART_READER_LITE
LIVE PREVIEW

Lecture 1: Introduction to CS 3220 David Bindel 24 Jan 2011 Plan - - PowerPoint PPT Presentation

Lecture 1: Introduction to CS 3220 David Bindel 24 Jan 2011 Plan for today What is scientific computing about? What is this class about? Workload and prerequisites Logistics and course policies The Big Computational Science &


slide-1
SLIDE 1

Lecture 1: Introduction to CS 3220

David Bindel 24 Jan 2011

slide-2
SLIDE 2

Plan for today

◮ What is scientific computing about? ◮ What is this class about? ◮ Workload and prerequisites ◮ Logistics and course policies

slide-3
SLIDE 3

The Big Computational Science & Engineering Picture

Application Analysis Computation

slide-4
SLIDE 4

Applications Everywhere!

These tools are used in more places than you might think:

◮ Climate modeling ◮ CAD tools (computers, buildings, airplanes, ...) ◮ Control systems ◮ Computational biology ◮ Computational finance ◮ Machine learning and statistical models ◮ Game physics and movie special effects ◮ Medical imaging ◮ Information retrieval ◮ ...

slide-5
SLIDE 5

Application: Better Devices

slide-6
SLIDE 6

The Mechanical Cell Phone

filter Mixer Tuning control ... RF amplifier / preselector Local Oscillator IF amplifier /

slide-7
SLIDE 7

A Simple Circuit

AC

C0

Vout Vin

Lx Cx Rx

slide-8
SLIDE 8

An Electromechanical Circuit

DC

AC

Vin Vout

slide-9
SLIDE 9

Modeling Damping and Radiation

PML region Wafer (unmodeled) Electrode Resonating disk

Ingredients:

◮ Physics: Radiation, thermoelasticity ◮ Numerics: Structured eigensolvers, model reduction ◮ Software: HiQLab

slide-10
SLIDE 10

Damping: Devil in the Details!

Film thickness (µm) Q 1.2 1.3 1.4 1.5 1.6 1.7 1.8 100 102 104 106 108

Simulation and lab measurements vs. disk thickness

slide-11
SLIDE 11

Application: Resonance and Metastable Behavior

slide-12
SLIDE 12

Application: Computer Network Tomography

WAN

slide-13
SLIDE 13

A Possible Problem

WAN

slide-14
SLIDE 14

Find and Fix or Route Around?

WAN

slide-15
SLIDE 15

Linear Algebra of Paths

slide-16
SLIDE 16

Application: Detecting Overlapping Communities

slide-17
SLIDE 17

Linear Algebraic View

=

ˆ A ≈ CDCT

slide-18
SLIDE 18

What is this class about?

Application Analysis Computation

slide-19
SLIDE 19

What is this class about?

Our goal: Use numerical methods wisely

◮ Numerical methods = algorithms for continuous problems ◮ What about applications and analysis?

◮ Need applications to ask meaningful questions ◮ Need analysis to understand method properties ◮ We will focus on numerical methods, but these still matter

◮ The ideal: fast, accurate, robust methods for cool problems

slide-20
SLIDE 20

Topics covered

I plan to cover (roughly):

◮ Intro and basic concepts ◮ Numerical linear algebra ◮ Nonlinear equations and optimization ◮ Interpolation, differentiation, and integration ◮ Solving differential equations ◮ Random numbers and simulation

To follow, you will need:

◮ Basic multivariable calculus ◮ Some linear algebra ◮ Familiarity with MATLAB

slide-21
SLIDE 21

Logistics

You will be responsible for information from:

◮ Lecture: MW 10:10-11 – mix of slides, board ◮ Section: misc times Th-F – questions, practice problems ◮ Readings:

◮ Heath, Scientific Computing: An Introductory Survey ◮ Moler, Numerical Computing with MATLAB (online is fine)

If you miss a class, get someone’s notes! You can ask questions via the newsgroup or in office hours: Bindel TBA TA TBA

slide-22
SLIDE 22

Workload

◮ Graded work:

Homework 8 × 5% (lowest dropped) Projects 4 × 7% Prelims 2 × 8% Final 1 × 16%

◮ Late project grading:

< 2 days late 10% off score < 1 week late Pass/fail – pass receives 50% > 1 week No credit

◮ Homework may not be late. ◮ Regrade requests must be within one week of return.

slide-23
SLIDE 23

Course policies

◮ Collaboration

◮ Projects can be done in pairs; all else is solo work! ◮ Do talk to each other about general ideas ◮ Don’t claim work of others as your own ◮ Cite any online references, hints from the TA, or tips from

classmates that you use

◮ Academic integrity

◮ We expect academic integrity from everyone ◮ When in doubt on details: talk to us (and cite!)

◮ Emergency procedures

◮ If there’s a major campus emergency, we’ll adapt ◮ Information will be posted on the web page and newsgroup

slide-24
SLIDE 24

Detailed syllabus

http://www.cs.cornell.edu/~bindel/class/ cs3220-s11/syllabus.html

slide-25
SLIDE 25

Onward!

Let’s get a taste of approximation and error analysis. Let the games begin!

slide-26
SLIDE 26

The name of the game

◮ I have a problem for which the exact answer is x. ◮ I compute, but with finite precision, and get ˆ

x.

◮ I want ˆ

x to have small relative error:

◮ Absolute error is (ˆ

x − x).

◮ Relative error is (ˆ

x − x)/x.

slide-27
SLIDE 27

An arithmetic overview

◮ IEEE floating point arithmetic: like scientific notation, but

with 53 binary digits ≈ 16 decimal digits).

◮ Exact result, correctly rounded for basic floating point

  • perations (add, subtract, multiply, divide, square root).

◮ This means we do basic operations to high relative

  • accuracy. For example,

fl(x + y) = (x + y)(1 + δ), where |δ| < ǫmachine ≈ 10−16.

◮ What happens when I do a sequence of steps?

slide-28
SLIDE 28

Archimedes method

sin(2−2π) 1 2−2π

◮ Inscribe a 2k-gon in the unit circle. ◮ Approximate π ≈ 2k sin(2−kπ).

slide-29
SLIDE 29

Archimedes method

Remember the double-angle identity for sines? sin(2θ) = 2 sin(θ) cos(θ) Therefore: sin2(2θ) = 2 sin2(θ)(1 − sin2(θ)) Algorithm to compute xk = sin2(2−kπ):

◮ Start from x2 = 1/2 ◮ Compute x3, x4, . . . with the quadratic formula via

x2

k − xk + 1

4xk−1 = 0.

◮ sk = 2k√xk approximates π

slide-30
SLIDE 30

Archimedes method

% s = lec01pi(kmax) % % Compute semiperimeters s(k) of 2^k−gons for k = 2:kmax. function s = lec01pi(kmax) x = zeros(1,kmax); x(2) = 0.5; for k = 3:kmax x(k) = ( 1 − sqrt(1−x(k−1)) )/2; end s = 2.^(1:kmax) .∗ sqrt(x);

slide-31
SLIDE 31

The errors of Archimedes

The code implicitly computes sk = 2k sin(2−kπ) Absent rounding, what is the relative error |sk − π|/π? Hint: sin(x) = x − 1 6x3 + O(x5)

slide-32
SLIDE 32

Archimedes, despair!

5 10 15 20 25 30 10−10 10−8 10−6 10−4 10−2 100 k |ˆ sk − π|/π

slide-33
SLIDE 33

The problem

Note that x29 ≈ 2−58π2 ≈ 3.4 × 10−17 What happens when we compute ˆ x30? (We analyze the problem in class – you’ll fix it in homework!)

slide-34
SLIDE 34

Cancellation

Suppose bold digits are correct: 1.093752543 − 1.093741233 = 0.000011310 Inputs have six correct digits. Output has only one!

slide-35
SLIDE 35

Another example

The integrals En := 1

0 xnex−1 dx can be evaluated by

E0 = 1 − 1/e En = 1 − nEn−1. True values satisfy 1 e(n + 1) < En < 1 n + 1 and En ≈ 1/(n + 1) for n large.

slide-36
SLIDE 36

Disaster!

2 4 6 8 10 12 14 16 18 20 0.5 1 1.5 n ˆ En 1/(n + 1)

slide-37
SLIDE 37

The moral

Scientific computing is not all about error analysis. ... but clearly error analysis matters!