Top Banner
Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are genetically very similar. In a pioneering paper, Nadeau and Taylor, 1984 estimated that surprisingly few genomic rearrangements (about 200) have happened since the divergence of human and mouse 75 million years ago. The genomic sequences of human and mouse provide evidence for a larger number of rearrangements than previously thought and shed some light on previously unknown features of mammalian evolution. In particular, they provide evidence for extensive re-use of breakpoints from the same relatively short regions and reveal a great variability in the rate of micro-rearrangements along the genome. Our analysis also implies the existence of a large number of very short "hidden" synteny blocks that were invisible in comparative mapping data and were ignored in previous studies of chromosome evolution. These results suggest a new model of chromosome evolution that postulates that breakpoints are chosen from relatively short fragile regions that have much higher propensity for rearrangements than the rest of the genome. Pavel Pevzner, compuatational biologist and gunslinger, UCSD
49

Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Jan 17, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Nelson Series Talk

Wed, 9/15 7:00 pm in Galileo Macalister

Transforming Mice into Men

Despite some differences in appearance and habits, men and mice are genetically very similar. In a pioneering paper, Nadeau and Taylor, 1984 estimated that surprisingly few genomic rearrangements (about 200) have happened since the divergence of human and mouse 75 million years ago. The genomic sequences of human and mouse provide evidence for a larger number of rearrangements than previously thought and shed some light on previously unknown features of mammalian evolution. In particular, they provide evidence for extensive re-use of breakpoints from the same relatively short regions and reveal a great variability in the rate of micro-rearrangements along the genome. Our analysis also implies the existence of a large number of very short "hidden" synteny blocks that were invisible in comparative mapping data and were ignored in previous studies of chromosome evolution. These results suggest a new model of chromosome evolution that postulates that breakpoints are chosen from relatively short fragile regions that have much higher propensity for rearrangements than the rest of the genome. Pavel Pevzner,

compuatational biologist and gunslinger, UCSD

Page 2: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

CS 5 Reminders

• HW 1 - reading wk 1’s and wk 2’s online text

• HW 2 - 4 problems due Sun., 9/12 Mon., 9/13 M,T sections W,Th sections

@ 11:59 pm

Hw2Pr1) Writing, compiling, and running the “Hello, World!” program

Hw2Pr2) Abstract(ion) Art

Hw2Pr3) A printing puzzle...

Hw2Pr4) Artificial Intelligence?

Last time

This time

Grading80% of each Hw is for correctness2/10 or 3/15 points for commenting/style0 points if the code does not compile!

all points if it completely works a few points off if it does not handle some of the tests...0 points if it doesn’t mostly work

Page 3: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

CS 5 Help!

• Looking for HW help? There are tutors available...

• Friday 8:00 am -- optional recitation section -- Q & A

Fri., Sat., Sun. afternoonsSun., Mon. evenings

both in Parsons and Linde Activities Center (LAC) computer labs

• Email/call me if you have concerns... [email protected], 7-8990

see the CS 5 web page for a readable version of this list…

Page 4: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

• Download a new HW zip file

Steps for handling HW problems

• Submit the CS5App.java file in the source_code folder

• Unzip it (easiest way: right-click then choose Winzip -> Extract to here)

• Read the problem (!)

• Write the new program

• Test it thoroughly

• Check to be sure that your code appears after submitting.

• Resubmit anytime up to the deadline.

Submit only CS5App.java -- it will have this icon on the

PC. This is your source code!

Double-click the CS5hw.jcw file to start

JCreatorCS5hw.jcw

• Download and replace/copy into CS5App.java elsewhere [optional]

Page 5: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Setting up on your own machine

Java a programming language available from Sun Microsystems, Inc.

JCreator a code editor with LOTS of helpful buttons (for the PC)

j2sdk1.4.1_05 or j2sdk1.4.2 or jdk1.3.1_09 or ...

will be in your C:\ drive at the top level

comes supplied with all Mac OS X systems

available for almost all operating systems

needs to know where java is (easiest way to do this == reinstall)

XCode an excellent code editor that comes with Mac OS X v. 10.3

j2sej2ee

javascript

java editions

diff. language

Both available for download from www.cs.hmc.edu/~dodds/cs5/install.html

Page 6: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Today

• What this guy has to say about CS 5

• *%+/+-%*%*! :

• Talking back: Output and input with H

Java or a frustrated programmer?

• Variables -- the computer science constantJohn Searle

Page 7: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Printing in Java

Hw2Pr1) Writing, compiling, and running the “Hello, World!” program

Hw2Pr2) Abstract(ion) Art

Hw2Pr3) A printing puzzle...

Hw2Pr4) Artificial Intelligence?

26 L of the A1 W on a U

To print:

Java code:

Text output problems...

Graphics

Page 8: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

\ : Not to be taken literally

How would you print this ?

200 = “D” for “PG”

How about \no/

rules!

?

Page 9: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Thinking like a machine...

John Searle’s view of a computer’s mind.

This person runs around looking up appropriate outputs to various inputs given in a foreign language.

understanding ?

This is all that computers would be doing if they were conversing with us… .

the computer

Page 10: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Achieving Intelligence

This person runs around looking up appropriate outputs to various inputs given in a foreign language.

understanding ?

This is all that computers would be doing if they were conversing with us… .

the computer

Hw2Pr4) Artificial Intelligence?

Perhaps we’re trying TOO hard to achieve human-level behavior!

Page 11: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

A look inside

Storage Workspace

...

Page 12: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Variables ~ Real baggage

...

Storage Workspace

Variables == bags (or boxes)

Each variable is labeled with 2 things: type name

type: name:

type: name:

type: name:

Each variable may (or may not) have a value

This value is the contents of the box…

value value value

Page 13: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Variables

String s;

declares a variable with • name s

• type String

String myRidiculouslyLongStringVariableName;

declares a variable with • name myRidiculouslyLongStringVariableName• type String

inner casing

Page 14: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Packing one’s bags

Both of these boxes my and s are empty!

public static void main(String[] args)

{

String s;

String my;

}

Page 15: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Packing one’s bags

public static void main(String[] args)

{

String s;

String my;

s = “hark… a shark!”;

my = “t”;

}

• type• name

• type• name

String s

String my

hark… t

Page 16: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

= “set equal to”

public static void main(String[] args)

{

String s;

String my;

s = “hark… a shark!”;

my = “t”;

s = “ha”;

s = my;

}

Assignment statements

Page 17: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Declare vs. define

declaring two variables

defining the variables

public static void main(String[] args)

{

String s;

String my;

s = “hark… a shark!”;

my = “t”;

s = “ha”;

s = my;

}

redefining the variables

Page 18: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

All boxed up && ready to go

public static void main(String[] args)

{

String s = “ha”;

String my = “t”;

H.pl(s);

H.pl(“s”);

H.pl(s + “mle” + my);

}

declaring && defining

Page 19: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

+ concatenates strings

public static void main(String[] args)

{

String s = “ha”;

String my = “t”;

H.pl(s + s + s);

// use s twice to print “hark… a shark!”

H.pl(s + “ ” + s + “ - ” +

my + s + my + “ ” + s + my + “!”);

}

Page 20: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Why use variables at all?

H.nl(); returns a String from the user

What does this mean?

It means that you can put H.nl() ’s string into a String variable!

String s;s = H.nl();

// printing that line

INPUT

H.pl(s);

Another way to look at it:

H.nl() can be used anywhere “hi” can…

// storing a line of user input

Page 21: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

An example to digest...

public static void main(String[] args)

{

H.pl(“Hello. Please type the name of ” +

“your favorite Platt food.”);

H.nl();

H.pl(“Aha! I’ve tricked you. That ” +

“ can’t be your favorite\n” +

“Platt food, because Platt food\n” +

“does not exist!”);

} keep lines to less than 80 chars long

Hw2Pr4) Artificial Intelligence?

Page 22: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

An example to digest...

public static void main(String[] args)

{

H.pl(“Hello. Please type the name of ” +

“your favorite Platt food.”);

H.nl();

H.pl(“Aha! I’ve tricked you. That ” +

“ can’t be your favorite

Platt food, because Platt food\n” +

“does not exist!”);

}

Strings can not be spread over multiple lines!

But what if we want to repeat the user’s input?

Page 23: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

An example to digest...

public static void main(String[] args)

{

String favDish = “”;

H.pl(“Hello. Please type the name of ” +

“your favorite Platt food.”);

favDish = H.nl();

H.pl(“Aha! I’ve tricked you. ” + favDish +

“ can’t be your favorite\n” +

“Platt food, because Platt food\n” +

“does not exist!”);

}

declare a variable -- and it’s always good to initialize it

use the variable by assigning something to it or printing it or however you’d like…

Page 24: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Style Matters...

H.pl(“Aha! I’ve tricked you. ” + favDish

“ can’t be your favorite\n” +

“ Platt food, because Platt food\n” +

“ does not exist!”);

H.p(“Aha! I’ve tricked you. ” + favDish);

H.pl(“ can’t be your favorite”);

H.pl(“ Platt food, because Platt food”);

H.pl(“ does not exist!”);

handling lots of

text

or

• be sure to have a complete start-of-file comment

• use 1-line comments to explain complicated code

• be sure you consistently indent within code blocks

• be sure you line up matching punctuation (curly braces)

keep lines to less than 80 chars long

Page 25: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Other types...

int x;

declares a variable with • name x

• type int

with an integer value …, -2, -1, 0, 1, 2, ...

double d;

declares a variable with • name d

• type double

with a double-precision value -17.0, 3.14159, etc.

Page 26: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Actual computation !

public static void main(String[] args)

{

int x = 5;

double d = 1957.75;

H.pl( x + x );

H.pl( “CS ” + x );

H.pl( “HMC opened in ” + d );

x + x * d + ( d % x ); // What ?

}

that’s what I’m here for...

Page 27: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Java Operations

+-/

addition with numbers; concatenation with strings

subtraction multiplication

division

If both sides are ints, so is the result -- with rounding toward zero.

*% mod (remainder)

10/2.5

10/3

10%311%3

11.5%312%3

13%7

Page 28: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Not your type ?

int x = 5;

double d = 1957.75;

How do you print out the following using x and d?

Suppose you have the variables

5.0

HMC opened in 1957

Page 29: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Casting

(int)(double)

The expressions

int x = 5;

(double)x produces 5.0

cast values of one type to another.

(int)10.999 produces 10

but x remains 5 !

Page 30: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

int x = 5;double d = 42.0;

Using only the two variables above, along with nonnumeric Strings, write code to print these four things (the first one is done for you…):

“Quiz”

nada is 0

one\two is 0.5

“two” is 2

10000Optional Ex. Cr.: Try to use the fewest opertions possible…

H.pl(“nada is ” + (x-x));

Answers:

Names:

Page 31: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Hw2Pr3) A printing puzzle...

Print exactly this message.

/-------------------------------------\| Welcome to the frugal arithmetician |\-------------------------------------/

The goal is to print several numbers using two variables:

an integer, x, which equals 5 a double, d, which equals 42.0

along with the operators +, -, *, /, %, (int), and (double) .

Five is 5, and ten is 10.

"one" is 1"three" is 3you're "young" til 36"one-third" is 0.33“ten thousand" is 10000"pi" is 3.14159

/-------\| Bye ! |\-------/

but with only nonnumeric Strings and the two variables int x = 5;

double d = 42.0;

and without digit-by-digit String addition!

Page 32: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Hw2Pr3) A printing puzzle...

10000H.p(x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x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+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x);

Extra Credit: In as few operations as possible!

Page 33: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

What’s really going on

H.pl(“x+d is ” + x + d);

int x = 5;

double d = 42.0;

String + int

“x+d is 5”

creates a String

String + doublecreates a String

“x+d is 542.0”

parentheses are important !

Page 34: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Maybe a little less precision…

H.pl( 5/3.0 );

1.6666666666666667

Java’s default is maximum precision:

H has some built-in formatting commands:

H.pl( H.fmt(5/3.0) );

1.667

H.pl( H.fmt(5/3.0,4) );

1.6667

Page 35: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

What Java is thinking *%*/?!

H.pl( “five-thirds is ” + d );

double d = 5/3.0;

five-thirds is 1.6666666666666667

H.fmt(d,4);

H.pl( “five-thirds is ” + H.fmt(d,4) );

five-thirds is 1.6667

the only way to change a variable is with the = operator!

but we don’t want to change d, we only want to change the String that’s printed!

Page 36: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

H reference

Output

H.pl(x)      prints x followed by a newline. H.pl()      prints just a newline. H.p(x)      prints just x, with no newline following

H.fmt(s)     returns a String for storing or printing: 3 places after the decimal pointH.fmt(s,p)     returns a String for storing or printing: p places after the decimal pointH.fmt(s,p,w)     returns a String for storing or printing: w is the minimum width of the output StringH.fmt(s,p,w,HMCOutput.RIGHT)     same as above, but puts the number to the right of the output

String. Also available: HMCOutput.CENTER and LEFT.

Input

H.ni()      returns the next integer the user types or has typed. H.nw()      returns the next word the user types or has typed as a String. H.nd()      returns the next double the user types or has typed. H.nl()      returns the next line of text the user types as a String. H.nc()      returns the next char of text the user types as a char. H.nanyc()      returns the next char, even if it’s whitespace. Good for pauses: “Hit Enter to continue...”

This list (and more) available from http://www.cs.hmc.edu/courses/2004/fall/cs5/HMCSupport.html

Page 37: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Lab Today Mac: M - ZPC: A - J

Hw2Pr1) Writing, compiling, and running the “Hello, World!” program

Hw2Pr2) Abstract(ion) Art

Hw2Pr3) A printing puzzle...

Hw2Pr4) Artificial Intelligence?

Last time

This time

New accounts (should be!) ready at CIS.

Building entry code:

Lab entry code:

But not for Monday’s section…

Page 38: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Abstraction

Artists are mystics rather than rationalists. They

leap to conclusions that logic cannot reach.

-- Sol LeWitt,conceptual artist

Simplicity does not precede complexity, but follows it.

-- Alan Perlis, creator of the first compiler

Page 39: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Abstract(ion) Art

class CS5App { public static void main(String[] args) { GrCanvas art = G.createCanvas(); // the window (canvas) art.add(new GrRectangle(1,3,6,2,Color.red)); // what ?? }}

Page 40: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

Page 41: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

Page 42: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

art.add(GrRectangle( ));

art.add(GrRectangle( ));

Page 43: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Assignment 2, Problem 2

Create the following “work”:

art.add(new GrRectangle(…));art.add(new GrRectangle(…));art.add(new GrRectangle(…));art.add(new GrRectangle(…));

Page 44: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

• Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI

• Measuring it -- what’s possible and what’s not

Computer Science

Information

How many drawing

commands are really

necessary ?

Page 45: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

• Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI

• Measuring it -- what’s possible and what’s not

Computer Science

Information

How many drawing

commands are really

necessary ?

31 kb file23 kb file

Page 46: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

In a nutshell...

Programming is deceptively easy.

– thanks to Steven Pinker

The purpose of computing is insight, not numbers.

– Richard Hamming

Page 47: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

“Quiz”

• Name

• Birthdate

• A place you consider home

• Your favorite _________ is _________.

• Your least favorite ________ is _________.

• Email and School (if not an HMC student)

Be sure to have a photo taken !

Page 48: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

1 102 3 4 5 6 7 8 9

1

0.5

0

1 102 3 4 5 6 7 8 9

1

0.5

0

nsteps = 9

area

xmin = 1.0 xmax = 10.0

Page 49: Nelson Series Talk Wed, 9/15 7:00 pm in Galileo Macalister Transforming Mice into Men Despite some differences in appearance and habits, men and mice are.

Hw2Pr3) A printing puzzle...

1000H.pl(x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x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