Did I find the right examples for you? yes no

All Samples(51827)  |  Call(51825)  |  Derive(0)  |  Import(2)
abs(number) -> number

Return the absolute value of the argument.

src/s/h/shedskin-HEAD/examples/linalg.py   shedskin(Download)
def inverse(M):
     size=len(M)
     det=determinant(M)
     if abs(det) != 1: print "error, determinant is not 1 or -1"
     N=[]
def inward(U):
    b01=(abs(U[0][0])<abs(U[0][1])) or     ((abs(U[0][0])==abs(U[0][1]) and abs(U[1][0])<abs(U[1][1]))) or     ((abs(U[0][0])==abs(U[0][1]) and abs(U[1][0])==abs(U[1][1]) and      abs(U[2][0])<abs(U[2][1])))
 
    b12=(abs(U[0][1])<abs(U[0][2])) or     ((abs(U[0][1])==abs(U[0][2]) and abs(U[1][1])<abs(U[1][2]))) or     ((abs(U[0][1])==abs(U[0][2]) and abs(U[1][1])==abs(U[1][2]) and      abs(U[2][1])<abs(U[2][2])))
 

src/k/a/kamaelia-HEAD/Sketches/MPS/BugReports/FixTests/Kamaelia/Examples/OpenGL/MiniExamples/Intersect.py   kamaelia(Download)
            f = a.dot(r_dir)
            print "f", f
            if abs(f)>Intersect.epsilon:
                t1 = (e+h)/f
                t2 = (e-h)/f
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            return 0
 
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            t = 0
        else:        
 
        # project points of polyon to axis plane where polygon area is maximized
        maxn = max(abs(n.x), abs(n.y), abs(n.z))
        if abs(n.x) == maxn:
            points = [[point.y, point.z] for point in p_points]

src/k/a/kamaelia-HEAD/Code/Python/Kamaelia/Examples/OpenGL/MiniExamples/Intersect.py   kamaelia(Download)
            f = a.dot(r_dir)
            print "f", f
            if abs(f)>Intersect.epsilon:
                t1 = (e+h)/f
                t2 = (e-h)/f
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            return 0
 
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            t = 0
        else:        
 
        # project points of polyon to axis plane where polygon area is maximized
        maxn = max(abs(n.x), abs(n.y), abs(n.z))
        if abs(n.x) == maxn:
            points = [[point.y, point.z] for point in p_points]

src/s/h/shedskin-HEAD/examples/quameon/orbital/atomic_sto_primitive.py   shedskin(Download)
    r = math.sqrt(x * x + y * y + z * z)
    norm = 2**(3 / 4.0) * math.pi**(-3 / 4.0) * alpha**(3 / 4.0)
    del_sq = norm * ((alpha * z**2 * abs(r**-3) + -3 * alpha / r + alpha**2 * r**-2 * z**2 + alpha * y**2 * abs(r**-3) + alpha**2 * r**-2 * x**2 + alpha * x**2 * abs(r**-3) + alpha**2 * r**-2 * y**2) * math.exp(-alpha * r))
    return del_sq
 
    r = math.sqrt(x * x + y * y + z * z)
    norm = 2 * 2**(3 / 4.0) * math.pi**(-3 / 4.0) * alpha**(5 / 4.0)
    del_sq = norm * ((x * alpha**2 * r**-2 * z**2 + -5 * alpha * x / r + alpha * x * z**2 * abs(r**-3) + alpha * x * y**2 * abs(r**-3) + alpha * x**3 * abs(r**-3) + x * alpha**2 * r**-2 * y**2 + alpha**2 * r**-2 * x**3) * math.exp(-alpha * r))
    return del_sq
 

src/k/a/Kamaelia-0.6.0/Examples/SoC2006/THF/MiniExamples/Intersect.py   Kamaelia(Download)
            f = a.dot(r_dir)
            print "f", f
            if abs(f)>Intersect.epsilon:
                t1 = (e+h)/f
                t2 = (e-h)/f
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            return 0
 
        # test if the ray is parallel
        den = n.dot(r_dir)
        if abs(den)<Intersect.epsilon:
            t = 0
        else:        
 
        # project points of polyon to axis plane where polygon area is maximized
        maxn = max(abs(n.x), abs(n.y), abs(n.z))
        if abs(n.x) == maxn:
            points = [[point.y, point.z] for point in p_points]

src/m/a/matplotlib-1.3.1/examples/pylab_examples/fancybox_demo.py   matplotlib(Download)
def draw_bbox(ax, bb):
    # boxstyle=square with pad=0, i.e. bbox itself.
    p_bbox = FancyBboxPatch((bb.xmin, bb.ymin),
                            abs(bb.width), abs(bb.height), 
                            boxstyle="square,pad=0.",
def test1(ax):
 
    # a fancy box with round corners. pad=0.1
    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
                             abs(bb.width), abs(bb.height),
    # They can be set during the initialization.
    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
                             abs(bb.width), abs(bb.height),
                             boxstyle="round,pad=0.1",
                             fc=(1., .8, 1.),

src/s/n/snake-challenge-HEAD/examples/ray/player.py   snake-challenge(Download)
    def radia(self, map, pt, danger, factor):
        self.mapset(map, pt, danger)
        danger /= factor
        n = 1
        while abs(danger) > 1:
    def mincord(self, pt1, pt2, cord):
        min1 = pt1[cord] - pt2[cord]
        min2 = pt1[cord] + self.size[cord] - pt2[cord]
        min3 = pt1[cord] - self.size[cord] - pt2[cord]
        if abs(min1) < abs(min2) and abs(min1) < abs(min3):

src/f/u/FuncDesigner-0.5307/FuncDesigner/examples/nsp1.py   FuncDesigner(Download)
koeffs = arange(1, N+1) ** 1.2 # 1, 1.2, 1.44, ..., 1.2^m, ..., 1.2^N
 
objective = sum(abs(x) * koeffs) + abs(y-15) + abs(y+15) + y**2
constraints = [(y-1)**2<1, abs(y) < 0.5, abs(x[0]) < 1e-5, abs(x[N-1]) < 1e-5]
constraints.append((x - 0.01*arange(N))**2 < 0.1*arange(1, N+1)) # (x_0-0)**2 < 0.1, (x_1-0.01)**2 < 0.2, (x_2-0.02)**2 < 0.2,...

src/m/a/matplotlib-HEAD/examples/pylab_examples/fancybox_demo.py   matplotlib(Download)
def draw_bbox(ax, bb):
    # boxstyle=square with pad=0, i.e. bbox itself.
    p_bbox = FancyBboxPatch((bb.xmin, bb.ymin),
                            abs(bb.width), abs(bb.height), 
                            boxstyle="square,pad=0.",
def test1(ax):
 
    # a fancy box with round corners. pad=0.1
    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
                             abs(bb.width), abs(bb.height),
    # They can be set during the initiallization.
    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
                             abs(bb.width), abs(bb.height),
                             boxstyle="round,pad=0.1",
                             fc=(1., .8, 1.),

src/a/r/arraytool-HEAD/arraytool/src/other_examples/filtertool.py   arraytool(Download)
    roots_E = I_to_i(sp.nroots(poly_E))
    roots_E = np.reshape(roots_E, (len(roots_E), -1))
    roots_E = -abs(roots_E.real) + 1j * roots_E.imag # all roots to the LHS
    # create the polynomial from the obtained LHS roots
    poly_E = np.poly(roots_E.ravel().tolist())
    S11 = (1 / eps_R) * (F_val / E_val); S21 = (1 / eps) * (P_val / E_val)
    if(dB):
        S11_plt = 20 * np.log10(abs(S11)); S21_plt = 20 * np.log10(abs(S21))
        S11_plt = cutoff(S11_plt, dB_limit); S21_plt = cutoff(S21_plt, dB_limit)
        y_labl = r'$\ \mathrm{(dB)}$'
    else:
        S11_plt = abs(S11); S21_plt = abs(S21)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next