Saturday, December 18, 2010

Probability problem


There's a famous problem in probability: find a probability distribution such that two such independent random variables have a sum that is uniformly distributed from 0 to 1.

That turns out to be impossible. One way to prove it is by considering the expected value of exp(2*pi*i*x). Because the distribution of the sum has to have this quantity be 0, each part also has to have the same property. The only distribution with support between 0 and .5 with this property is 0 w.p .5, and 0.5 w.p. 0.5. That distribution doesn't work.

A related problem is: find a probability distribution such that two such independent random variables x1, and x2 satisfy x1 + 2*x2 is uniformly distributed from 0 to 1.

Can you do it?


Thursday, December 02, 2010



package main

func main(){
stat := make([][][]int, 9)
for i := 0; i < 9; i++ {
stat[i] = make([][]int, 9)
for j := 0; j < 9; j++ {
stat[i][j] = make([]int, 9)
}
}
rule := make([][]*int, 324)
for i := 0; i < 324; i++ {
rule[i] = make([]*int, 9)
}
for i := 0; i < 9; i++ {
for j := 0; j < 9; j++ {
for k := 0; k < 9; k++ {
rule[i*9+j][k] = &stat[i][j][k]
rule[81+i*9+j][k] = &stat[i][k][j]
rule[162+i*9+j][k] = &stat[k][j][i]
rule[243+i*9+j][k] = &stat[3*(i/3)+(k/3)][3*(i%3)+(k%3)][j]
}
}
}
input := "96..1.7.4..1....2....2.59....3......59.....76......1....98.3....7....2..1.8.7..69"
for i := 0; i < 9; i++ {
for j := 0; j < 9; j++ {
for k := 0; k < 9; k++ {
if input[9*i+j] == '1'+byte(k){
stat[i][j][k] = 1
}
}
}
}
for iter := 0; iter < 100; iter++ {
for i := 0; i < 324; i++ {
sum := 0
for j := 0; j < 9; j++ {
sum += *rule[i][j]
}
if sum&1 == 1 {
for j := 0; j < 9; j++ {
if *rule[i][j] == 0 {
*rule[i][j] = 2
}
}
}
if sum == 16 {
for j := 0; j < 9; j++ {
if *rule[i][j] == 0 {
*rule[i][j] = 1
}
}
}
}
}
for i := 0; i < 9; i++ {
for j := 0; j < 9; j++ {
for k := 0; k < 9; k++ {
if stat[i][j][k] == 1 {
print(k+1)
}
}
}
println()
}
}

Wednesday, December 31, 2008

Graded New Year's Resolutions 2008

1. Read two books a month. ("Who do you think you are, Einstein?!")

Nope.  But I've read some very good ones this year, including "American Fascists" (Chris Hedges) and "Facts and Mysteries in Elementary Particle Physics" (Martinus Veltman).

2. Smell better. ("No way, really?", spark of hope lingering in Dina's eye)

"Yeah, on average--you're definitely cleaner."

3. Beat my time up Old La Honda (21:50) and olympic triathlon (2:30:31)

I got somewhat close to my OLH record (under 24:00), but didn't break it.

4. Grade this years resolutions w/ Dina ("um... Is there any resolution about me? um...")

Check!  Dina, don't you have anything to do now?  "Every year you're getting meaner; you take me for granted :'("

Overall: 2/4, plus maybe some partial credit, but not really.


Selected 2007 Resolutions

2. Get more done at work, and spend less time there.

Yes!  This year has been a very good one at work.  I definitely spent less time at work in 2008 than in 2006, but probably about the same as 2007 (can't keep going down forever)

5. Keep in touch with friends and colleagues better

I call my parents and brother more, so let's count this as a success.


Friday, March 07, 2008

Liars dice poker

Okay, here's a game I made up. You use dice, and bet with chips, like poker.

Two players: player 1 and player 2.

Player 1 puts in 1 chip, player 2 puts in 2 chips.

Player 1 rolls 10 dice and then declares a number of pips, from 1 to 6, say "4".

Player 2 rolls 10 dice and then declares either "higher" or "lower", say"lower".

At this point, we have a betting round, as in no-limit poker. Both players have an opportunity to raise, starting with player 1 (who has only put in 1 chip). If there is a showdown, the player with, in the example, the lower number of 4's wins and takes the pot. If they have the same number of 4's, they chop the pot.

What does everyone think?

Tuesday, January 01, 2008

New Years Resolutions, 2008

In keeping with tradition, I'm writing new year's resolutions on Jan 1, 2008.

1. Read two books a month. ("Who do you think you are, Einstein?!")

2. Smell better. ("No way, really?", spark of hope lingering in Dina's eye)

3. Beat my time up Old La Honda (21:50) and olympic triathlon (2:30:31)

4. Grade this years resolutions w/ Dina ("um... Is there any resolution about me? um...")


In addition to this year's resolutions, I'm also trying to keep my 2007 resolutions.

Well, this year's resolutions are a bit silly, but I think I'm sticking with them. I'm serious about them all. Okay... it's 10:24 p.m., and time to hit the sack.

To be updated :-)

Friday, December 28, 2007

Last year's resolutions graded!

1. Blog more. I used to have a ton of fun with this blog.

Well, admittedly 362/365 of the days this year have passed without a peep, but there are still 3 days left, so I won't jump the gun in grading this one yet. Besides, I'm writing now, aren't I?

2. Get more done at work, and spend less time there.

Yeah! This is a big success for this year. After changing groups, I'm infinitely more productive, and I've been keeping reasonable hours much of the time.

3. Start dating a girl I can see as my equal in the ways that matter, and is a good match for me.

Can't complain! However, I'm not going to write it all up here.

4. Revise my thesis.

See #1. Actually, after studiously ignoring this for most of this year, I've started working on this again. I'm taking my officemate Bob's approach, which is this: learn the minimum set of tools necessary to get the job done, and get the job done.

5. Keep in touch with friends and colleagues better.

Bad. Actually, a huge failure this year was missing the retirement party of my graduate advisor. The timing couldn't have been worse, with a major external product demo and several of us (including me) working 12+ hour days then.

-------------------

So, I guess that makes it 2/5 resolutions kept, which is at least par for the course. Probably more like an eagle.

Anyway, I'm really happy with the resolutions that I did keep this year. In a few days, I'll write a new set of resolutions for the coming year (that's 2008!). I'll renew the resolutions I didn't keep, and write a few new ones, which I've already been thinking about.

Monday, January 01, 2007

New Year's Resolutions

This year, I have some big resolutions to keep. I'm writing 'em down while it's still Jan. 1 and still counts.


1. Blog more. I used to have a ton of fun with this blog.

2. Get more done at work, and spend less time there.

3. Start dating a girl I can see as my equal in the ways that matter, and is a good match for me.

4. Revise my thesis.

5. Keep in touch with friends and colleagues better.


So, the most interesting one is #3, so why not talk about that for a while. What are the ways that matter?

I dated a girl for a long time who had everything any guy wants in terms of attractiveness and attentiveness. The thing that ultimately made the relationship end was that I could never talk with her about things I care about a lot about. Things I blog about. Partly, that's because we grew up speaking different languages (and neither of us became fluent enough in the other's language). Partly, that's because the things we care about are so different.

Anyway, what I want to find is someone who's discriminating, caring, physically attractive, likes the person that I am, is liberal in the sense of "people should be free to make their own choices".

Who knows what the new year will bring. 2006 was interesting--not the best year on record for me. The best year on record for me might have been 1998, when I started working on what became my graduate work. I hope 2007 can find itself looking more like 1998 than 2006.