# nature.py - Information about the universe around us. # # Version of 2006-02-20. # """ Constants of nature, attached to units. Here are some examples of the use of this package. Example 1: have you ever wondered about the magnitude of the centrifugal force due to the Earth's rotation when you're standing on the equator? >>> import nature >>> r = nature.earth_equatorial_radius >>> w = 2 * 3.1416 / nature.earth_rotation_period >>> print w*w*r 3.39172088527 cm /sec^2 Example 2: did you know the Sun pulls on the Moon harder than the Earth does? >>> G = nature.gravitational_constant >>> re = nature.moon_orbit_radius # Moon-Earth distance >>> rs = ( nature.earth_orbit_radius + re ) # Moon farthest from sun. >>> ms = nature.sun_mass >>> me = nature.earth_mass >>> print "Earth pull:", G*me/re/re Earth pull: 0.27021048893 cm /sec^2 >>> print "Sun pull:", G*ms/rs/rs Sun pull: 0.585397316513 cm /sec^2 # About twice Earth's pull. Example 3: We address the question, "If 'natural' units are such that Plank's constant, the speed of light, and the gravitational constant all take the value of unity, then what is the natural unit of mass?" >>> h = nature.plancks_constant >>> c = nature.speed_of_light >>> G = nature.gravitational_constant >>> print h # First, we will note the units of 6.6262e-27 g cm^2 /sec # the three basic quantities . . . >>> print c 29979250000.0 cm /sec >>> print G 6.6732e-08 cm^3 /g /sec^2 >>> print h/G # Guessing a step in the right direction 9.92956902236e-20 g^2 sec /cm # gets us within sight of our objective. >>> print h*c/G 2.97681032114e-09 g^2 # We see that hc/G has units of grams^2. >>> print nature.sqrt( h*c/G ) 5.4560153236e-05 g # ... so this is the natural unit of mass. Using the "units" module, you can convert numbers to other units: >>> import units >>> r = nature.moon_radius >>> print 2 * r / units.mile 2159.88626422 # Moon's diameter, in miles. """ import units g = units.gram cm = units.centimeter s = units.second day = units.day k = units.kelvin coulomb = units.coulomb erg = units.erg sqrt = units.sqrt avogadros_number = 6.02257e23 speed_of_light = 2.997925e10 * cm / s electron_charge = 1.60219e-19 * coulomb plancks_constant = 6.6262e-27 * erg * s electron_rest_mass = 9.1096e-28 * g fine_structure_constant = 7.297351e-3 proton_mass = 1.672614e-24 * g neutron_mass = 1.674920e-24 * g mu_e = 9.284851e-21 # Electron magnetic moment, erg/Gauss gas_constant_mol = 8.31434e7 * erg / k boltzmanns_constant = 1.380622e-16 * erg / k stefan_boltzmann_constant = 5.66961e-5 * erg/s/cm/cm/k/k/k/k gravitational_constant = 6.6732e-8 * erg*cm/g/g atomic_mass_unit = 1.65979e-24 * g earth_surface_gravity = 980 * cm/s/s # Gravity on Earth's surface, lat = 38N. earth_mass = 5.983e27 * g earth_polar_radius = 6.35691e8 * cm earth_equatorial_radius = 6.378390e8 * cm earth_radius = 6.37122e8 * cm earth_land_area = 148.847e16 * cm * cm earth_orbit_radius = 1.495e13 * cm earth_orbit_period = 365.24 * day earth_rotation_period = day * ( 1 - 1 / ( 1 + earth_orbit_period / day ) ) moon_mass = 0.01228 * earth_mass moon_radius = 3476.e5/2 * cm moon_orbit_radius = 3.84393e10 * cm moon_orbit_period = 27.32 * day sun_mass = 3.2939e5 * earth_mass sun_radius = 1.3906e11/2 * cm