• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(2441)  |  Call(2083)  |  Derive(0)  |  Import(358)
exp(x)

Return e raised to the power of x.

src/l/a/Langtangen-HEAD/src/py/examples/efficiency/pyefficiency.py   Langtangen(Download)
    if isinstance(languages, str):
        languages = [languages]
 
    from math import sin, exp
    if 'F77' in languages:
        try:
            from matrix_f77 import makematrix, set, tonumpy, adump, \
    def setmatrix2_py():
        """Fill NumPy matrix in Python loop; sin/exp formula."""
        for i in xrange(n):
            x = i*0.1
            for j in xrange(n):
                y = j*0.1
                a[i, j] = sin(x)*sin(y)*exp(-x*y)
    def setmatrix2b_py():
        """Fill NumPy matrix in Python loop; sin/exp formula; a[i][j]"""
        for i in xrange(n):
            x = i*0.1
            for j in xrange(n):
                y = j*0.1
                a[i][j] = sin(x)*sin(y)*exp(-x*y)
    def setmatrix2_f_index():
        """Fill F77 matrix in a Python loop with F77 set calls; sin/exp."""
        for i in xrange(n):
            x = 0.1*i
            for j in xrange(n):
                y = 0.1*j
                set(i, j, sin(x)*sin(y)*exp(-x*y))
            x = 0.1*i
            for j in xrange(n):
                y = 0.1*j
                af = set_a(af, i, j, sin(x)*sin(y)*exp(-x*y))
                # note that the first time, a is copied and transposed
                # by the wrapper code, but this is done only once
        return af
    def setmatrix2_c_index1():
        """Fill C++ matrix in a Python loop with m.set indexing; sin/exp."""
        for i in xrange(n):
            x = 0.1*i
            for j in xrange(n):
                y = 0.1*j
                m.set(i, j, sin(x)*sin(y)*exp(-x*y))
    def setmatrix2_c_index3():
        """Avoid proxy class, call Matrix_set directly; sin/exp formula."""
        for i in xrange(n):
            x = 0.1*i
            for j in xrange(n):
                y = 0.1*j
                Matrix_set(m, i, j, sin(x)*sin(y)*exp(-x*y))
    def setmatrix2_c_index4():
        """Avoid proxy class, call _matrix_cpp.Matrix_set directly; sin/exp formula."""
        for i in xrange(n):
            x = 0.1*i
            for j in xrange(n):
                y = 0.1*j
                _matrix_cpp.Matrix_set(m, i, j, sin(x)*sin(y)*exp(-x*y))

src/h/e/hedge-0.91/examples/wave/wave-min.py   hedge(Download)
def main() :
    from math import sin, exp, sqrt
 
    from hedge.mesh import make_rect_mesh
    mesh = make_rect_mesh(a=(-0.5,-0.5),b=(0.5,0.5),max_area=0.008)
 
    from hedge.discr_precompiled import Discretization
    def source_u(x, el):
        return exp(-numpy.dot(x, x)*128)
 
    source_u_vec = discr.interpolate_volume_function(source_u)
 
    def source_vec_getter(t):
        from math import sin

src/p/y/pyjamas-0.7/examples/libtest/RandomModuleTest.py   Pyjamas(Download)
from UnitTest import UnitTest
 
import random
from math import log, exp, sqrt, pi
try:
    from math import fsum as msum
except:
    v1 = v1.__add__(v2)
    s = msum(v1)
    z += 0.5
    return (z+g)**z / exp(z+g) * sqrt(2.0*pi) * s
 
class RandomModuleTest(UnitTest):
 

src/h/e/hedge-0.91/examples/wave/wave.py   hedge(Download)
    from hedge.timestep import RK4TimeStepper, AdamsBashforthTimeStepper
    from hedge.visualization import SiloVisualizer, VtkVisualizer
    from pytools.stopwatch import Job
    from math import sin, cos, pi, exp, sqrt
    from hedge.parallel import guess_parallelization_context
 
    pcon = guess_parallelization_context()
    def source_u(x, el):
        return exp(-numpy.dot(x, x)*128)
 
    source_u_vec = discr.interpolate_volume_function(source_u)
 
    def source_vec_getter(t):
        from math import sin

src/h/e/hedge-0.91/examples/maxwell/maxwell2d.py   hedge(Download)
            SiloVisualizer, \
            get_rank_partition
    from pylo import DB_VARTYPE_VECTOR
    from math import sqrt, pi, exp
    from analytic_solutions import \
            check_time_harmonic_solution, \
            RealPartAdapter, \
        def __call__(self, x, el):
            return [0,0,exp(-80*la.norm(x))]
 
    for order in [3]:
        discr = pcon.make_discretization(mesh_data, TriangularElement(order))
 
        vis = VtkVisualizer(discr, pcon, "em-%d" % order)

src/p/y/pylon-HEAD/examples/national_grid/svg2kml.py   pylon(Download)
__author__ = 'Richard Lincoln, r.w.lincoln@gmail.com'
 
from math import pi, atan, exp
import xml.etree.ElementTree as ET
from pathdata import svg
 
SVG_NS = "http://www.w3.org/2000/svg"
def metres2latlon(mx, my, origin_shift= 2 * pi * 6378137 / 2.0):
    """Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in
    WGS84 Datum"""
    lon = (mx / origin_shift) * 180.0
    lat = (my / origin_shift) * 180.0
 
    lat = 180 / pi * (2 * atan( exp( lat * pi / 180.0)) - pi / 2.0)

src/h/e/hedge-0.91/examples/maxwell/maxwell-dipole.py   hedge(Download)
        def __call__(self, x, el):
            from math import exp
            j0 = -1/op.epsilon*self.Q*self.d*self.omega
            spacedep = exp(-la.norm(x)**2*10)
 
            return numpy.array([0,0,j0*spacedep])
 

src/s/h/shedskin-HEAD/examples/tictactoe.py   shedskin(Download)
# (c) Peter Goodspeed
# --- coriolinus@gmail.com
 
from math import exp
 
#functions
def sigmoid(x):
        return float(1)/(1 + exp(-x))

src/p/h/Phycas-HEAD/phycas/Examples/Paradox/Paradox.py   Phycas(Download)
# This example program performs a "polytomy" analysis similar to that used in
# the paper Lewis, P. O., M. T. Holder, and K. E. Holsinger. 2005.
# Polytomies and Bayesian phylogenetic inference. Systematic Biology 54:241-253.
 
from phycas import *
from math import exp
 
# nodes) needs to be more than one log-likelihood unit better than a
# tree with just k internal nodes in order to overcome this prior.
mcmc.polytomy_prior   = True
mcmc.topo_prior_C     = exp(1.0)
 
# Read the data from a file (here we specified the location relative to this file)
# Note that you should use forward slashes ('/') even if running in Windows.

src/s/h/shedskin-HEAD/examples/adatron.py   shedskin(Download)
#!/usr/bin/env python
 
# Adatron SVM with polynomial kernel
# placed in the public domain by Stavros Korokithakis
 
import sys
from math import exp
            difference = 0.0
            for counter in range(len(row)):
                difference += (row[counter] - candidate[counter]) ** 2
            kernel_row.append(exp(-D*difference))
        kernel_table.append(kernel_row)
    return kernel_table
 

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