Top Banner
Who is this dashing gent?
129

Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction . Belousov–Zhabotinsky reaction

Aug 19, 2018

Download

Documents

lamkhanh
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: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Who is this dashing gent?

Page 2: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Time vs. Frequency Domain

• Audio signal

• Representation 1: Sum of many delta functions

+ +…+

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

time (seconds)

f(x)

0 0.2 0.4 0.6 0.8 1-2

-1

0

1

2

0 0.2 0.4 0.6 0.8 1-2

-1

0

1

2

0 0.2 0.4 0.6 0.8 1-2

-1

0

1

2

Page 3: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Time vs. Frequency Domain

• Audio signal

• Representation 2: Sum of two sine functions

+

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

time (seconds)

f(x)

0 0.2 0.4 0.6 0.8 1-1

0

1

time (seconds)

f(t)

0 0.2 0.4 0.6 0.8 1-1

0

1

time (seconds)

f(t)

Page 4: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Kolmogorov Complexity

• Simplest way to represent:

• Equivalent representations:

– Sum of two sine functions in the time domain.

– Sum of two deltas in the frequency domain.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

time (seconds)

f(x)

0 1 2 30

0.5

1

frequency

0 1 2 30

0.5

1

frequency

Page 5: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Time Domain to Frequency Domain

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

time (seconds)

f(x)

0 1 2 30

0.5

1

frequency

Time:

Frequency:

Which sinusoids to use!

Page 6: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

DFT and FFT

• DFT: Discrete Fourier Transform, O(N2)

• Non-obvious fact: We compute N sinusoid amplitudes.

– In previous example, only two were non-zero.

• FFT: Fast Fourier Transform

– Recursive version of DFT

– Runs in O(N log N)!

samples

𝑋𝑘 = 𝑥𝑛𝑒−𝑖2𝜋𝑘

𝑛𝑁

𝑁−1

𝑛=0

sinusoid amplitudes

Page 7: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Frequency Filtering

• Nice clean input signal

0 100 200 300 400 500 600 700 800 900 1000-10

-5

0

5

10Time

0 10 20 30 40 50 60 70 80 90 100-50

0

50

100Frequency

Page 8: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Frequency Filtering

0 100 200 300 400 500 600 700 800 900 1000-10

-5

0

5

10

0 10 20 30 40 50 60 70 80 90 100-200

0

200

400

600

800

Page 9: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Frequency Filtering

FFT

× =

What do I do with this??

0 10 20 30 40 50 60 70 80 90 1000

0.5

1

1.5

Page 10: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Frequency Filtering

(audible errors are outside the part on the graph)

IFFT

Page 11: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Frequency Filtering Summary

0 100 200 300 400 500 600 700 800 900 1000-10

-5

0

5

10

0 10 20 30 40 50 60 70 80 90 100-200

0

200

400

600

800

0 10 20 30 40 50 60 70 80 90 1000

0.5

1

1.5

Page 12: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Image FFTs

magnitude spectrum

50 100 150 200 250 300 350 400 450 500

100

200

300

400

500

600

700

Page 13: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Low Pass Filtering with Image FFTs

magnitude spectrum

100 200 300 400 500

100

200

300

400

500

600

700

50 100 150 200 250 300 350 400 450 500

100

200

300

400

500

600

700

50 100 150 200 250 300 350 400 450 500

100

200

300

400

500

600

700

Page 14: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

High Pass Filtering with Image FFTs

magnitude spectrum

100 200 300 400 500

100

200

300

400

500

600

700

Page 15: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Phase Vocoding

• FFT:

– Basis for Pitch and Time Shifting

Page 16: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS314: Intro to Computer Music

• COS325: Transforming Reality by Computer

• ELE301: Signals and Systems

Page 17: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

COMPUTER GRAPHICS

Page 18: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 19: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

De-blurring

Page 20: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

De-blurring

Page 21: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

General model of blur

PSF = point-spread function (given by blur kernel)

effect of blur on single point

* = convolution

Page 22: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Non-blind deconvolution

• PSF is known

• Lucy-Richardson algorithm

• Assume Poisson distribution on input pixels

• Iterative approximation

Page 23: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Blind deconvolution

Page 24: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS426 – Computer Graphics

• COS496 – Computer Vision

Page 25: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

CLASSIFICATION

Page 26: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Classification

• Given an input, assign a label from a list

– Email text → {spam, ham}

– Handwritten digit → {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

Page 27: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Classification

• Given an input, assign a label from a list.

0

2

spam

Page 28: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Supervised Learning

• Given set of labeled training data.

– Training set

– Testing set

• Use training set to train a model.

• Use testing set to test performance of model.

Page 29: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Support Vector Machines

• Vanilla version: Binary classifier (two labels)

• Basic idea

– Each input is a point in an N-dimensional space

– Find best hyper-plane separating the two classes

• Examples – {rent, income} → {happy, sad}

– {age, weight, height, blood sugar, sex} → {has diabetes, no}

– email → {spam, ham}

Page 30: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Goal: Build a classifier

Class1 Class2

Page 31: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Construct Training Set (randomly)

Class1 Class2

Page 32: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Linearly Separable Data

Class1 Class2 Linear Decision boundary

Page 33: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Non Linearly Separable Data

Class1 Class2 Non Linear Classifier

(so do something fancier…)

Page 34: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Which Separating Hyperplane to Use?

x1

x2

Page 35: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Maximizing the Margin

x1

x2

Margin

Width

Margin

Width

Select the separating

hyperplane that

maximizes the

margin

Page 36: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Digression

• Why are we drawing straight lines (or planes (or hyperplanes))?

– Avoids overfitting!

Page 37: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Support Vectors

x1

x2

Margin

Width

Support Vectors

Page 38: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Finding the Separating Hyperplane

min𝒘,𝑏| 𝒘 |

Class 1 data obeys 𝒘𝒙𝒊 − 𝑏 ≤ −1

And class 2 data obeys

𝒘𝒙𝒊 − 𝑏 ≥ 1

With two constraints:

Don’t be scared of the math!

Page 39: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

What does this have to do with email?

• How do we represent our email as a number?

• Approach: First byte is our first dimension. Second byte is our second dimension, etc.

– Is this a good idea?

Page 40: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

What does this have to do with email?

• “C H E A P V1agra www.viagra4man.ru no prescription required”

• Better approach, create a feature vector!

Page 41: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Example of a Feature Vector

• Example: Feature TF vector: – {1, 3, 0, 0, 0, 0, 0, …., 1, 0, 0, …, 2, 0, ….}

• Feature vector variants: – Could weight uncommon words more highly.

– Could normalize the total size of the vector.

• Question: – What data structure might we want to use when building this vector?

– When using the SVM to see if a particular email is spam?

“… the last time I’ll trust a monkey. What would a monkey do with a shirt anyway?”

the a shirt monkey

Page 42: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The Kernel Trick

Page 43: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Gaussian Kernel

Page 44: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Machine Learning

• SVM: Solves binary classification

• Many other problems

– Multiway classification

– Regression

– Clustering

Page 45: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Music Genre Classification

Page 46: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS401 – Intro to Machine Translation

• COS402 – Artificial Intelligence

• COS424 – Interacting with Data

Page 47: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

INFERENCE

Forensics, security, privacy

Page 48: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Facebook Likes study

Predictors of high intelligence

– Curly Fries, Colbert Report…

Low intelligence

– Sephora, Harley Davidson…

Sexual orientation: 88% accuracy

Religious affiliation: 82% accuracy

Page 49: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Supermarkets: predictive analytics

Page 50: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 51: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Everything has a Fingerprint

Devices, human behavior and anything in between

Page 52: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 53: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Everything has a Fingerprint

Devices, human behavior and anything in between

Page 54: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 55: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

After applying Fourier Transform

Page 56: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Everything has a Fingerprint

Devices, human behavior and anything in between

Page 57: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 58: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

3D structure reconstructed from scans

Page 59: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Everything has a Fingerprint

Devices, human behavior and anything in between

Page 60: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

What’s being typed?

Page 61: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Is writing style sufficient to deanonymize material posted online?

Page 62: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Stylometric author identification: Notable successes

Page 63: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Linguistic Idiosyncracies

Page 64: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

A sample parse tree

Page 65: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 66: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS432 – Computer Security

• COS402 – Artificial Intelligence

• COS511 – Foundations of Machine learning

Page 67: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

DYNAMICAL SYSTEMS

Page 68: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Actual Chaos

http://www.youtube.com/watch?v=pYPRnxS6uAw

Page 69: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Simulated Chaos

Page 70: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Population Dynamics

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

0

5

10

Time

unnamed

x (state)𝑑𝑥1𝑑𝑡= −𝑑𝑥1

𝑑𝑥1𝑑𝑡= 𝑝 − 𝑑𝑥1

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 51

1.5

2

Time

unnamed

x (state)

𝑝 = 10, 𝑥1 0 = 10

𝑝 = 10, 𝑑 = 5, 𝑥1 0 = 1

Page 71: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Population Dynamics

• c: colonization rate

• h: habitat availability

• 𝑥1: population

𝑑𝑥1𝑑𝑡= 𝑐ℎ𝑥1 1 − 𝑥1 − 𝑑𝑥1

ℎ = 8

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

Time

unnamed

x (state)

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

Time

unnamed

x (state)

ℎ = 3

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

Time

unnamed

x (state)

ℎ = 1

Extinct!

Page 72: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Predator prey

•𝑑𝑥1

𝑑𝑡= 𝑏1𝑥1 − 𝑑1𝑥1𝑥2

•𝑑𝑥2

𝑑𝑡= −𝑑2𝑥2 + 𝑏2𝑥1𝑥2

– 𝑑𝑖: death rates

– 𝑏𝑖: birth rates

0 10 20 30 40 50 60 70 800

10

20

30

40

Time

unnamed

x1 (state)

x2 (state)

Page 73: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

ODEs and PDEs

• Often relatively easy to specify.

• Often very hard to analyze.

– Symbolic analysis is tough.

– Simulation is often much easier.

Steady State output of Kinase Cascade Model that I explored in grad school

Page 74: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Euler’s method

• Suppose we know 𝑦 = 𝑦0 at 𝑡 = 𝑡0

• What is 𝑦1 at time 𝑡1 = 𝑡0 + ℎ?

– 𝑦1 = 𝑦0 + 𝑓 𝑡0, 𝑦0 ℎ

𝑑𝑦

𝑑𝑡= 𝑓 𝑡, 𝑦

Page 75: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Runge-Kutta

• Key idea:

– Use multiple values of t

• Example:

– 𝑦𝑖+1 = 𝑦𝑖 + 0.5𝑘1 + 0.5𝑘2 ℎ

• 𝑘1 = 𝑓(𝑡𝑖 , 𝑦𝑖)

• 𝑘2 = 𝑓 𝑡𝑖 + ℎ, 𝑦𝑖 + 𝑘1ℎ

• Compare to Euler:

– 𝑦1 = 𝑦0 + 𝑓 𝑡0, 𝑦0 ℎ

Page 76: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

One big question

• What time step should we use?

– Fixed time step.

– Better: Adaptive time steps.

• Vast space of accuracy vs. time tradeoffs!

Page 77: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Simulated Circuit Chaos

𝑑𝑥

𝑑𝑡= 𝛼[𝑦 − 𝑥 − 𝑓 𝑥 ]

𝑑𝑦

𝑑𝑡= 𝑥 − 𝑦 + 𝑧

𝑑𝑧

𝑑𝑡= −𝛽𝑦

http://www.sciencedirect.com/science/article/pii/S0960077905000020

Page 78: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Simulated Circuit Chaos

𝑑𝑥

𝑑𝑡= 𝛼[𝑦 − 𝑥 − 𝑓 𝑥 ]

𝑑𝑦

𝑑𝑡= 𝑥 − 𝑦 + 𝑧

𝑑𝑧

𝑑𝑡= −𝛽𝑦

http://www.sciencedirect.com/science/article/pii/S0960077905000020

Page 79: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Chua’s Circuit in Action

Page 80: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Belousov–Zhabotinsky reaction

http://www.youtube.com/watch?v=D6qIfT7EGv4

Page 81: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Belousov–Zhabotinsky reaction

http://www.youtube.com/watch?v=3JAqrRnKFHo

Page 82: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS323: Computing for the Physical and Social Sciences

Page 83: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

TWO TALES OF CRYPTOGRAPHY

Page 84: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The Enigma machine

Page 85: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 86: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 87: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Sinking of the Reuben James, 1941

Page 88: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Fatal flaw: no letter can encrypt to itself

Ciphertext O H J Y P D O M Q N J C O S G A W H L E I H Y S O P J S M N U

Position 1 K E I N E B E S O N D E R E N E R E I G N I S S E

Position 2 K E I N E B E S O N D E R E N E R E I G N I S S E

Position 3 K E I N E B E S O N D E R E N E R E I G N I S S E

Crib: Keine besonderen ereignisse

Page 89: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Eisenhower: Enigma cryptanalysis was

decisive in Allied victory

Page 90: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Group discussion

Alice and Bob each have their own locks/keys

Neither has key to other’s lock

Alice has a box (duh)

They don’t trust the mail carrier

Can Alice send a secret message to Bob?

Page 91: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Solution

Page 92: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

This can be achieved mathematically!

Diffie-Hellman key exchange

Page 93: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS432 – Computer Security

• COS433 – Cryptography

Page 94: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

THE DINING PHILOSOPHERS PROBLEM

Page 95: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The Dining Philosophers Problem

• Five philosophers alternately eat and think.

• Can only eat if two forks held.

• Cannot pick up two forks simultaneously.

• Philosophers cannot communicate.

– What strategy should they use to make sure that nobody starves?

Page 96: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The Dining Philosophers Problem

• Dangerous strategy style:

– If left fork available, pick it up. Wait until right fork is available.

Page 97: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The Dining Philosophers Problem

• Still a dangerous strategy style:

– If left fork available, pick it up. Wait until right fork is available. If more than 10 seconds pass, put down left fork.

Page 98: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Dijkstra’s Solution

• Give number to each fork

– Philosopher always picks up smaller fork first

• Why is this useful?

– Prevents deadlock. Fork 5 cannot be picked up unless someone is ready to eat.

• Doesn’t scale!

1

2

3

4

5

Page 99: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Semaphores (also Dijkstra)

• Have a waiter as an arbitrator. Only allow someone with a fork to pick up the 5th fork.

– A and C are eating.

– If D or E want to eat, waiter will tell them they can’t pick up their fork (only one on table).

• No deadlock, but someone might still starve. A

E

D C

B

Page 100: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS318 – Operating Systems

• Also: Check out www.cs.utexas.edu/~EWD sometime. Lots of interesting

and random thoughts. Some are even funny.

Page 101: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

THINKING OUTSIDE THE BOX

Non-Turing machine computers

Page 102: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Solving equations using bike parts

Diophantine equation: find integers x1…xn s.t.

a1x1 + a2x2 + … anxn = b

Page 103: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

WHAT IS THE SIMPLEST POSSIBLE COMPUTER?

Page 104: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

(Or) Simplest interesting Universe

Discrete, 1-dimensional space and time

Each point in space-time has binary value

Local physics

– Value of a state at time t+1 determined entirely by neighboring values at time t

Discuss in groups: how many such universes?

111 110 101 100 011 010 001 000

? ? ? ? ? ? ? ?

current pattern new state

Page 105: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Each Universe is called “Rule n” n<256

This is the infamous Rule 110

111 110 101 100 011 010 001 000

0 1 1 0 1 1 1 0

current pattern new state

Page 106: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Most rules aren’t interesting

Page 107: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Here’s Rule 110

Page 108: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Here’s Rule 110

Page 109: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Here’s Rule 110

Page 110: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Theorem (Matthew Cook, 2004):

Rule 110 is Turing complete.

Page 111: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS487 – Theory of Computation

• COS433 – Cryptography

Page 112: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

ENVIRONMENTAL GENOMICS A.K.A. METAGENOMICS

Page 113: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Fermi Paradox (1950)

• “Where is everybody?”

– The Sun is young compared to its neighbors.

– At any practical interstellar speed, the entire galaxy could be colonized in tens of millions of years.

• Interesting questions:

– How common are planets?

– What conditions can support life?

– What are the chances life becomes intelligent?

Page 114: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Extremophiles

Page 115: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Environmental Genomics

• Much easier to read short sequences.

• Hard to predictably cut into small sequences.

Figure: Computational biology methods and their application to the comparative genomics of endocellular symbiotic bacteria of insects.

http://www.ncbi.nlm.nih.gov/pubmed/19495914

Page 116: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Algorithm

• Greedy algorithm

– Calculate pairwise alignments.

– Find the two fragments with the largest overlap.

– Merge them.

– Repeat until nothing else can be merged.

• Caveats

– Fragments may have errors (use edit distance).

– Fragments may be backwards.

Page 117: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Audax viator

• Lives 1.7 miles below ground.

– No oxygen. No light. 140 degrees fahrenheit.

• Obtains energy from hydrogen and sulfate produced by decaying uranium.

• Only species in its ecosystem.

– Completely independent of the sun (unlike deep sea life which uses oxygen).

Page 118: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Audax viator

• Environmental metagenomics

– 1500 gallons of water filtered

– Only one distinct genome found using shotgun reassembly

• Reading the source code of a bacterium

– Noisy substring matching with other life

• Can probably form endospores

• Can extract carbon from carbon dioxide

• Can extract nitrogen from rocks

Page 119: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Related Courses

• COS455 – Intro to Genomics and Computational Molecular Biology

Page 120: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 121: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

The dark side

Page 122: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

There’s just something about the picture of an engineer in Silicon Valley pushing a feature live at the end of a week, and then heading out for some beer, while people halfway around the world wake up and start using the feature and trusting their lives to it. It gives you pause.

Page 123: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Mat Honan, Wired: “In the space of one hour, my entire

digital life was destroyed”

Page 124: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Yet, the future looks bright

Page 125: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Car accidents: over 1 million deaths a year

We will save every one of those lives

Page 126: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction
Page 127: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Google's self-driving car gathers almost 1 GB/second This is what it "sees"

Page 128: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Additional Citations

• High quality motion deblurring from a single image

– http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.218.6835

• Private traits and attributes are predictable from digital records of human behavior

– http://www.pnas.org/content/early/2013/03/06/1218772110.full.pdf+html

• Fingerprinting

– http://33bits.org/tag/fingerprinting/

– http://33bits.org/2012/02/20/is-writing-style-sufficient-to-deanonymize-material-posted-online/

• Keyboard Acoustic Emanations Revisited

– http://www.tygar.net/papers/Keyboard_Acoustic_Emanations_Revisited/ccs.pdf

Page 129: Who is this dashing gent? - cs.princeton.edu · Time vs. Frequency Domain ... Chua’s Circuit in Action. Belousov–Zhabotinsky reaction  . Belousov–Zhabotinsky reaction

Additional Citations

• Enigma

– https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Enigma

• Diffie Hellman

– http://technet.microsoft.com/en-us/library/cc962035.aspx

• Rule 110

– https://en.wikipedia.org/wiki/Rule_110

• Solving equations using bike parts

– https://rjlipton.wordpress.com/2009/06/29/solving-diophantine-equations-the-easy-way/