http://www.reuters.com/article/2009/01/30/us-iraq-shoe-odd-idUSTRE50T54M20090130
The video is so good. It was probably the peak of Bush's presidency. He dodged it like he had been training his entire life for that moment.
https://www.youtube.com/watch?v=_RFH7C3vkK4
This blog exists purely as a place for me to dump random links and thoughts I have rather than emailing them to my friends. It'll have large amounts of inside jokes. Also there will probably be times when I write "you" or refer to an email. Just pretend that you are reading an email to you. If you don't know me you likely won't find anything here interesting. If you do know me you also will not find anything here interesting.
Thursday, March 21, 2013
Thursday, March 14, 2013
Errors from Rounding Pi
In honor of Pi Day, I did some calculations on the error introduced by rounding pi. This has been done plenty of times already, but it was fun.
The key point is that rather crude approximations are still plenty accurate. Just using 3 only leads to a 4.5% error, and the common 3.14 is good for 0.05%, which is a better tolerance than anything you're likely to do.
I also list the absolute errors when calculating circumferences of circles with various radii. If you are calculating a circle with a radius of the observable universe, you'll need about 62 digits (first calculated in 1699) to get the error below 1 Planck length. That ought to be enough for anybody.
Relative error:
Absolute error in calculating the circumference of a circle with the given radius:
The key point is that rather crude approximations are still plenty accurate. Just using 3 only leads to a 4.5% error, and the common 3.14 is good for 0.05%, which is a better tolerance than anything you're likely to do.
I also list the absolute errors when calculating circumferences of circles with various radii. If you are calculating a circle with a radius of the observable universe, you'll need about 62 digits (first calculated in 1699) to get the error below 1 Planck length. That ought to be enough for anybody.
Relative error:
Digits | Value | Error |
1 | 3 | 4.5070342% |
2 | 3.1 | 1.3239353% |
3 | 3.14 | 0.0506958% |
4 | 3.142 | -0.0129662% |
5 | 3.1416 | -0.0002338% |
6 | 3.14159 | 0.0000845% |
7 | 3.141593 | -0.0000110% |
8 | 3.1415927 | -0.0000015% |
9 | 3.14159265 | 0.0000001% |
10 | 3.141592654 | 0.0000000% |
Absolute error in calculating the circumference of a circle with the given radius:
Digits | Meter | Mile | Earth | Astronomical Unit | Light Year | Galaxy | Observable Universe |
1 | 28.32 cm | 0.46 km | 1,804.17 km | 42,363,900 km | 17,908.56 AU | 14,159.27 ly | 3,993.87 Mpc |
2 | 8.32 cm | 133.87 m | 529.97 km | 12,444,300 km | 5,260.62 AU | 4,159.27 ly | 1,173.19 Mpc |
3 | 3.19 mm | 5.13 m | 20.29 km | 476,500 km | 201.44 AU | 159.27 ly | 44.92 Mpc |
4 | 0.81 mm | 1.31 m | 5.19 km | 121,900 km | 51.52 AU | 40.73 ly | 11.49 Mpc |
5 | 14.69 µm | 2.36 cm | 93.61 m | 2,198.01 km | 0.93 AU | 0.73 ly | 675,900 ly |
6 | 5.31 µm | 0.85 cm | 33.81 m | 793.94 km | 50,208,700 km | 16,781.23 AU | 244,100 ly |
7 | 0.69 µm | 1.11 mm | 4.41 m | 103.64 km | 6,554,400 km | 2,190.69 AU | 31,869.74 ly |
8 | 92.82 nm | 149.38 µm | 0.59 m | 13.89 km | 878,100 km | 293.5 AU | 4,269.74 ly |
9 | 7.18 nm | 11.55 µm | 4.57 cm | 1.07 km | 67,922.68 km | 22.7 AU | 330.26 ly |
10 | 0.82 nm | 1.32 µm | 0.52 cm | 122.73 m | 7,761.55 km | 2.59 AU | 37.74 ly |
11 | 20.41 pm | 32.85 nm | 130.05 µm | 3.05 m | 193.12 km | 9,656,100 km | 0.94 ly |
12 | 0.41 pm | 0.67 nm | 2.63 µm | 6.19 cm | 3.91 km | 195,600 km | 1,202.95 AU |
13 | 0.41 pm | 0.67 nm | 2.63 µm | 6.19 cm | 3.91 km | 195,600 km | 1,202.95 AU |
14 | 13.52 fm | 21.76 pm | 86.16 nm | 2.02 mm | 127.94 m | 6,396.77 km | 39.34 AU |
15 | 6.48 fm | 10.42 pm | 41.26 nm | 0.97 mm | 61.28 m | 3,063.76 km | 18.84 AU |
16 | 0.48 fm | 0.77 pm | 3.04 nm | 71.35 µm | 4.51 m | 225.6 km | 1.39 AU |
17 | 76,925,300 ym | 123.8 fm | 0.49 nm | 11.51 µm | 0.73 m | 36.39 km | 33,476,700 km |
18 | 3,074,700 ym | 4.95 fm | 19.59 pm | 0.46 µm | 2.91 cm | 1.45 km | 1,338,100 km |
19 | 925,300 ym | 1.49 fm | 5.9 pm | 138.42 nm | 0.88 cm | 0.44 km | 402,700 km |
20 | 74,713.23 ym | 120,239,000 ym | 0.48 pm | 11.18 nm | 0.71 mm | 35.34 m | 32,514.03 km |
21 | 5,286.77 ym | 8,508,200 ym | 33.68 fm | 0.79 nm | 50.02 µm | 2.5 m | 2,300.72 km |
22 | 713.23 ym | 1,147,800 ym | 4.54 fm | 106.7 pm | 6.75 µm | 33.74 cm | 310.39 km |
23 | 86.77 ym | 139,600 ym | 0.55 fm | 12.98 pm | 0.82 µm | 4.1 cm | 37.76 km |
24 | 6.77 ym | 10,889.69 ym | 43,109,700 ym | 1.01 pm | 64.02 nm | 3.2 mm | 2.94 km |
25 | 0.77 ym | 1,233.65 ym | 4,883,700 ym | 114.68 fm | 7.25 nm | 362.6 µm | 333.59 m |
26 | 2,069,113,700 pl | 53.82 ym | 213,100 ym | 5 fm | 316.37 pm | 15.82 µm | 14.55 m |
27 | 405,829,100 pl | 10.56 ym | 41,787.43 ym | 0.98 fm | 62.05 pm | 3.1 µm | 2.85 m |
28 | 34,587,700 pl | 0.9 ym | 3,561.43 ym | 83,626,100 ym | 5.29 pm | 264.42 nm | 24.33 cm |
29 | 2,536,500 pl | 4,082,025,600 pl | 261.17 ym | 6,132,600 ym | 0.39 pm | 19.39 nm | 1.78 cm |
30 | 61,516.66 pl | 99,001,200 pl | 6.33 ym | 148,700 ym | 9.41 fm | 0.47 nm | 0.43 mm |
31 | 61,516.66 pl | 99,001,200 pl | 6.33 ym | 148,700 ym | 9.41 fm | 0.47 nm | 0.43 mm |
32 | 356.91 pl | 574,400 pl | 2,273,880,900 pl | 862.94 ym | 54,572,100 ym | 2.73 pm | 2.51 µm |
33 | 356.91 pl | 574,400 pl | 2,273,880,900 pl | 862.94 ym | 54,572,100 ym | 2.73 pm | 2.51 µm |
34 | 14.33 pl | 23,062.27 pl | 91,298,100 pl | 34.65 ym | 2,191,100 ym | 109.56 fm | 100.79 nm |
35 | 1.96 pl | 3,147.15 pl | 12,458,800 pl | 4.73 ym | 299,000 ym | 14.95 fm | 13.75 nm |
36 | 0.52 pl | 835.87 pl | 3,309,000 pl | 1.26 ym | 79,414.88 ym | 3.97 fm | 3.65 nm |
37 | 0.02 pl | 39.27 pl | 155,400 pl | 3,650,060,700 pl | 3,730.65 ym | 186,532,700 ym | 171.61 pm |
38 | 0 pl | 0.56 pl | 2,231.63 pl | 52,401,000 pl | 53.56 ym | 2,677,900 ym | 2.46 pm |
39 | 0 pl | 0.56 pl | 2,231.63 pl | 52,401,000 pl | 53.56 ym | 2,677,900 ym | 2.46 pm |
40 | 0 pl | 0.03 pl | 133.55 pl | 3,136,000 pl | 3.21 ym | 160,300 ym | 147.44 fm |
41 | 0 pl | 0.01 pl | 24.13 pl | 566,500 pl | 0.58 ym | 28,949.81 ym | 26.63 fm |
42 | 0 pl | 0 pl | 0.47 pl | 11,118.95 pl | 703,159,600 pl | 568.22 ym | 0.52 fm |
43 | 0 pl | 0 pl | 0.31 pl | 7,393.36 pl | 467,553,800 pl | 377.83 ym | 347,603,600 ym |
44 | 0 pl | 0 pl | 0 pl | 11.57 pl | 731,600 pl | 0.59 ym | 543,900 ym |
45 | 0 pl | 0 pl | 0 pl | 11.57 pl | 731,600 pl | 0.59 ym | 543,900 ym |
46 | 0 pl | 0 pl | 0 pl | 6.94 pl | 439,100 pl | 21,957,068,900 pl | 326,500 ym |
47 | 0 pl | 0 pl | 0 pl | 0.46 pl | 29,143.95 pl | 1,457,197,300 pl | 21,667.11 ym |
48 | 0 pl | 0 pl | 0 pl | 0.09 pl | 5,729.68 pl | 286,484,000 pl | 4,259.74 ym |
49 | 0 pl | 0 pl | 0 pl | 0 pl | 123.89 pl | 6,194,300 pl | 92.1 ym |
50 | 0 pl | 0 pl | 0 pl | 0 pl | 6.81 pl | 340,700 pl | 5.07 ym |
51 | 0 pl | 0 pl | 0 pl | 0 pl | 4.89 pl | 244,600 pl | 3.64 ym |
52 | 0 pl | 0 pl | 0 pl | 0 pl | 0.21 pl | 10,479.35 pl | 9,641,002,700 pl |
53 | 0 pl | 0 pl | 0 pl | 0 pl | 0.02 pl | 1,227.78 pl | 1,129,559,800 pl |
54 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 57.07 pl | 52,503,500 pl |
55 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 1.47 pl | 1,349,300 pl |
56 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 1.47 pl | 1,349,300 pl |
57 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0.29 pl | 266,300 pl |
58 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 2,983.86 pl |
59 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 2,401.42 pl |
60 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 247.31 pl |
61 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 21.96 pl |
62 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0.41 pl |
63 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0.12 pl |
64 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0.02 pl |
65 | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl | 0 pl |
Wednesday, March 13, 2013
Project Prevention
Project Prevention says their main goal is to promote awareness of the dangers of using drugs during pregnancy. They are better known, however, for paying drug addicts cash for volunteering for long-term birth control, including sterilization. The organization offers US$300 (£200 in the UK) to each participant. The New York Times reports that the organization initially offered more money to women who chose tubal ligations and men who chose vasectomies than to those who chose long-term birth control like intrauterine devices, but criticism forced them to adopt a flat rate. To receive the money, clients have to show evidence they have been arrested on a drug-related offence, or provide a doctor's certificate saying they use drugs, and further evidence is needed confirming that the birth-control procedure has taken place. The organization keeps statistics on its activities through survey forms that all participants fill out, before any procedure is completed. As of August 2011 based on survey forms from 3,848 clients it had paid: 1,996 (51.9%) were Caucasian; 956 (24.8%) African American; 484 (12.6%) Hispanic; 412 (10.7%) other.
Sunday, March 10, 2013
How Long to Freeze in Space
A common Sci-Fi trope is a ship losing power and the crew slowly freezing to death. I decided to do some calculations to see how long this would take to happen. This turns out to be pretty hard to actually do, mainly due to the large number of unknowns.
In the vacuum of space, only one of the three types of heat transfer applies: radiation. The formula for heat output of a body is:
`P = {dE}/{dt} = epsilon sigma A (T^4 - T_a^4)`
Where: P is power in watts, E is energy in Joules, t is time in seconds, A is surface area in square meters, and T is temperature of the object, `T_a` is ambient temperature in Kelvin. `sigma` is a constant which is `5.67 times 10^-8 {"w"}/{"m"^2 "K"}`. `epsilon` is the emissivity of the object, which ranges from 0-1.
The energy contained by an object is given by:
`E = mCT`
Where E is energy, m is mass, C is specific heat, and T is temperature. If you're going to do any calculations be careful with specific heat, as it is usually given in J/(g K), not J/(kg K).
Luckily, it's pretty easy to estimate just with a spreadsheet. We can put each degree from say 70F to 32F and use the first formula to find the heat power output (the change between each degree is less than 1%). That output is just in joules per second. We can find the total heat energy of an object at a given temperature in joules. Then you can find how long it will take to drop one degree.
However, I wanted to to solve it algebraically and get a general formula. I played around with making a differential equation of these for a while. Eventually I came up with a solution that ignores the ambient temperature (which at 3K in space is pretty ignorable).
Take the derivative with respect to time of the heat energy:
`{dE}/{dt} = mC {dT}/{dt}`
Now note that we already have a formula for `{dE}/{dt}` (and ignore the ambient temperature):
`epsilon sigma A T^4 = mC {dT}/{dt}`
Now we have one of those separable differential equations all the kids are always talking about:
`int {mC}/{epsilon sigma A} {dT}/{T^4} = int dt`
Evaluating the definite integral gives the formula:
`t(T_f) = {- m C}/{3 cdot A sigma epsilon}(1/T_0^3 - 1/T_f^3)`
Where: `T_0` is initial temperature, and `T_f` is final temperature, both in Kelvin.
Four of the above variables need to be estimated. To give some idea how accurate the estimates are, all the variables are liner. This means if you double one it'll double the time (or half it). Most of the variables are hard to estimate to within even an order of magnitude. The formula also mainly serves as a worst case estimate.
Being near a star would add enough heat that the problem could be over heating (indeed it is for the ISS). As noted on that page, our current spacecraft have mylar insulating layers which reduce the effective emissivity to 0.03. This increases the cooling time by a factor of 33 over what one would assume with a simple dull paint.
The formula also assumes the object is of uniform material and temperature. In reality the specific heat of materials varies quite a bit. Most metals are < 0.5, compared to water at 4.2. It's probably fair to assume most the thermal mass comes from the metal in the ship, so I've used 0.5 in my estimates.
The formula also ignores the fact that as the outside of the ship cools heat must be transfered from the interior (via conduction and convection) before it can radiate into space. This slows the process down more, by an amount that I don't even want to estimate. If the ship is designed to passively hold heat (which seems like it might be a good idea), it could easily be several orders of magnitude.
Mass and surface area of a fictional ship are pretty hard to estimate, to say the least. I got my estimates from the infamous Star Trek vs Star Wars site. If you think the estimates are wrong, feel free to head over there and start an argument about it.
Finally, it's also worth noting here these all assume there is no internal power generated. The power output of the runabout is about 150 kW. Anything generating power inside would subtract from that rate and increase the time to freeze. A human body only gives off about 100 watts each, and lights would probably be around 1 kW max. So, it would seem that in a situation where a small ship loses all power, freezing to death would be a serious concern. Of course humans can survive temperatures well below freezing. It would seem like a good idea to equip small ships with survival suits with an internal power source.
The time it takes to go from 70F to 0F varies from hours to months. The general trend is larger the object the longer it takes. A human body would only take a few hours. A small ship (runabout, max crew: 15) could be anywhere from 12 hours to a couple weeks. A large ship (galaxy class, crew: about 1200) would take months to years.
I made a table with some estimates, keep in mind these are probably underestimates. I used 0F as the final temp because I think it's reasonable for a clothed human to survive down to that.
In the vacuum of space, only one of the three types of heat transfer applies: radiation. The formula for heat output of a body is:
`P = {dE}/{dt} = epsilon sigma A (T^4 - T_a^4)`
Where: P is power in watts, E is energy in Joules, t is time in seconds, A is surface area in square meters, and T is temperature of the object, `T_a` is ambient temperature in Kelvin. `sigma` is a constant which is `5.67 times 10^-8 {"w"}/{"m"^2 "K"}`. `epsilon` is the emissivity of the object, which ranges from 0-1.
The energy contained by an object is given by:
`E = mCT`
Where E is energy, m is mass, C is specific heat, and T is temperature. If you're going to do any calculations be careful with specific heat, as it is usually given in J/(g K), not J/(kg K).
Luckily, it's pretty easy to estimate just with a spreadsheet. We can put each degree from say 70F to 32F and use the first formula to find the heat power output (the change between each degree is less than 1%). That output is just in joules per second. We can find the total heat energy of an object at a given temperature in joules. Then you can find how long it will take to drop one degree.
However, I wanted to to solve it algebraically and get a general formula. I played around with making a differential equation of these for a while. Eventually I came up with a solution that ignores the ambient temperature (which at 3K in space is pretty ignorable).
Take the derivative with respect to time of the heat energy:
`{dE}/{dt} = mC {dT}/{dt}`
Now note that we already have a formula for `{dE}/{dt}` (and ignore the ambient temperature):
`epsilon sigma A T^4 = mC {dT}/{dt}`
Now we have one of those separable differential equations all the kids are always talking about:
`int {mC}/{epsilon sigma A} {dT}/{T^4} = int dt`
Evaluating the definite integral gives the formula:
`t(T_f) = {- m C}/{3 cdot A sigma epsilon}(1/T_0^3 - 1/T_f^3)`
Where: `T_0` is initial temperature, and `T_f` is final temperature, both in Kelvin.
Four of the above variables need to be estimated. To give some idea how accurate the estimates are, all the variables are liner. This means if you double one it'll double the time (or half it). Most of the variables are hard to estimate to within even an order of magnitude. The formula also mainly serves as a worst case estimate.
Being near a star would add enough heat that the problem could be over heating (indeed it is for the ISS). As noted on that page, our current spacecraft have mylar insulating layers which reduce the effective emissivity to 0.03. This increases the cooling time by a factor of 33 over what one would assume with a simple dull paint.
The formula also assumes the object is of uniform material and temperature. In reality the specific heat of materials varies quite a bit. Most metals are < 0.5, compared to water at 4.2. It's probably fair to assume most the thermal mass comes from the metal in the ship, so I've used 0.5 in my estimates.
The formula also ignores the fact that as the outside of the ship cools heat must be transfered from the interior (via conduction and convection) before it can radiate into space. This slows the process down more, by an amount that I don't even want to estimate. If the ship is designed to passively hold heat (which seems like it might be a good idea), it could easily be several orders of magnitude.
Mass and surface area of a fictional ship are pretty hard to estimate, to say the least. I got my estimates from the infamous Star Trek vs Star Wars site. If you think the estimates are wrong, feel free to head over there and start an argument about it.
Finally, it's also worth noting here these all assume there is no internal power generated. The power output of the runabout is about 150 kW. Anything generating power inside would subtract from that rate and increase the time to freeze. A human body only gives off about 100 watts each, and lights would probably be around 1 kW max. So, it would seem that in a situation where a small ship loses all power, freezing to death would be a serious concern. Of course humans can survive temperatures well below freezing. It would seem like a good idea to equip small ships with survival suits with an internal power source.
The time it takes to go from 70F to 0F varies from hours to months. The general trend is larger the object the longer it takes. A human body would only take a few hours. A small ship (runabout, max crew: 15) could be anywhere from 12 hours to a couple weeks. A large ship (galaxy class, crew: about 1200) would take months to years.
I made a table with some estimates, keep in mind these are probably underestimates. I used 0F as the final temp because I think it's reasonable for a clothed human to survive down to that.
Name | Length (m) | Crew | Surface Area (`"m"^2`) | Metric Tons | Time 70F to 0F |
Death Star II | 160,000 | 2,500,000 | 80,400,000,000 | 1,500,000,000,000,000 | 1199 years |
Super Star Destroyer | 17,600 | 300,000 | 201,911,000 | 8,322,000,000 | 2.65 years |
Borg Cube | 3,036 | 130,000 | 55,325,235 | 60,000,000,000 | 70 years |
Enterprise-D | 642 | 1,200 | 524,742 | 10,200,000 | 1.25 years |
Enterprise | 310 | 430 | 145,901 | 1,000,000 | 161 days |
Runabout | 23 | 8 | 2,082 | 1,000 | 11.3 days |
Type 6 Shuttlecraft | 6 | 2 | 92 | 50 | 12.8 days |
TIE Fighter | 6 | 1 | 190 | 6 | 17.8 hours |
Naked Human | 2 | 1 | 1.80 | 0.090 | 0.96 hours (98.6F to 84F) |