• 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/p/y/pycppad-HEAD/example/std_math.py   pycppad(Download)
  assert abs( arctan(a_x) - math.atan(x) )  < delta
  assert abs( cos(a_x)    - math.cos(x) )   < delta
  assert abs( cosh(a_x)   - math.cosh(x) )  < delta
  assert abs( exp(a_x)    - math.exp(x) )   < delta
  assert abs( log(a_x)    - math.log(x) )   < delta
  assert abs( log10(a_x)  - math.log10(x) ) < delta
  assert abs( sin(a_x)    - math.sin(x) )   < delta
  assert abs( arctan(a2x) - math.atan(x) )  < delta
  assert abs( cos(a2x)    - math.cos(x) )   < delta
  assert abs( cosh(a2x)   - math.cosh(x) )  < delta
  assert abs( exp(a2x)    - math.exp(x) )   < delta
  assert abs( log(a2x)    - math.log(x) )   < delta
  assert abs( log10(a2x)  - math.log10(x) ) < delta
  assert abs( sin(a2x)    - math.sin(x) )   < delta

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/p/y/python-ply-HEAD/example/BASIC/basinterp.py   python-ply(Download)
             'COS' : lambda z: math.cos(self.eval(z)),
             'TAN' : lambda z: math.tan(self.eval(z)),
             'ATN' : lambda z: math.atan(self.eval(z)),
             'EXP' : lambda z: math.exp(self.eval(z)),
             'ABS' : lambda z: abs(self.eval(z)),
             'LOG' : lambda z: math.log(self.eval(z)),
             'SQR' : lambda z: math.sqrt(self.eval(z)),

src/c/b/cbflib-HEAD/trunk/CBFlib_bleeding_edge/ply-3.2/example/BASIC/basinterp.py   cbflib(Download)
             'COS' : lambda z: math.cos(self.eval(z)),
             'TAN' : lambda z: math.tan(self.eval(z)),
             'ATN' : lambda z: math.atan(self.eval(z)),
             'EXP' : lambda z: math.exp(self.eval(z)),
             'ABS' : lambda z: abs(self.eval(z)),
             'LOG' : lambda z: math.log(self.eval(z)),
             'SQR' : lambda z: math.sqrt(self.eval(z)),

src/c/b/cbflib-HEAD/CBFlib_bleeding_edge/ply-3.2/example/BASIC/basinterp.py   cbflib(Download)
             'COS' : lambda z: math.cos(self.eval(z)),
             'TAN' : lambda z: math.tan(self.eval(z)),
             'ATN' : lambda z: math.atan(self.eval(z)),
             'EXP' : lambda z: math.exp(self.eval(z)),
             'ABS' : lambda z: abs(self.eval(z)),
             'LOG' : lambda z: math.log(self.eval(z)),
             'SQR' : lambda z: math.sqrt(self.eval(z)),

src/p/y/pyevolve-HEAD/trunk/examples/pyevolve_ex14_ackley.py   pyevolve(Download)
def ackley(xlist):
   sum1 = 0
   score = 0
   n = len(xlist)
   for i in xrange(n):
      sum1 += xlist[i]*xlist[i]
   t1 = math.exp(-0.2*(math.sqrt((1.0/5.0)*sum1)))
 
   sum1 = 0
   for i in xrange(n):
      sum1 += math.cos(2.0*math.pi*xlist[i]);
   t2 = math.exp((1.0/5.0)*sum1);
   score = 20 + math.exp(1) - 20 * t1 - t2;

src/p/y/pyevolve-HEAD/examples/pyevolve_ex14_ackley.py   pyevolve(Download)
def ackley(xlist):
   sum1 = 0
   score = 0
   n = len(xlist)
   for i in xrange(n):
      sum1 += xlist[i]*xlist[i]
   t1 = math.exp(-0.2*(math.sqrt((1.0/5.0)*sum1)))
 
   sum1 = 0
   for i in xrange(n):
      sum1 += math.cos(2.0*math.pi*xlist[i]);
   t2 = math.exp((1.0/5.0)*sum1);
   score = 20 + math.exp(1) - 20 * t1 - t2;

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/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvskryx_bp.py   pysundials(Download)
def f(t, u, udot, f_data):
	data = ctypes.cast(f_data, PUserData).contents
 
	s = math.sin(data.om*t)
	if s > 0:
		q3 = math.exp(-A3/s)
		data.q4 = math.exp(-A4/s)
	for jy in range(MY):
		ydn = YMIN + (jy - 0.5)*dely
		yup = ydn + dely
		cydn = verdco*math.exp(0.2*ydn)
		cyup = verdco*math.exp(0.2*yup)
		if jy == 0:
			idn = 1

src/p/y/pysundials-HEAD/2.3.0/examples/cvode/serial/cvkryx_bp.py   pysundials(Download)
def f(t, u, udot, f_data):
	data = ctypes.cast(f_data, PUserData).contents
 
	s = math.sin(data.om*t)
	if s > 0:
		q3 = math.exp(-A3/s)
		data.q4 = math.exp(-A4/s)
	for jy in range(MY):
		ydn = YMIN + (jy - 0.5)*dely
		yup = ydn + dely
		cydn = verdco*math.exp(0.2*ydn)
		cyup = verdco*math.exp(0.2*yup)
		if jy == 0:
			idn = 1

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