Tuesday, July 7, 2009

An amusing problem

Here's an interesting problem. A skater is performing an upright spin. As she pulls in her arms and is spinning faster and faster, suddenly a shot rings out. Our skater is hit, but she does not fall (but she stops her angular acceleration and now rotates evenly. Go figure.) Droplets of blood are thrown off by centrifugal force and hit the wall of the rink.

Later that week, CSI is called in. They need to determine the exact position on the ice where the skater was. The Zamboni has already been run, so the only clue is the position of the blood stains on the wall. The stains have run, so the vertical measurement is useless. The drops were too small to form ellipsoid shapes. The only measurement is the horizontal position of the blood stains.

So imagine a grid placed on the rink so that one long wall is on the Y axis and the center line is on the X axis. The skater is at position (x,y), and when a drop of blood comes off, it moves in a straight line at a random angle and strikes the wall. (If it goes away from the wall, it hits the ice and the Zamboni erases it.) We can model this:
(define (skater distance-from-wall distance-from-centerline)
  (lambda ()
    (+ (* (tan (* (random 1.0) *pi*)) distance-from-wall)
       distance-from-centerline)))

(define test-skater (skater 3 2)) ;; 3 meters from the wall, 2 above the CL

(test-skater)
;Value: 38.317142690716395

(test-skater)
;Value: .9959730295057432

(test-skater)
;Value: 4.505616575826165

(test-skater)
;Value: -5.781087279218612

(test-skater)
;Value: .08491367951998141
Each time we call test-skater, we generate the position along the wall that a blood spot will be.

How do we find out where the skater is? How about using the average displacement of the spots on the wall to determine one of the axes?
(define (average-x skater count)
  (do ((i 0 (+ i 1))
       (total 0 (+ (skater) total)))
      ((>= i count) (/ total i))))

;; Converges to 2 with enough steps?

(average-x test-skater 100)
;Value: -19.147138944613047

(average-x test-skater 100)
;Value: 1.6702294390626096

(average-x test-skater 100)
;Value: -12.917476155358356
These estimates are terrible. Let's try more data points.
(average-x test-skater 1000)
;Value: 9.664970088915723

(average-x test-skater 1000)
;Value: 1.1197618210432498

(average-x test-skater 1000)
;Value: .6766247404710667

(average-x test-skater 10000)
;Value: -1.335001891411956

(average-x test-skater 100000)
;Value: -1.7106929730299765

(average-x test-skater 1000000)
;Value: -3.076252074037072

(average-x test-skater 1000000)
;Value: 7.717576932627036
The average is simply not converging. This distribution is not Gaussian. The mean of the distribution is pretty much a random meaningless number. In fact, this is one of those distributions that have an undefined variance and standard deviation. Solving this problem will be tricky.

More later...

1 comment:

Dan said...

So THAT'S what your graph is. :P