computer applications for engineers - thammasat university - 0 - introduction.pdf · marilyn vos...
TRANSCRIPT
Asst. Prof. Dr. Prapun Suksompong [email protected]
Introduction
1
Computer Applications for Engineers ET 601
Office Hours:
BKD 3601-7
Thursday 14:40-16:00
Wednesday 9:30-11:30
Eye Examination
2
Are you sitting too far away?
You should be able to read this line,
and this line,
and this line.
Course Organization
3
Course Website:
http://www2.siit.tu.ac.th/prapun/ET601/
Lectures:
Wednesday 13:00-16:00 BKD 3206
Textbook: “Simulation”
By Sheldon M. Ross
5th Edition
Academic Press
2012
ISBN-10: 0124158250
ISBN-13: 978-0124158252
i
Course Web Site
4
Please check the course website regularly.
Announcements
References
Handouts (Posted before corresponding
lectures)
Slides (Posted after corresponding lectures)
Calendar
Lectures
Exercises and projects due dates
Presentation Slots
www2.siit.tu.ac.th/prapun/ET601/
i
Course Web Site
5
prapun.com
Course Website: Notes & Slides
6
I frequently use Microsoft OneNote on my tablet instead of the whiteboard. The files will be exported as pdf and posted after the corresponding lectures.
PDF notes (if any) will be posted before the corresponding lectures.
In lectures…
PDF notes and slides will be annotated.
The slides and updated notes will be posted on the course website after the corresponding lectures.
Remind me the day after the lecture if the notes/slides from the day before are still not posted on the web.
i
Me?
7
Ph.D. from Cornell University, USA
In Electrical and Computer Engineering
Minor: Mathematics (Probability Theory)
Ph.D. Research: Neuro-Information Theory
Modeling and analyzing neurons in human brain from communication engineering perspective.
Current Research: Wireless Communication
Mobile Communications, WiFi (802.11)
2009 SIIT Best Teaching Award
2011 SIIT Research Award
prapun.com
i
Synopsis
8
Main Focus: Model random phenomenon and use
simulation study to analyze it.
Motivation
9
Formulation of model to describe and study a real phenomenon
Traditional choices: choosing a model that is a realistic replica of the actual situation choosing one whose mathematical analysis is tractable.
Traditional tradeoff: Can’t choose a model that is faithfully conformed to the phenomenon
under study if it were not possible to mathematically analyze that model.
Concentration on asymptotic or steady-state results as opposed to the more useful ones on transient time.
New Approach: Relatively recent advent of fast and inexpensive computational power has opened up another approach-namely, to try to model the phenomenon as faithfully as possible and then to rely on a simulation study to analyze it.
Goals
10
Main Focus: Model random phenomenon and use
simulation study to analyze it.
To do this…
Use a computer to generate random (more precisely,
pseudorandom) numbers.
Use these random numbers to generate the values of random
variables from arbitrary distributions.
Use random variables to generate the behavior of a stochastic
model over time.
Asst. Prof. Dr. Prapun Suksompong [email protected]
1 Review of Basic Probability
11
Computer Applications for Engineers ET 601
Office Hours:
BKD 3601-7
Thursday 14:40-16:00
Wednesday 9:30-11:30
References
12
Chapter 14 (Review of Basic Probability)
In “Operations Research: An Introduction”
By Hamdy A. Taha
2011, 9th Edition
Prentice Hall
Chapter 2 (Elements of Probability)
In “Simulation”
By Sheldon M. Ross
2012, 5th Edition
Academic Press
My undergraduate course on probability
http://www2.siit.tu.ac.th/prapun/ecs315/
Recommended Reading
13
Understanding Probability: Chance Rules in Everyday Life
By Henk Tijms
Call No. QA273 T48 2012
Cambridge University Press
“Part One” provides many motivating examples and problems from everyday life
“Part Two” teaches clearly and simply the mathematics of probability theory.
Sample materials are available at the author’s website: http://personal.vu.nl/h.c.tijms/
http://www.cambridge.org/aus/catalogue/catalogue.asp?isbn=9781107658561&ss=exc
2nd Edition (2007)
3rd Edition (2012)
14
Randomness
15
Life is random
16
Life is random
In 2005, this statement (which is true)
showed up all over the world…
17
Life is random
“Random”-ness
18
Most people have preconceived notions of randomness
that often differ substantially from true randomness.
Truly random data sets often have unexpected properties
that go against intuitive thinking.
These properties can be used to test whether data sets have
been tampered with when suspicion arises.
Success Runs (1/4)
19
Suppose that two people are separately asked to toss a fair
coin 120 times and take note of the results. Heads is noted
as a “one” and tails as a “zero”.
Results: Two lists of compiled zeros and ones:
[Tijms, 2007, p 192]
Success Runs (2/4)
20
Which list is more likely?
[Tijms, 2007, p 192]
Success Runs (3/4)
21
Fact: Suppose we know that one of the two individuals has
cheated and has fabricated a list of numbers without having
tossed the coin.
Which list is more likely be the fabricated list?
[Tijms, 2007, p 192]
Success Runs (4/4)
22
Fact: In 120 tosses of a fair coin, there is a very large probability that at some point during the tossing process, a sequence of five or more heads or five or more tails will naturally occur. The probability of this is approximately 0.9865.
In contrast to the second list, the first list shows no such sequence of five heads in a row or five tails in a row. In the first list, the longest sequence of either heads or tails consists of three in a row.
In 120 tosses of a fair coin, the probability of the longest sequence consisting of three or less in a row is equal to 0.000053 which is extremely small .
Thus, the first list is almost certainly a fake.
Most people tend to avoid noting long sequences of consecutive heads or tails. Truly random sequences do not share this human tendency!
[Tijms, 2007, p 192]
“The Perfect Thing”
23
What is this?
“The Perfect Thing”
24
What about the shuffle function?
25
http://ipod.about.com/od/advanceditunesuse/a/itunes-random.htm
http://electronics.howstuffworks.com/ipod-shuffle2.htm
http://www.cnet.com.au/itunes-just-how-random-is-random-339274094.htm
Shuffle function on iPod
26
Apple ran into an issue with the random shuffle method it
initially employed in its iPod music players:
true randomness sometimes produces repetition
When users heard the same song or songs by the same artist
played back-to-back, they believed the shuffling wasn’t
random.
So the company made the feature “less random to make it
feel more random,” said Apple founder Steve Jobs.
Monty Hall Problem (MHP): Origin
27
Problem, paradox, illusion
Loosely based on the American television game show
Let’s Make a Deal. (Thai CH7 version: ประตูดวง.)
The name comes from the show’s original host, Monty
Hall.
One of the most interesting mathematical brain teasers of
recent times.
Monty Hall Problem: Math Version
28
Originally posed in a letter by Steve Selvin to the American
Statistician in 1975.
A well-known statement of the problem was published in
Marilyn vos Savant’s “Ask Marilyn” column in Parade
magazine in 1990: “Suppose you're on a game show, and
you're given the choice of three doors:
Behind one door is a car; behind the others,
goats. You pick a door, say No. 1, and the
host, who knows what's behind the doors,
opens another door, say No. 3, which has a
goat. He then says to you, "Do you want to
pick door No. 2?" Is it to your advantage to
switch your choice?”
Marilyn vos Savant
29
Vos Savant was listed in each edition of the Guinness Book
of World Records from 1986 to 1989 as having the “Highest
IQ.”
Since 1986 she has written “Ask Marilyn”
Sunday column in Parade magazine
Solve puzzles and answer questions from readers
[ http://www.marilynvossavant.com ]
MHP: Step 0
30
There are three closed doors.
They look identical.
MHP: Step 0
31
Behind one of the doors is the star prize - a car.
The car is initially equally likely to be behind each door.
Behind each of the other two doors is just a goat.
MHP: Step 1
32
Obviously we want to win the car, but do not
know which door conceals the car.
We are asked to choose a door.
That door remains closed for the time being.
“Pick one of
these doors”
MHP: Step 2
33
The host of the show (Monty Hall), who knows what is behind
the doors, now opens a door different from our initial choice.
He carefully picks the door that conceals a goat. We stipulate that if Monty has a choice of doors to open, then he chooses randomly from among his options.
MHP: Step 3
34
Monty now gives us the options of either
1. sticking with our original choice or
2. switching to the one other unopened door.
After making our decision, we win whatever is behind our door.
“Do you want
to switch
doors?”
Monty Hall Problem
35
Will you do better by sticking with your first choice, or
by switching to the other remaining door?
Make no difference?
Assuming that our goal is to maximize
our chances of winning the car, what
decision should we make?
36
Let’s play!
Interactive Monty Hall
37
http://montyhallgame.shawnolson.net/
http://www.shodor.org/interactivate/activities/SimpleMontyHall/
http://www.math.uah.edu/stat/applets/MontyHallGame.xhtml
http://scratch.mit.edu/projects/nadja/484178
http://www.math.ucsd.edu/~crypto/Monty/monty.html
Interactive Monty Hall
38
http://www.nytimes.com/2008/04/08/science/08monty.html
The New York Times’s Version
39
Back to the boring
administrative stuff!
Calendar
40
i
Lecture
M T W R F
11-Nov-13 12-Nov-13 13-Nov-13 14-Nov-13 15-Nov-13
18-Nov-13 19-Nov-13 20-Nov-13 21-Nov-13 22-Nov-13
25-Nov-13 26-Nov-13 27-Nov-13 28-Nov-13 29-Nov-13
2-Dec-13 3-Dec-13 4-Dec-13 5-Dec-13 6-Dec-13
9-Dec-13 10-Dec-13 11-Dec-13 12-Dec-13 13-Dec-13
16-Dec-13 17-Dec-13 18-Dec-13 19-Dec-13 20-Dec-13
23-Dec-13 24-Dec-13 25-Dec-13 26-Dec-13 27-Dec-13
30-Dec-13 31-Dec-13 1-Jan-14 2-Jan-14 3-Jan-14
6-Jan-14 7-Jan-14 8-Jan-14 9-Jan-14 10-Jan-14
13-Jan-14 14-Jan-14 15-Jan-14 16-Jan-14 17-Jan-14
20-Jan-14 21-Jan-14 22-Jan-14 23-Jan-14 24-Jan-14
27-Jan-14 28-Jan-14 29-Jan-14 30-Jan-14 31-Jan-14
3-Feb-14 4-Feb-14 5-Feb-14 6-Feb-14 7-Feb-14
10-Feb-14 11-Feb-14 12-Feb-14 13-Feb-14 14-Feb-14
17-Feb-14 18-Feb-14 19-Feb-14 20-Feb-14 21-Feb-14
24-Feb-14 25-Feb-14 26-Feb-14 27-Feb-14 28-Feb-14
3-Mar-14 4-Mar-14 5-Mar-14 6-Mar-14 7-Mar-14
10-Mar-14 11-Mar-14 12-Mar-14 13-Mar-14 14-Mar-14
17-Mar-14 18-Mar-14 19-Mar-14 20-Mar-14 21-Mar-14
Class Participation
41
If you come only to receive, you will fall asleep.
Do not simply sit quietly in the class.
Need interaction between the lecturer and students.
Ask question when there is something that you don’t understand.
Don’t be shy!
It is very likely that your peers don’t understand it as well.
If you already understand what I’m presenting, SHOW ME!
Point out the errors/typos.
I will raise many issues/questions in class. Try to comment on them.
i
Policy
42
We will start the class on time and will finish on time.
Time reference: Not the clock in classroom. Use time server.
Please come to class on time.
Raise your hand and tell me immediately if I go over the time limit.
Does NOT mean that I will leave the room immediately after lecture. I will stay and answer questions.
Mobile phones must be turned off or set in silent mode.
We may have some pop quizzes (without prior warning or announcement) and in-class exercises.
Pop quizzes will be taken/given irregularly and randomly.
Feel free to stop me when I talk too fast or too slow.
i
Tips
43
Almost everything including what I have written on my tablet
will be saved and posted on web soon after class.
No need to take detailed lecture notes (if you don’t want to).
Put all of your energy into understanding the
material.
Of course, there is always someone (in the class) who will take
good notes anyway and you can (potentially) borrow or make a
copy of the notes from them.
Have fun with the materials presented in class.
Remarks
44
Get as much legitimate help as you can
Participate actively in class and outside of class
If you feel that the class is very easy, you might overlook something.
If you feel that the class is very difficult, you are probably not the only one who feel that way.
Don’t give up. Chat with me.
It takes me a long time to feel comfortable with these materials; yet, I still make mistakes.
My notation can be different from the textbook.
Every notation has some advantages and disadvantages.
Policy: Summary
45
Please stop me if I go over the time limit.
Please stop me if I talk too fast.
Please stop me if you have any question.
i
Monty Hall Problem: a short revisit
46
Will you do better by sticking with your first choice, or
by switching to the other remaining door?
Make no difference?
Assuming that our goal is to maximize
our chances of winning the car, what
decision should we make?
Monty Hall Problem: vos Savant’s
Answer
47
“You double your chances of
winning by switching doors.”
Monty Hall Problem: Controversy
48
Approximately 10,000 readers,
including nearly 1,000 with PhDs
(many of them math professors),
wrote to the magazine
claiming the published solution was wrong.
“You blew it,” wrote a mathematician from George Mason
University.
From Dickinson State University came this: “I am in shock
that after being corrected by at least three mathematicians,
you still do not see your mistake.”
[Mlodinow, 2008, p 42-45]
Controversy (2)
49
From Georgetown: "How many irate mathematicians are needed to change your mind?"
And someone from the U.S. Army Research Institute remarked, "If all those Ph.D.s are wrong the country would be in serious trouble."
When told of this, Paul Erdős, one of the leading mathematicians of the 20th century, said, "That's
impossible."
Then, when presented with a formal mathematical proof of the correct answer, he still didn't believe it and grew angry.
Only after a colleague arranged for a computer simulation in which Erdős watched hundreds of trials that came out 2-to-1 in favor of switching did Erdős concede that he was wrong.
MATLAB
50
In this class, we use MATLAB to
perform computer simulation.
MATLAB Fundamentals: Academic Tutorial
51
MATLAB Fundamentals: Academic Tutorial
52
MATLAB Fundamentals: Academic Tutorial
53
Command Window
54
MATLAB expressions and statements are evaluated as
you execute them in the Command Window, and results of
the computation are displayed there too.
They are usually of the form:
variable = expression
or simply:
expression.
If the variable name and = sign are omitted, a variable ans
(for answer) is automatically created to which the result is
assigned.
Help
55