def _std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): ret = _var(a, axis=axis, dtype=dtype, out=out, ddof=ddof, keepdims=keepdims) if isinstance(ret, mu.ndarray): ret = um.sqrt(ret, out=ret) else: ret = um.sqrt(ret) return ret
print '*' * 80 print 'Example of a three part assembly' x1 = N(24, 1) x2 = N(37, 4) x3 = Exp(2) # Exp(mu=0.5) is the same Z = (x1 * x2**2) / (15 * (1.5 + x3)) Z.describe() print '*' * 80 print 'Example of volumetric gas flow through orifice meter' H = N(64, 0.5) M = N(16, 0.1) P = N(361, 2) t = N(165, 0.5) C = 38.4 Q = C * umath.sqrt((520 * H * P) / (M * (t + 460))) Q.describe() print '*' * 80 print 'Example of manufacturing tolerance stackup' # for a gamma distribution we need the following conversions: # shape = mean**2/var # scale = var/mean mn = 1.5 vr = 0.25 k = mn**2 / vr theta = vr / mn x = Gamma(k, theta) y = Gamma(k, theta) z = Gamma(k, theta) w = x + y + z
# Temperature units # internal unit: K K = 1 # Kelvin # Pressure units # internal unit: kJ/mol/nm**3 Pa = J/m**3 # Pascal bar = 1.e5*Pa # bar atm = 101325*Pa # atmosphere # Constants h = 6.626176e-34*J*s hbar = h/(2.*pi) k_B = 1.3806513e-23*J/K eps0 = 1./(4.e-7*pi)*A**2*m/J/c**2 me = 0.51099906*mega*eV/c**2 electrostatic_energy = 1/(4.*pi*eps0) # CHARMM time unit akma_time = umath.sqrt(Ang**2/(kcal/mol)) # "Atomic" units Bohr = 4.*pi*eps0*hbar**2/(me*e**2) Hartree = hbar**2/(me*Bohr**2)
def point_distances(vec1, vec2): return umath.sqrt((vec2.real-vec1.real)**2.0 + (vec2.imag-vec1.imag)**2.0)
print '*'*80 print 'Example of a three part assembly' x1 = N(24, 1) x2 = N(37, 4) x3 = Exp(2) # Exp(mu=0.5) is the same Z = (x1*x2**2)/(15*(1.5 + x3)) Z.describe() print '*'*80 print 'Example of volumetric gas flow through orifice meter' H = N(64, 0.5) M = N(16, 0.1) P = N(361, 2) t = N(165, 0.5) C = 38.4 Q = C*umath.sqrt((520*H*P)/(M*(t + 460))) Q.describe() print '*'*80 print 'Example of manufacturing tolerance stackup' # for a gamma distribution we need the following conversions: # shape = mean**2/var # scale = var/mean mn = 1.5 vr = 0.25 k = mn**2/vr theta = vr/mn x = Gamma(k, theta) y = Gamma(k, theta) z = Gamma(k, theta) w = x + y + z
def point_distances(vec1, vec2): return umath.sqrt((vec2.real - vec1.real)**2.0 + (vec2.imag - vec1.imag)**2.0)