Nelson Series Talk - PowerPoint PPT Presentation

About This Presentation
Title:

Nelson Series Talk

Description:

Despite some differences in appearance and habits, men and mice are genetically very similar. ... java editions. diff. language ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 50
Provided by: zachd
Category:

less

Transcript and Presenter's Notes

Title: Nelson Series Talk


1
Transforming Mice into Men
Nelson Series Talk
Wed, 9/15 700 pm in Galileo Macalister
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
2
CS 5 Reminders
  • HW 1 - reading wk 1s and wk 2s online text
  • HW 2 - 4 problems due Sun., 9/12
    Mon., 9/13

_at_ 1159 pm
W,Th sections
M,T sections
Hw2Pr1) Writing, compiling, and running the
Hello, World! program
Last time
Hw2Pr2) Abstract(ion) Art
Hw2Pr3) A printing puzzle...
This time
Hw2Pr4) Artificial Intelligence?
Grading
all points if it completely works a few points
off if it does not handle some of the
tests... 0 points if it doesnt mostly work
80 of each Hw is for correctness 2/10 or 3/15
points for commenting/style 0 points if the code
does not compile!
3
CS 5 Help!
  • Looking for HW help? There are tutors
    available...

Fri., Sat., Sun. afternoons Sun., Mon. evenings
both in Parsons and Linde Activities Center (LAC)
computer labs
see the CS 5 web page for a readable version of
this list
  • Friday 800 am -- optional recitation section --
    Q A
  • Email/call me if you have concerns...
    dodds_at_cs.hmc.edu, 7-8990

4
Steps for handling HW problems
  • Download a new HW zip file
  • Unzip it (easiest way right-click then
    choose Winzip -gt Extract to here)
  • Read the problem (!)
  • Write the new program
  • Test it thoroughly

Double-click the CS5hw.jcw file to start JCreator
CS5hw.jcw
Submit only CS5App.java -- it will have this icon
on the PC. This is your source code!
  • Submit the CS5App.java file in the source_code
    folder
  • Check to be sure that your code appears after
    submitting.
  • Download and replace/copy into CS5App.java
    elsewhere

optional
  • Resubmit anytime up to the deadline.

5
Setting up on your own machine
Java a programming language available from Sun
Microsystems, Inc.
j2sdk1.4.1_05 or j2sdk1.4.2 or jdk1.3.1_09 or ...
will be in your C\ drive at the top level
j2se j2ee javascript
java editions
comes supplied with all Mac OS X systems
diff. language
available for almost all operating systems
JCreator a code editor with LOTS of helpful
buttons (for the PC)
needs to know where java is (easiest way to do
this reinstall)
Both available for download from
www.cs.hmc.edu/dodds/cs5/install.html
XCode an excellent code editor that comes with
Mac OS X v. 10.3
6
Today
  • What this guy has to say about CS 5
  • Variables -- the computer science constant

John Searle
  • /-!

Java or a frustrated programmer?
  • Talking back Output and input with H

7
Printing in Java
Hw2Pr1) Writing, compiling, and running the
Hello, World! program
Graphics
Hw2Pr2) Abstract(ion) Art
Hw2Pr3) A printing puzzle...
Text output problems...
Hw2Pr4) Artificial Intelligence?
26 L of the A 1 W on a U
To print
Java code
8
\ Not to be taken literally
How would you print this ?
200 D for PG
How about
\no/
?
rules!
9
Thinking like a machine...
John Searles view of a computers 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
10
Achieving Intelligence
Hw2Pr4) Artificial Intelligence?
This person runs around looking up appropriate
outputs to various inputs given in a foreign
language.
Perhaps were trying TOO hard to achieve
human-level behavior!
understanding ?
This is all that computers would be doing if they
were conversing with us .
the computer
11
A look inside
Storage
Workspace
...
12
Variables Real baggage
Storage
Workspace
value
value
value
...
type name
type name
type name
Variables
bags (or boxes)
type name
Each variable is labeled with 2 things
Each variable may (or may not) have a
value
This value is the contents of the box
13
Variables
String s
declares a variable with
  • name s
  • type String

String myRidiculouslyLongStringVariableName
inner casing
declares a variable with
  • name myRidiculouslyLongStringVariableName
  • type String

14
Packing ones bags
public static void main(String args) String
s String my
Both of these boxes my and s are empty!
15
Packing ones bags
public static void main(String args) String
s String my s hark a shark! my
t
hark
t
  • type
  • name
  • type
  • name

String s
String my
16
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
17
Declare vs. define
public static void main(String args) String
s String my s hark a shark! my
t s ha s my
declaring two variables
defining the variables
redefining the variables
18
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
19
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 !)
20
Why use variables at all?
H.nl()
returns a String from the user
INPUT
What does this mean?
It means that you can put H.nl() s string
into a String variable!
String s
s H.nl()
// storing a line of user input
H.pl(s)
// printing that line
Another way to look at it
H.nl() can be used anywhere hi can
21
An example to digest...
Hw2Pr4) Artificial Intelligence?
public static void main(String args)
H.pl(Hello. Please type the name of
your favorite Platt food.) H.nl()
H.pl(Aha! Ive tricked you. That
cant be your favorite\n Platt food,
because Platt food\n does not
exist!)
keep lines to less than 80 chars long
22
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! Ive tricked you. That
cant 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 users input?
23
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! Ive
tricked you. favDish cant be your
favorite\n Platt food, because Platt
food\n does not exist!)
declare a variable -- and its always good to
initialize it
use the variable by assigning something to it or
printing it or however youd like
24
Style Matters...
H.pl(Aha! Ive tricked you. favDish
cant be your favorite\n Platt
food, because Platt food\n does not
exist!) H.p(Aha! Ive tricked you.
favDish) H.pl( cant be your favorite)
H.pl( Platt food, because Platt food) H.pl(
does not exist!)
handling lots of text
or
keep lines to less than 80 chars long
  • be sure you consistently indent within code
    blocks
  • be sure you line up matching punctuation (curly
    braces)
  • be sure to have a complete start-of-file comment
  • use 1-line comments to explain complicated code

25
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.
26
Actual computation !
thats what Im here for...
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 ?
27
Java Operations
- /
addition with numbers concatenation with strings

multiplication
subtraction
mod (remainder)
division
103
10/2.5
113
10/3
11.53
123
If both sides are ints, so is the result -- with
rounding toward zero.
137
28
Not your type ?
int x 5 double d 1957.75
Suppose you have the variables
How do you print out the following using x and d?
5.0
HMC opened in 1957
29
Casting
(int)
The expressions
cast values of one type to another.
(double)
(int)10.999 produces 10
int x 5 (double)x produces 5.0
but x remains 5 !
30
Names
int x 5
Quiz
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)
nada is 0
Answers
H.pl(nada is (x-x))
two is 2
one\two is 0.5
10000
Optional Ex. Cr. Try to use the fewest opertions
possible
31
Hw2Pr3) A printing puzzle...
/-------------------------------------\ 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
3 you're "young" til 36 "one-third" is
0.33 ten thousand" is 10000 "pi" is
3.14159 /-------\ Bye ! \-------/
Print exactly this message.
but with only nonnumeric Strings and the two
variables
int x 5 double d 42.0
and without digit-by-digit String addition!
32
Hw2Pr3) A printing puzzle...
10000
H.p(xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx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ations as possible!
33
int x 5
Whats really going on
double d 42.0
H.pl(xd is x d)
String int
creates a String
xd is 5
String double
creates a String
xd is 542.0
parentheses are important !
34
Maybe a little less precision
Javas default is maximum precision
H.pl( 5/3.0 )
1.6666666666666667
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
35
What Java is thinking /?!
double d 5/3.0
H.fmt(d,4)
H.pl( five-thirds is d )
five-thirds is 1.6666666666666667
the only way to change a variable is with the
operator!
but we dont want to change d, we only want to
change the String thats printed!
H.pl( five-thirds is H.fmt(d,4) )
five-thirds is 1.6667
36
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
point H.fmt(s,p)     returns a String for
storing or printing p places after the decimal
point H.fmt(s,p,w)     returns a String for
storing or printing w is the minimum width of
the output String H.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 its whitespace.
Good for pauses Hit Enter to continue...
This list (and more) available from
http//www.cs.hmc.edu/courses/2004/fall/cs5/HMCSup
port.html
37
Lab Today
Mac M - Z
PC A - J
Hw2Pr1) Writing, compiling, and running the
Hello, World! program
Last time
Hw2Pr2) Abstract(ion) Art
Hw2Pr3) A printing puzzle...
This time
Hw2Pr4) Artificial Intelligence?
New accounts (should be!) ready at CIS.
But not for Mondays section
Building entry code
Lab entry code
38
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
39
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 ??
40
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
41
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
42
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
art.add(GrRectangle( ))
art.add(GrRectangle( ))
43
Assignment 2, Problem 2
Create the following work
art.add(new GrRectangle()) art.add(new
GrRectangle()) art.add(new GrRectangle()) art.
add(new GrRectangle())
44
Computer Science
Representing it -- whats convenient and
available ? Applying it -- graphics,
robotics, vision, AI Measuring it -- whats
possible and whats not
Information
How many drawing commands are really necessary ?
45
Computer Science
Representing it -- whats convenient and
available ? Applying it -- graphics,
robotics, vision, AI Measuring it -- whats
possible and whats not
Information
How many drawing commands are really necessary ?
31 kb file
23 kb file
46
In a nutshell...
The purpose of computing is insight, not numbers.
Richard Hamming
Programming is deceptively easy.
thanks to Steven Pinker
47
Quiz
Be sure to have a photo taken !
  • Name
  • Birthdate
  • A place you consider home
  • Your favorite _________ is _________.
  • Your least favorite ________ is _________.
  • Email and School (if not an HMC student)

48
1
0.5
area
0
1
10
2
3
4
5
6
7
8
9
1
0.5
0
1
10
2
3
4
5
6
7
8
9
xmin 1.0
xmax 10.0
nsteps 9
49
Hw2Pr3) A printing puzzle...
1000
H.pl(xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx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