Advice for mathematicians: Randomly choosing a direction Cole Zmurchok September 22, 2015

advertisement

Advice for mathematicians:

Randomly choosing a direction

Cole Zmurchok

September 22, 2015

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

How do you randomly choose a direction in 2-dimensions?

y x

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

How do you uniformly choose a direction in 2-dimensions?

y

θ x

▶ Uniformly choose θ

[0 , 2 π ]

▶ Polar coordinates x = cos θ y = sin θ give a unit vector in

R 2

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

How do you uniformly choose a direction in 2-dimensions?

This works!

1 1

0 0

-1

-1 0 x

1

-1

-1 0 x

1

Why?

Want any small “arc length” on the circle to contain the same number of points: ds =

√ dx 2 + dy 2 =

√ d θ 2 = d θ

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

How do you uniformly choose a direction in 3-dimensions?

Uniformly choose two angles: θ

[0 , 2 π ] and ϕ

[0 , π ]

Spherical coordinates: x = cos( θ ) sin( ϕ ), y = sin( θ ) sin( ϕ ), z = cos( ϕ )

Clustering at poles!

1

1

0 0

-1

1 y

0

-1 -1

0 x

1 -1

-1 0 x

1

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

How do you uniformly choose a direction in 3-dimensions?

▶ Independently choosing two angles from uniform distribution does not take into account that not all latitudes have the same circumference !

▶ Want any small area on the unit sphere to contain the same number of points, but the area element d Ω = sin ϕ d θ d ϕ is a function of ϕ .

▶ You could design a transformation so that this works.

▶ See “Sphere Point Picking” on Wolfram Mathworld.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Uniformly choosing directions Normally

Density function for a normally distributed random variable X p ( x ; µ, σ

2

) =

1

2 πσ 2 exp

(

( x

µ )

2

)

2 σ 2

Density function for a normally distributed vector-valued random variable X p ( x ; µ, Σ) =

(2 π )

1 n det(Σ) exp

(

1

2

( x

µ )

T

Σ

1

( x

µ )

) with µ

∈ R n

, Σ a positive definite n

× n covariance matrix

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Uniformly choosing directions Normally

▶ If Σ = I and µ = p ( x ; 0 , I ) =

=

1

2

1

(2

π

π ) n exp exp

(

( x

2

1

1

2

)

2 i =1 x

·

. . .

· i

2

)

1

2 π exp

(

− x

2 n

)

2

In general a n -dimensional Gaussian with mean µ

∈ R n and diagonal covariance matrix Σ = diag( σ

2

1

, . . . , σ

2 n

)

= a collection of n independent Gaussian random variables with mean

µ i and variance σ i

2

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

So what?

Uniform direction distribution in n -dimensions

1.

Generate n standard normal random variables x i

2.

The distribution of vectors

√ x

2

1

1

+

· · ·

+ x 2 n

( x

1

, . . . , x n

)

T is uniform over the unit sphere in n -dimensions

Why?

On the unit sphere in p ( x ; 0 , I ) = n

-dimensions,

1

(2 π ) n exp

∑ n i =1

(

1

2 i =1 x i

2

= 1, so

) x i

2

=

√ e

− 1

2

(2 π ) n

⇒ is spherically symmetric

⇒ distribution is constant

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Example: 3-dimensions

No clustering!

1

1

0

-1

1 y

0

-1 -1

0 x

1

0

-1

-1 0 x

1

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Example: 2-dimensions

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Download