Syndicate this site: (RSS)

November 29, 2005

Comics Wish List

After looking through a couple issues of Justice, I realize that one item high on my wish list is Omaha the Cat Dancer, illustrated by Alex Ross.

November 29, 2005 Comments (0) TrackBack (0)

November 26, 2005

Beta Distributions

Suppose that you wish to model a continuous, non-deterministic process, where each outcome is within a finite range [0,1]. Further, suppose that you wish to be able to specify the mean and the variance.

The beta distribution is a reasonable starting point.

The Beta distribution looks like:
P(x) = x^(a-1)*(1-x)^(b-1)/B(a,b)

B is the beta function, and serves as a normalization constant.

The beta distribution has the following properties:
μ= a/(a+b)
σ^2=ab/[ (a+b)^2 (a+b+1) ]

For my purposes, I want this turned about, so that I can express a and b in terms of the mean and variance.
μ= a/(a+b)
(a+b)= a/μ
b = a (1-μ)/μ
a/b = μ/(1-μ)

The last of these presents an insight that will prove useful later: switching from a to b is essentially equivalent to swapping μ and (1-μ). The underlying idea here is that of reversing the distribution; Q(x) = P(1-x) produces the same variance, but the mean flips over to the other side of 0.5.

σ^2
=ab/[ (a+b)^2 (a+b+1) ]
=a * [ a (1-μ)/μ ] / [ (a/μ)^2 (a/μ + 1 ) ]
= [(1-μ)/μ ]/ [ (1/μ)^2 (a/μ + 1 ) ]

= μ^2 [(1-μ)/μ] / [ (a/μ + 1 ) ]
= μ^2 (1-μ) / [ a + μ ]

a + μ = μ^2 (1-μ) / σ^2

a = [ μ^2 (1-μ) / σ^2 ] - μ
a = μ [ μ (1-μ) / σ^2 - 1 ]

b = (1-μ) [ μ (1-μ) / σ^2 - 1 ]

Often when working in the range [0,1], I find myself wanting to work around the center of the range: M = 0.5. So we define ε as
ε = μ - M
μ = M + ε
(1-μ) = M - ε

a = (M + ε) [ (M + ε) (M - ε) / σ^2 - 1 ]
a = (M + ε) [ (M^2 - ε^2) / σ^2 - 1 ]
b = (M - ε) [ (M^2 - ε^2) / σ^2 - 1 ]

Now, suppose we wish to impose the conditions that a,b >= 1. What sort of constraint does that put on the variance?

(M - | ε|) [ (M^2 - ε^2) / σ^2 - 1 ] >= 1
(M ± ε) (M^2 - ε^2) / σ^2 >= 1 + (M - | ε|)
(M ± ε) (M^2 - ε^2) / σ^2 >= 3M - | ε|
(M ± ε) (M^2 - ε^2) / ( 3M - | ε|) >= σ^2

For example, when ε = 0, the largest variance satisfying this constraint is M^2/3 = 1/12, which is the variance of a uniform distribution. So everything checks out.

November 26, 2005 Comments (0) TrackBack (0)

November 24, 2005

Acme

The ORIGINAL Illustrated Catalog of ACME Products.

No mention of Acme Murray Dance Studios. "Do you love me, do you love me, no that I can dance. Thank you, very much."

November 24, 2005 Comments (0) TrackBack (0)

November 17, 2005

Give peas a chance

In the bookstore today, I grabbed a copy of the latest Cook's Country. Why I don't already have a subscription, I don't know.

There's a one pager on cooking frozen peas. The first recipe in the list (Creamy Peas with Ham and Onion) is out of the park yummy, and really simple. Go cook, go eat, go nuts.

November 17, 2005 Comments (0) TrackBack (0)

November 14, 2005

MVP: AL 2005

In surfing the various discussions, I noticed at least one comment that the number of votes for Ortiz indicated that the writers were not discriminating against the DH.

I'd call that conclusion questionable. There is reason to believe that the second place on the ballot operates under different "rules" than the first. For reference, see the arguments against McGwire in 1998.

November 14, 2005 Comments (0) TrackBack (0)

Cheesecake notes

Lessons of the last two cheesecakes....

The difference between red and black raspberry jam is a bit too subtle to survive the amount of chocolate.

Nor did anyone notice that I omitted the vanilla extract.

Jacob's Bourbon Cremes make an excellent crust, with melted butter added in to grant some extra cohesion. When these are absent from the cookie aisle at the grocery store, it's worth checking the international aisle as well.

Packing the sides of the pan first, then filling in the bottom produces a more even thickness than the other way around.

If baking a cheesecake for a random audience, remember nut allergies. You'll probably want to use (regular) Oreos for the crust, and Ghiradelli's for the chocolate.

Arcticzone has a nice cooler about the right size for two cakes, sauce, knives, ice, etc. but the orientation is wrong, so you can't simply sling it over your shoulder unless you are unconcerned by the cakes being sideways. I'm not sure how great a risk that is.

You'll need more plates. And forks. Otherwise you end up with cheesecake "shots". Any leftover paperware can be saved for next time.

November 14, 2005 Comments (1) TrackBack (0)

November 9, 2005

Red Sandalwood


My preferred recipe for Jambalaya calls for red sandalwood, which I've never had on hand. A local gourmet spice shop might help, but I've never had one of those on hand either.

But if searching under "spice" or "herbs" avails you nothing, try searching under "spell components". The nice folks at Alchemy Works Seeds & Herbs sent me an ounce. It arrived today.

November 9, 2005 Comments (0) TrackBack (0)

GRRM without spoilers

Picked up Feast for Crows on Tuesday, started it yesterday, finished today.

Initial reaction: Plot pacing of Jordan, Timeliness of Gerrold. Of course, if GRRM holds to plan then book 5 will be out considerably ahead of Gerrold's pace.

My mistake may have been not rereading Storm before starting Feast; I didn't have the strongest sense of where everyone was to start with. Part way through the book I discovered I didn't even know what name everyone was using. Bother.

I realize, of course, that this is half a book - the actions of the other characters yet to come, but each thread kept whole. But how did GRRM order the chapters? The context shifts were just a tad irksome.

And I can look forward to my favorite character not appearing in the next book. Bother.

November 9, 2005 Comments (0) TrackBack (0)

Rotations: Non-commutativity

If you rotate about X, then about Y, then undo the two rotations in the same order, you don't end up where you started. This can easily be observed by rotating a book in various ways, and observing that it doesn't end up the way it started.

But it gets really weird when you apply those rotations using very small angles. You turn X, turn Y, reverse X, reverse Y, and when all is said and done, what you've accomplished is a turn around Z.

Whoa.

As usual, I find that the demonstrations are lacking, in that they go the wrong way around, and give you the approximation at the wrong time.

Unfortunately, now that we are rotating about two different axes, we can no longer simplify the demonstration by throwing away Z. So we'll write everything out exactly, then start simplifying things.

A rotation about the X axis looks like


[ 1 0 0
0 cos θ -sin θ
0 sin θ cos θ ]

With 4 rotations, there's going to be a lot of terms about, which promises to make things untidy. So rather than write out sin and cos every time, I use a shorthand.

X = cos θ
x = sin θ

And the x rotation matrix looks like


[ 1 0 0
0 X -x
0 x X ]

Using the same notation, the y rotation matrix looks like


[ Y 0 y
0 1 0
-y 0 Y ]

(I always have to check my sign conventions at this point: positive rotation about X takes pure Y to positive Z; rotation about Y takes pure Z to positive X. )

Multiplying these two matrices gives us a rotation about X then Y (careful - order matters).

[  Y  xy  yX
   0  X   -x
  -y  xY  XY ]

Reversing these rotations gives the same matrix, except that sin(-θ)=-sin(θ), so any term with an odd number of lower case letters switches sign.

[  Y   xy  -yX
   0   X     x
   y  -xY   XY ]

So first we rotate by our positive angles, using the top matrix, then we rotate by our negative angles, using the bottom matrix. The product below is exact.


[ YY+yyX xyY+xyX-xyXY yXY-xxy-yXXY
-xy XX+xxY -xX+xXY
yY-yXY xyy-xXY+xXYY yyX+xxY+XXYY ]

Now, the above mess can be simplified by applying (cos θ)^2=(1-(sin θ)^2). In addition, we cast about for terms of the flavor (1-X) where we can find them, because it will simplify matters shortly.

[ 1-yy(1-X) xy(1-(1-X)(1-Y))  yY(1-X)-xxy(1-Y)
  -xy       1-xx(1-Y)         -xX(1-Y)
  yY(1-X)   xyy(1-X)+xX(1-Y)  1-xx(1-Y)-yy(1-X)+xxyy ]

The solution above is still exact. But if we now approximate the effect of infinitesmal rotations, we notice that
1-X = x^2/2 + O(x^4)
and as this term never appears bare, we get an answer accurate to second order if we drop every term with this factor.

[  1  xy  0
  -xy  1  0 
   0   0  1 ]

And hey presto - what our four rotations have actually achieved is a small rotation -xy about the z axis.

Note the expansion of the lower right corner of the matrix:


1-xx(1-Y)-yy(1-X)+xxyy
= 1-xx(yy/2 + O(y^4))-yy(xx/2+O(x^4))+xxyy
= 1 - xxyy/2 - xxyy/2 + xxyy + xx O(y^4) + yy O(x^4)
= 1 + O(x^6)

November 9, 2005 Comments (0) TrackBack (0)

Rotations: as exponentials

One bit in the presentation of rotations is that they are often presented as exponentials. The common approach appears to be to first take approximate an infinitesmal rotation, then apply them in succession.

I'm not terribly keen on that approach, because it isn't clear how the approximation goes away and becomes an exact answer, and because it isn't necessary.

Again, since we are rotating about the Z axis, we don't need to include it in the calculation, so for brevity I return again to the 2 dimensional rotation maxtrix.

[ cos Θ  sin Θ
  sin Θ  cos Θ]

=
[ 1 - Θ^2/2!... - Θ + Θ^3/3!...
Θ - Θ^3/3!... 1 - Θ^2/2!... ]

= [ 1 0
0 1 ]
+ [ 0 -1
1 0 ] Θ
+ [-1 0
0 -1 ] Θ^2/2!
+ [ 0 1
-1 0 ] Θ^3/3!
+ ...

Consider the matrix which marks the first order term in the equation above. When we multiply it upon itself, the other matrices appear.


[ 0 -1 [ 0 -1 = [ -1 0
1 0 ] 1 0 ] 0 -1 ]

[-1 0 [ 0 -1 = [ 0 1
0 -1 ] 1 0 ] -1 0 ]

[ 0 1 [ 0 -1 = [ 1 0
-1 0 ] 1 0 ] 0 1 ]

Designating this matrix as A, we can rewrite the Taylor expansion as


= A^0 + A Θ + A^2 Θ^2/2! + A^3 Θ^3/3!...
= (ΘA)^0 + (ΘA)^1 + (ΘA)^2/2! + (ΘA)^3/3!...
= exp[ ΘA ]

This expression is exactly correct, and in turn leads back to the expression used for the infintesmal rotation


exp[ ΘA ]
= lim ( 1 + (ΘA)/n ) ^ n


November 9, 2005 Comments (1) TrackBack (0)

Rotations: the basics

Of late, I've been distracted by the study of rotations - simple ordinary rotations in three space. It seems that I have had the results in my head for quite some time, but the derivations (and admittedly, therefore some degree of understanding) missing. So I recently went through the drill of working it out.

What I came away with was the notion that when this material was presented to me, it was backwards. Certainly that's the way it felt to me when I worked through the problems as they presented themselves.

So in this series, I reverse that order. We begin by re-examining the basics of rotations.


A rotation about the Z axis is normally written in matrix form as:


[ cos Θ -sin Θ 0
sin Θ cos Θ 0
0 0 1 ]

For our purposes here, we can ignore the Z component altogether.


[ cos Θ -sin Θ
sin Θ cos Θ ]

First question: where does the minus sign go? It's an arbitrary choice, really - what this sign is really doing is defining which direction is positive. Conventionally, with the X axis pointing to the right and the Y axis pointing up, a positive angle is taken to be counter clockwise. So taking a point on the Y axis and giving it a small rotation about Z produces a number with a negative X value, which is right.

Next question: do two successive rotations produce the same result as one big rotation? Successive rotations are achieved using two matrices, which can be multiplied together.

[ cos Θ  -sin Θ  [ cos Φ  -sin Φ
  sin Θ   cos Θ ]  sin Φ   cos Φ ]
= [ cos Θ cos Φ - sin Θ sin Φ   - ( cos Θ sin Φ + sin Θ cos Φ )
    sin Θ cos Φ + cos Θ sin Φ   - sin Θ sin Φ + cos Θ cos Φ ]
= [ cos (Θ + Φ)  -sin (Θ + Φ)
    sin (Θ + Φ)   cos (Θ + Φ) ]

From this, it follows immediately that a rotation, followed by an equal rotation in the opposite direction, restores the system to its original state (Θ = - Φ).

November 9, 2005 Comments (0) TrackBack (0)