Scientific Computing and

cornawakeSoftware and s/w Development

Nov 4, 2013 (3 years and 7 months ago)

78 views

CS4
-

Introduction to Scientific Computing and Problem Solving

Introduction to

Scientific Computing and
Problem Solving

Instructor:
Maurice Herlihy

Brown Computer Science


2013
-

1.
0

Introduction

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
1

How to use software to solve problems …

In science and engineering

No
prerequesites



Not a
real

programming course!

Not for CS majors!

We will study MATLAB (mostly) …

And Python (toward the end)

Topics: Languages

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
2

MATLAB

Engineering and Scientific computation

Numerical, Data Analysis, Visualization

Python

Scripting Language

Modular Design

Gluing components together

Topics: Skills

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
3

Problem
-
solving techniques and Strategies

Applications to …

Science, Engineering, Economics, …

Software Engineering

Program Design, Style, Debugging …

Algorithms and Data Structures

Math and Science in CS4

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
4

Algebra

Calculus

We will provide equations and explain basics

Biology

Economics

Chemistry

Physics

Trigonometry

CS4
-

Introduction to Scientific Computing and Problem Solving

Calendar


2013
-

1.
5

23 lectures

7
homeworks

1 mid
-
term project

1 mid
-
term exam

2
nd

mid
-
term exam

Other Introductory Classes

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
6

CS 15:
Introduction to Object
-
Oriented Programming

Object
-
oriented programming

Little or no background

Fall semester only

Other Introductory

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
7

CS 15:
Introduction to Object
-
Oriented Programming

Object
-
oriented programming

Little or no background

Fall semester only

CS 17:
Computer Science: An Integrated Introduction

Wider range: Scheme,
OCaml

…,

Some background expected

Fall semester only

Why
Take CS4?

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
8

Use computers for problem solving …

Acquire skills solving computational problems …

Learn to write and design efficient programs …

Impress your friends!

Why
Take CS4?

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
9

Use computers for problem solving …

Acquire skills solving computational problems …

Learn to write and design efficient programs …

Impress your friends!

You will learn to

Create useful apps …

Improve your problem
-
solving skills …

Improve your résumé!

Why
Take CS4?

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
10

Use computers for problem solving …

Acquire skills solving computational problems …

Learn to write and design efficient programs …

Impress your friends!

You will learn to

Create useful apps …

Improve your problem
-
solving skills …

Improve your résumé!

Prerequisite for other courses!

Formal or informal!

CS4
-

Introduction to Scientific Computing and Problem Solving

Why

Not Take CS4?


2013
-

1.
11

You want to be a CS concentrator …

You want to learn to program for real …

You want a “Driver’s Ed” course…

CS4
-

Introduction to Scientific Computing and Problem Solving

CS4 Staff


2013
-

1.
12

Instructor

Maurice Herlihy

CS4
-

Introduction to Scientific Computing and Problem Solving

CS4 Staff


2013
-

1.
13

Instructor

Maurice Herlihy

Head TAs

Jeffrey Lu

Sophie Van Horne

Chau

Tran

CS4
-

Introduction to Scientific Computing and Problem Solving

CS4 Staff


2013
-

1.
14

Instructor

Maurice Herlihy

Head TAs

Jeffrey Lu

Sophie Van Horne

Chau

Tran

TAs

Alexander Bok

Anna Gash

Clara
Kliman
-
Silver

Daniel
Valmas

Dominic Adams

Gregory
Chatzinoff

Jessica Fu

Jonathan Bui

Jordan Shaw

Matthew
Dalcin

Samuel Heft
-
Luthy

Sung
-
Ho Oh

Shreena

Thakore

CS4
-

Introduction to Scientific Computing and Problem Solving

Course
Organization


2013
-

1.
15

Lectures

And sometimes help sessions

Show up and
particpate
!

CS4
-

Introduction to Scientific Computing and Problem Solving

Course
Organization


2013
-

1.
16

Lectures

And sometimes help sessions

Show up and
particpate
!

Weekly Labs

M
Tu

W Thu, 2
-
hour eve slots

Groups of < 30 students

Sign up and attend!

CS4
-

Introduction to Scientific Computing and Problem Solving

Course
Organization


2013
-

1.
17

Lectures

And sometimes help sessions

Show up and
particpate
!

Weekly Labs

MTuSaSu
, 2
-
hour eve slots

Groups of < 30 students

Sign up and attend!

Weekly
homeworks

and two projects

Test your skills!

CS4
-

Introduction to Scientific Computing and Problem Solving

Course
Organization


2013
-

1.
18

Lectures

And sometimes help sessions

Show up and
particpate
!

Weekly Labs

MTuSaSu
, 2
-
hour eve slots

Groups of < 30 students

Sign up and attend!

Weekly
homeworks

and two projects

Test your skills!

TA hours most evenings

Check out the schedule!

CS4
-

Introduction to Scientific Computing and Problem Solving

Course
Organization


2013
-

1.
19

Lectures

And sometimes help sessions

Show up and
particpate
!

Weekly Labs

MTuSaSu
, 2
-
hour eve slots

Groups of < 30 students

Sign up and attend!

Weekly
homeworks

and two projects

Test your skills!

TA hours most evenings

Check out the schedule!

Sign up and attend!

Test your skills!

Instructor’s office hours

By appointment: mph@cs.brown.edu

CS4
-

Introduction to Scientific Computing and Problem Solving

More Course Organization


2013
-

1.
20

Page

www.cs.brown.edu/courses/cs004

Email list

Firefox and Chrome only!

cs004headtas@cs.brown.edu

cs004tas@cs.brown.edu

Lab
Intro Session

Sun Lab, CIT 143


2013
-

1.
21

Monday
-
Thursday

Check Web Page for times

Show up for two hours when convenient

Lab
Intro Session

Sun Lab, CIT 143


2013
-

1.
22

Monday
-
Thursday

Check Web Page for times

Show up for two hours when convenient

No required text

CS4
-

Introduction to Scientific Computing and Problem Solving

Textbooks and Other Resources


2013
-

1.
23

Library Reserves

“MATLAB Programming for
Engineers,” S. J. Chapman

“MATLAB Demystified,” D.
McMahon

Web Tutorials!

CS4
-

Introduction to Scientific Computing and Problem Solving

Your Own MATLAB


2013
-

1.
24

From CIS Software Download page

Windows, Mac

2 GB download

Special class version from
course page

Windows

Smaller

Lab or any public CS cluster

CS4
-

Introduction to Scientific Computing and Problem Solving

What
We Expect
from You


2013
-

1.
25

Come to class regularly

Participate in class

Attend weekly labs

Hand in weekly homework assignments

Work on and hand in the
Matlab

project

Complete the Final Project

Pass exams

Adhere to the Collaboration Policy

CS4
-

Introduction to Scientific Computing and Problem Solving

Grading


2013
-

1.
26

15% Weekly labs

40% Weekly homework assignments

15%
Matlab

Project

10% Take
-
Home Midterm Exam

20%
2
nd

Midterm

No credit
for late assignments

Possible
extra (bonus) points
on
homeworks
/projects

Passing grade (50%)
on the midterm is required

CS4
-

Introduction to Scientific Computing and Problem Solving

Golden Rules


2013
-

1.
27

Participate

If you do not understand, let us know

TAs and instructors are here to help

Respect the TAs

They’re the best part of the course!

You will find them very helpful

But respect their privacy when off duty

Might be you next year!

CS4
-

Introduction to Scientific Computing and Problem Solving

More Golden Rules


2013
-

1.
28

Respect the Collaboration Policy!

Very carefully laid out in the handout which
you will all receive today

And on the course website

Your responsibility:
make sure you fully
understand everything that is in that handout

Failure to understand the policy
is
not
an excuse.

Applications of Computers

& Programs

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
29

Engineering

Space Exploration

Natural Sciences

Cognitive & Brain Science

Medicine

Art, Movies, Music

Business

Lots more …

Engineering

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
30

Computing solutions to
mathematically expressed problems

Solving differential equations

non
-
linear equations

optimization problems

CS4
-

Introduction to Scientific Computing and Problem Solving

Engineering


2013
-

1.
31

Signal and Image Processing

sensor data

EN157 students used
Matlab

programming to do image de
-
blurring

CS19 students built Brown’s
safeRIDE

tracking system

CS4
-

Introduction to Scientific Computing and Problem Solving

Engineering


2013
-

1.
32

Graphical tools (CAD)

Design and improve mechanical
parts, instruments & devices

CS4
-

Introduction to Scientific Computing and Problem Solving

Space Exploration


2013
-

1.
33

Natural Sciences

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
34

Physics & Astronomy

Validate theories by running

computer simulations

CERN: annually collects 1
PetaByte

of data

1,000,000,000,000,000

peta

tera

giga

mega

kilo

100PB of data expected from the

Large
Hadron

Collider!

An Aside from XKCD

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
35

HTTP
://
IMGS
.
XKCD
.
COM
/
COMICS
/
MNEMONICS
.
PNG

Natural Sciences

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
36

Chemistry

Molecular design

3D visualization of molecules

Modeling chemical reactions

Controlling & improving chemical
processes

Bioinformatics

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
37

Cell biology and drug design

Computer models of

cells help us to understand the

principles of life

Human genome

Creation of gene databases

Functional genomics and proteomics: understanding
how genes and proteins act and interact

Cognitive and Brain Science

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
38

“The food is good to eat. Please pass the food.”

Understanding how humans process information

Computational models of
perceptual & cognitive processes

Spectrograms show us how we hear sound

Art, Movies, Music

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
39

New media to express
artistic creativity

Movies

Games

Virtual Reality
(Cave)

Medicine

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
40

Assistance in diagnosis

Signal processing

Enhanced reality and surgical robotics

Process and visualize data …

X
-
ray, sonar,
fMRI

Business

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
41

E
-
Commerce

Knowledge management

Data Mining

Markets and banking

CS4
On a Slide

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
42

Computers are powerful tools


Programs direct a computer to solve a
particular problem

Programmers (like you) create those programs

Let’s begin to learn how…

(For better or worse)

CS4
-

Introduction to Scientific Computing and Problem Solving

Computer

Central

Processing Unit

CPU

Main Memory

RAM


2013
-

1.
43

CS4
-

Introduction to Scientific Computing and Problem Solving

Programming Languages

computer

user

language

“low level”

“high level”


2013
-

1.
44

MATLAB at a Glance

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
45


High
-
level programming language

Development environment
-

software packet

Platform
-
independent programs

Lots of specialized tools

Especially scientific computations

any machine that has MATLAB installed

MATLAB at a Glance

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
46

Rich plotting/graphical capabilities

Interactive programming

Pretty good help tools

MATLAB Example 1

Vertical Motion with Gravity

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
47

2
/
2
gt
ut
s


Stone thrown vertically has
displacement
s

after time
t

given by
the equation:

where
u

is initial velocity of
60m/s

g

is the acceleration due to gravity
(
9.8m/s
2
)

Plot
s

as a function of
t
.

Collaboration Policy Examples


Example 1
-
Lab


Acceptable


You allowed to ask for help, but ultimately, you must write
your own code.

CS4
-

Introduction to Scientific Computing and Problem Solving


2012
-

1.
48

My program keeps
giving me this
error
message …

Maybe you should
convert
tha
t array into a list.

Collaboration Policy Examples


Example 2
-
Lab


Violation!


Each student must write their own code for lab.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
49

My program keeps
giving me this
error
message …

Cut and paste these three
lines into your file …

Collaboration Policy Examples


Example 3
-
Homework


Acceptable


They discuss in
-
class topics without talking about any specific
problems.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
50

What does it mean to
transpose a matrix?

the (
i
,
j
) element of

A
T

is the
(
j
,
i
) element of

A

Collaboration Policy Examples


Example 4
-
Homework


Violation!


You may not look at any code other than your own for
homeworks
.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
51

How
do I
transpose a
matrix in MATLAB?

Here is how I did it …

Collaboration Policy Examples


Example 5
-
Homework


Violation!


Homeworks

must be done individually.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
52

I’ll do problem 3 and
you do problem 4

Deal!

Collaboration Policy Examples


Example 6
-
Projects


Acceptable


Discussing general MATLAB topics and lecture material is
acceptable.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
53

I didn’t follow Prof.
Herlihy’s

discussion of
transmorgrification
.

I think his slides were up
-
side down. Try turning them
around.

Collaboration Policy Examples


Example 7
-
Projects


Violation!


Both parties are guilty, guilty, guilty.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
54

I need to “borrow” a
code snippet for my
project’s UI

Did I remember to
read
-
protect my
project’s UI files?


Collaboration Policy Examples


Example 8
-
Projects


Violation!
but the correct response


It was wrong to ask another student for specifics,
however, student #2 did the right thing in directing student
#1 to TA hours.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
55

Which functions do I call to format
the
transmorgrification

matrix?

I think you should go talk to a TA

Collaboration Policy Examples


Example 9
-
Exam


Violation!


During the exam, no discussion of CS4 is allowed.

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
56

Question #4 is really hard!

Yeah, it took me a while to see the trick

Moss

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
57

Similar Lines

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
58

Similar Blocks of Code

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
59

Another Suspicious Block

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
60

Take Home Message

CS4
-

Introduction to Scientific Computing and Problem Solving


2013
-

1.
61

MATLAB has many useful applications

CS4 will teach you to use MATLAB & Python

So does Python

Read the Collaboration Policy thoroughly

bring the signed agreement to your intro lab section