Hi Alan,

>> * Or you just get used to the fact that some numbers are not exact in 
>> floating point.
> 
> This got me thinking. How many decimal places do you need to
> accurately, say, aim a laser somewhere in a 180 degree arc accurately
> enough to hit a dime on the surface of the moon?

Here is a quick back of the envelope estimate for you.  (While I am still 
learning the Python, I can answer this one!)

The angle subtended by a dime on the earth is (approximately) given by

sin( theta ) = d / sqrt( R^2 + d^2 )

where 

d = 1 cm (the diameter of a dime)
R = 384,403 km (the average distance from the center of the earth to the center 
of the moon - the moon traverses an elliptical path about the earth)

To make the approximation simple, take advantage of the series expansion for 
sin (theta) and 1 / sqrt(R^2 + d^2)

first

d / sqrt( R^2 + d^2 ) = d / R * 1 / sqrt(1 + d^2 / R^2 )
        ~= d / R * (1 - 1/2 * d^2 / R^2 + ...)

now 

d / R = 1 * e-2 / (384403 * e3)
        ~= 3 * e-11

so the d^2 / R^2 correction will be very small, and won't effect the 
determination.  So we now have

sin (theta) ~= d / R

This will be a very small angle.  The next approximation to make is for small 
angles

sin (theta) ~= theta + ...

leaving us with

theta ~= d / R


To be approximate, assume the precision you need is equal to the size of the 
dime.  This means you need an precision of 

d theta ~= d/R ~= 3 * e-11 ( = 3 * 10^{-11} if you aren't familiar with the "e" 
notation)

this is the minimum precision you would need in both the "x" and "y" direction 
to accurately hit the dime on the moon with your laser (at its average 
distance).

Corrections to this estimate will come from the fact that the moon's radius is 
~1737 km and the earth's radius is ~6370 km, so you are actually this much 
closer (R is this much smaller).

Of course both the earth is spinning and the moon is moving relative to us, so 
you would have to account for those extra corrections as well.


Hope that wasn't too much info,


André






_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to