``````
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python Skript, das Naturkonstanten einliest und Groessenordnungen
abschaetzt
>>> execfile('orders-of-magnitude.py')
nb of electrons in volume 1000 nm^3: 2.789e+05
nb of electrons in volume    1 nm^3: 796.6
field with I =  100 mW/cm^2: amplitude  434 V/m
"""

from scipy.constants import physical_constants as const
from scipy.constants import pi, find
# example: find('Planck')
from scipy import real, imag, sqrt

eps0 = const['electric constant']
mu0 = const['mag. constant']
c = const['speed of light in vacuum']
hbar = const['Planck constant over 2 pi']
kB = const['Boltzmann constant']
e0 = const['elementary charge']
amu = const['unified atomic mass unit']
me = const['electron mass']
G = const['Newtonian constant of gravitation']
micron_SI = 1e-6
nm = 1e-9

if True:
# density, atom number per volume
rho = 0.968*1e3 # kg/m^3 mass density of Na
V = (10*nm)**3 # volume
mA = 22.99*amu # atomic (or molecular) mass for Na atom
Z = 11 # electrons per atom (molecule), total (10 are bound)
Nb = Z*V*rho/mA

print('nb of electrons in volume %4.4g nm^3: %4.4g' %(V/(1*nm)**3, Nb))
# density, atom number per volume
rho = 2.65*1e3 # kg/m^3 mass density of glass
V = (1*nm)**3 # volume
mA = 60.1*amu # atomic (or molecular) mass for Si + 2 x O
Z = 30 # electrons per atom (molecule), total (all are bound)
Nb = Z*V*rho/mA
print('nb of electrons in volume %4.4g nm^3: %4.4g' %(V/(1*nm)**3, Nb))

# light intensity (time-averaged) and electric field
Int = 100.*1e-3/(1e-4) # intensity in mW/cm^2 and W/m^2
field = sqrt(Int/(2*eps0*c)) # field amplitude in V/m
print('field with I = %4.4g mW/cm^2: amplitude %4.4g V/m' %(Int/(1e-3/(1e-4)), field))
``````
``` ```