All Samples(1983) | Call(1850) | Derive(0) | Import(133)
pow(x, y) Return x**y (x to the power of y).
src/p/y/pylon-HEAD/examples/national_grid/tikz.py pylon(Download)
sinphi=math.sin(phi)
con=eccent*sinphi
com=.5*eccent
con=math.pow(((1.0-con)/(1.0+con)),com)
ts=math.tan(.5*((math.pi*0.5)-phi))/con
y=0-r_major*math.log(ts)
return y
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/apps/hf_explorer/hfx2.py VT-USRP-daughterboard-drivers_python(Download)
if self.active_button == 8:
new = max(0, min(500, self.slider_4.GetValue() + event.delta))
self.slider_4.SetValue(new)
self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.)))
if self.active_button == 9:
if self.PLAY_FROM_USRP == False:
if event.delta == -1:
def set_volume(self, event):
self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.)))
def set_pga(self,event):
if self.PLAY_FROM_USRP:
self.subdev.set_gain(self.slider_5.GetValue())
def am_carrier(self,event):
scale = math.pow(10,(self.slider_6.GetValue())/50.)
self.pll_carrier_scale.set_k(complex(scale,0))
# Reset AT data and start calibrate over
def AT_reset(self, event):
self.xdata = []
if ( int(new) >= 0 ) & ( int(new) <= 500 ):
self.volume = int(new)
self.slider_4.SetValue(self.volume)
self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.)))
else: # no new web commands, update state
fh = open("/var/www/cgi-bin/state/freq","w")
src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/boxcount/plot_boxcounts.py quickflash(Download)
log_mid_width = 0.5 * (p1_log_width + p2_log_width)
geom_mid_width = math.pow(10.0, log_mid_width)
mid_widths.append(geom_mid_width)
slopes.append(delta_log_count / delta_log_oneOver_width)
log_mid_width = 0.5 * (p1_log_width + p2_log_width)
geom_mid_width = math.pow(10.0, log_mid_width)
mid_widths.append(geom_mid_width)
slopes.append(delta_log_count / delta_log_oneOver_width)
src/p/y/pyjamas-0.7/examples/gwtcanvas/SuiteDemo.py Pyjamas(Download)
else:
dy = -25.0
self.canvas.lineTo( (math.pow(i, 1.5) * 2.0), 75 + dy)
self.canvas.stroke()
self.canvas.restoreContext()
src/c/o/copads-HEAD/copads/copads/samplestatistics.py copads(Download)
"""
mult = 1.0
one_over_n = 1.0 / len(inlist)
for item in inlist: mult = mult * math.pow(item, one_over_n)
return mult
def harmonicMean(self, inlist):
Usage: skew(inlist)
"""
return self.moment(inlist, 3) / math.pow(self.moment(inlist, 2), 1.5)
def kurtosis(self, inlist):
"""
Returns the kurtosis of a distribution, as defined in Numerical
Recipies (alternate defn in CRC Standard Probability and Statistics,
p.6.)
Usage: kurtosis(inlist)
"""
return self.moment(inlist, 4) / math.pow(self.moment(inlist, 2), 2.0)
src/p/y/pyjamas-0.7/examples/gcharttestapp/GChartExample04.py Pyjamas(Download)
# add (log10-transformed) powers of 2 from 1/4 to 8
for i in range(-2, 4):
self.getCurve().addPoint(i,log10(math.pow(2,i)))
# GChart's "=10^" NumberFormat prefix inverts the log10
# transform
src/c/a/cantera-HEAD/language_interfaces/python/examples/surface_chemistry/catcomb.py cantera(Download)
# chemistry on slowly
sim.surface.setCoverageEqs('on')
for iter in range(6):
mult = math.pow(10.0,(iter - 5));
surf_phase.setMultiplier(mult);
gas.setMultiplier(mult);
print 'Multiplier = ',mult
src/l/a/Langtangen-HEAD/src/py/examples/efficiency/pyefficiency.py Langtangen(Download)
def py_loop1_sincos_x2(x):
from math import sin, cos, pow # scalar sin
for i in xrange(len(x)):
x[i] = sin(x[i])*cos(x[i]) + x[i]**2
return x
def py_loop2_sincos_x2(x):
src/h/e/heatsource-HEAD/src/Stream/PyHeatsource.py heatsource(Download)
from __future__ import division from math import pow, sqrt, sin, log, atan, sin, cos, pi, tan, acos, exp,radians, degrees, log10 from random import randint from bisect import bisect class HeatSourceError(Exception): pass
Dummy1 = sin(toRadians*Obliquity) * sin(toRadians*SunApparentLong)
Declination = toDegrees*(atan(Dummy1 / sqrt(-Dummy1 * Dummy1 + 1)))
SunRadVector = (1.000001018 * (1 - pow(Eccentricity,2))) / (1 + Eccentricity * cos(toRadians*(GeoMeanAnomalySun + SunEqofCenter)))
#======================================================
#Equation of time (minutes)
Dummy = pow((tan(Obliquity * pi / 360)),2)
Dummy1 = sin(toRadians*(2 * GeoMeanLongSun))
Dummy2 = sin(toRadians*(GeoMeanAnomalySun))
Dummy3 = cos(toRadians*(2 * GeoMeanLongSun))
Dummy4 = sin(toRadians*(4 * GeoMeanLongSun))
Dummy5 = sin(toRadians*(2 * GeoMeanAnomalySun))
Et = toDegrees*(4 * (Dummy * Dummy1 - 2 * Eccentricity * Dummy2 + 4 * Eccentricity * Dummy * Dummy2 * Dummy3 - 0.5 * pow(Dummy,2) * Dummy4 - 1.25 * pow(Eccentricity,2) * Dummy5))
else:
Dummy = tan(toRadians*(AtmElevation))
if AtmElevation > 5:
RefractionCorrection = 58.1 / Dummy - 0.07 / pow(Dummy,3) + 0.000086 / pow(Dummy,5)
elif AtmElevation > -0.575:
RefractionCorrection = 1735 + AtmElevation * (-518.2 + AtmElevation * (103.4 + AtmElevation * (-12.79 + AtmElevation * 0.711)))
else:
# then adds a slight change to the depth and solves it again. It should iterate for a solution to depth
# within about 5-6 solutions.
while Converge > 1e-7:
Fy = (D_est * (W_b + z * D_est)) * pow(((D_est * (W_b + z * D_est)) / (W_b + 2 * D_est * sqrt(1+ pow(z,2)))),power) - ((n * Q_est) / sqrt(S))
thed = D_est + dy
Fyy = (thed * (W_b + z * thed)) * pow((thed * (W_b + z * thed))/ (W_b + 2 * thed * sqrt(1+ pow(z,2))),power) - (n * Q_est) / sqrt(S)
dFy = (Fyy - Fy) / dy
count += 1
# Use the calculated wetted depth to calculate new channel characteristics
A = (D_est * (W_b + z * D_est))
Pw = (W_b + 2 * D_est * sqrt(1+ pow(z,2)))
Rh = A/Pw
Ww = W_b + 2 * z * D_est
U = Q_est / A
# THis is a sheer velocity estimate, followed by an estimate of numerical dispersion
if S == 0.0:
Shear_Velocity = U
else:
Shear_Velocity = sqrt(9.8 * D_est * S)
Dispersion = (0.011 * pow(U,2.0) * pow(Ww,2.0)) / (D_est * Shear_Velocity)
else:
Shear_Velocity = sqrt(9.8 * D_est * S)
Dispersion = (0.011 * pow(U,2.0) * pow(Ww,2.0)) / (D_est * Shear_Velocity)
if (Dispersion * dt / pow(dx,2.0)) > 0.5:
Dispersion = (0.45 * pow(dx,2)) / dt
#Dispersion = 50
return D_est, A, Pw, Rh, Ww, U, Dispersion
src/p/y/pytrafikanten-HEAD/trafikanten/util.py pytrafikanten(Download)
k0 = 0.9996
arc = northing / k0
mu = arc / (a * (1 - math.pow(e, 2) / 4.0 - 3 * math.pow(e, 4) / 64.0 - 5 * math.pow(e, 6) / 256.0))
ei = (1 - math.pow((1 - e * e), (1 / 2.0))) / (1 + math.pow((1 - e * e), (1 / 2.0)))
ca = 3 * ei / 2 - 27 * math.pow(ei, 3) / 32.0
cb = 21 * math.pow(ei, 2) / 16 - 55 * math.pow(ei, 4) / 32
cc = 151 * math.pow(ei, 3) / 96
cd = 1097 * math.pow(ei, 4) / 512
cd = 1097 * math.pow(ei, 4) / 512
phi1 = mu + ca * math.sin(2 * mu) + cb * math.sin(4 * mu) + cc * math.sin(6 * mu) + cd * math.sin(8 * mu)
n0 = a / math.pow((1 - math.pow((e * math.sin(phi1)), 2)), (1 / 2.0))
r0 = a * (1 - e * e) / math.pow((1 - math.pow((e * math.sin(phi1)), 2)), (3 / 2.0))
fact1 = n0 * math.tan(phi1) / r0
_a1 = 500000 - easting
dd0 = _a1 / (n0 * k0)
fact2 = dd0 * dd0 / 2
t0 = math.pow(math.tan(phi1), 2)
Q0 = e1sq * math.pow(math.cos(phi1), 2)
t0 = math.pow(math.tan(phi1), 2)
Q0 = e1sq * math.pow(math.cos(phi1), 2)
fact3 = (5 + 3 * t0 + 10 * Q0 - 4 * Q0 * Q0 - 9 * e1sq) * math.pow(dd0, 4) / 24
fact4 = (61 + 90 * t0 + 298 * Q0 + 45 * t0 * t0 - 252 * e1sq - 3 * Q0 * Q0) * math.pow(dd0, 6) / 720
lof1 = _a1 / (n0 * k0)
lof2 = (1 + 2 * t0 + Q0) * math.pow(dd0, 3) / 6.0
lof3 = (5 - 2 * Q0 + 28 * t0 - 3 * math.pow(Q0, 2) + 8 * e1sq + 24 * math.pow(t0, 2)) * math.pow(dd0, 5) / 120
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next