def KLfamily(nm, lnom, lsym, lm, lme, lrate, mnom, mm, mme, pnom, pm, pme, mev=mega*eV.mass, Hz=Hertz): """Deciphering Kaye&Laby p449. Positional arguments are as follows: neutrino mass -- upper bound, measured in MeV lepton name -- string lepton symbol -- string lepton mass -- in MeV lepton mass error -- half-width of error bar on previous lepton decay rate -- fraction of the given lepton species which decay per second -ve quark name -- name of the quark with -ve charge e/3 -ve quark mass -- mass estimate, in GeV, for the -ve quark -ve quark mass error -- half-width of error-bar on previous +ve quark name -- name of the quark with +ve charge 2*e/3 +ve quark mass -- mass estimate, in GeV, for the +ve quark +ve quark mass error -- half-width of error bar on previous\n""" return Family(Neutrino(lnom, mass=Quantity.below(nm, mev)), Lepton(lnom, mass=Quantity.within(lm, lme, mev), symbol=lsym, decay=lrate * Hz), dQuark(mnom, mass=Quantity.within(mm, mme, kilo*mev)), uQuark(pnom, mass=Quantity.within(pm, pme, kilo*mev)))
def KLfamily(nm, lnom, lsym, lm, lme, lrate, mnom, mm, mme, pnom, pm, pme, mev=mega * eV.mass, Hz=Hertz): """Deciphering Kaye&Laby p449. Positional arguments are as follows: neutrino mass -- upper bound, measured in MeV lepton name -- string lepton symbol -- string lepton mass -- in MeV lepton mass error -- half-width of error bar on previous lepton decay rate -- fraction of the given lepton species which decay per second -ve quark name -- name of the quark with -ve charge e/3 -ve quark mass -- mass estimate, in GeV, for the -ve quark -ve quark mass error -- half-width of error-bar on previous +ve quark name -- name of the quark with +ve charge 2*e/3 +ve quark mass -- mass estimate, in GeV, for the +ve quark +ve quark mass error -- half-width of error bar on previous\n""" return Family( Neutrino(lnom, mass=Quantity.below(nm, mev)), Lepton(lnom, mass=Quantity.within(lm, lme, mev), symbol=lsym, decay=lrate * Hz), dQuark(mnom, mass=Quantity.within(mm, mme, kilo * mev)), uQuark(pnom, mass=Quantity.within(pm, pme, kilo * mev)))
See study.LICENSE for copyright and license information. """ from study.value.quantity import Quantity quid = Quantity.base_unit( '£', 'Pound Sterling', """The base unit of British currency. Used to be 20 shillings (21 shillings made a Guinea); each shilling was 12 pence, each penny was four farthings. A florin was two shillings; a crown was five. Apparently a pound was also called a sovereign. HTML supports character entity &sterling; for the Pound Sterling. To properly handle money within a system of units, I need support for variation in time and space (conversion factors between different currencies vary with time; and you'll get different exchange rates from different trading partners). Then again, conversion factors between systems of units also show similar variation - contrast the different nations' archaic units of length, and notice how units of volume got re-defined by assorted legislative acts over the years. """) # It's clearly inadequate to treat money units as approximate multiples of one # another: each is an exact unit in its place, it's only the conversion between # them that's approximate. krone = quid / Quantity.within(10, 2) del Quantity from debt import Debt, Mortgage from job import Job
from study.value.quantity import Quantity quid = Quantity.base_unit( "£", "Pound Sterling", """The base unit of British currency. Used to be 20 shillings (21 shillings made a Guinea); each shilling was 12 pence, each penny was four farthings. A florin was two shillings; a crown was five. Apparently a pound was also called a sovereign. HTML supports character entity &sterling; for the Pound Sterling. To properly handle money within a system of units, I need support for variation in time and space (conversion factors between different currencies vary with time; and you'll get different exchange rates from different trading partners). Then again, conversion factors between systems of units also show similar variation - contrast the different nations' archaic units of length, and notice how units of volume got re-defined by assorted legislative acts over the years. """, ) # It's clearly inadequate to treat money units as approximate multiples of one # another: each is an exact unit in its place, it's only the conversion between # them that's approximate. krone = quid / Quantity.within(10, 2) del Quantity from debt import Debt, Mortgage from job import Job
violet=photon(380, 420, 'violet')) # purple del photon visible.also(spectrum=(visible.red, visible.orange, visible.yellow, visible.green, visible.cyan, visible.blue, visible.indigo, visible.violet), rainbow=Quantity.within( 138.7, .7, arc.degree, """The angle through which a rainbow turns visible light. This varies with the colour of the light, red being turned least and blue most. Since the angle exceeds a quarter turn, the arc of a (pure water) rainbow appears centred on the direction opposite to the light source (generally the sun), at an angle ranging from 40.6 (violet) to 42 (red) degrees from that direction. The spray-bow resulting from sea-spray is tighter - sea water droplets turn light through a larger angle than pure water droplets. """, secondary=between( 127, 130, arc.degree, """The angle through which a secondary rainbow turns visible light. Compare visible.rainbow, the primary angle: for the secondary rainbow, red (130 degrees) is turned more than violet (127 degrees); since this range is less than that of the primary rainbow (but still more than a quarter turn), the secondary bow appears outside the primary. """))) radio = Photon(name="radio", frequency = Quantity.below(3, giga * Hertz)) microwave = Photon(name="microwave", wavelength = between(1, 100, milli * metre), frequency = between(1, 100, 3 * giga * Hertz)) infrared = Photon(name="infra-red",
del photon visible.also( spectrum=(visible.red, visible.orange, visible.yellow, visible.green, visible.cyan, visible.blue, visible.indigo, visible.violet), rainbow=Quantity.within( 138.7, .7, arc.degree, """The angle through which a rainbow turns visible light. This varies with the colour of the light, red being turned least and blue most. Since the angle exceeds a quarter turn, the arc of a (pure water) rainbow appears centred on the direction opposite to the light source (generally the sun), at an angle ranging from 40.6 (violet) to 42 (red) degrees from that direction. The spray-bow resulting from sea-spray is tighter - sea water droplets turn light through a larger angle than pure water droplets. """, secondary=between( 127, 130, arc.degree, """The angle through which a secondary rainbow turns visible light. Compare visible.rainbow, the primary angle: for the secondary rainbow, red (130 degrees) is turned more than violet (127 degrees); since this range is less than that of the primary rainbow (but still more than a quarter turn), the secondary bow appears outside the primary. """))) radio = Photon(name="radio", frequency=Quantity.below(3, giga * Hertz)) microwave = Photon(name="microwave", wavelength=between(1, 100, milli * metre), frequency=between(1, 100, 3 * giga * Hertz))