All Samples(656) | Call(535) | Derive(0) | Import(121)
tan(x) Return the tangent of x (measured in radians).
src/p/y/pycppad-HEAD/example/std_math.py pycppad(Download)
assert abs( sin(a_x) - math.sin(x) ) < delta assert abs( sinh(a_x) - math.sinh(x) ) < delta assert abs( sqrt(a_x) - math.sqrt(x) ) < delta assert abs( tan(a_x) - math.tan(x) ) < delta assert abs( tanh(a_x) - math.tanh(x) ) < delta # example array and derivative calculation
assert abs( sin(a2x) - math.sin(x) ) < delta assert abs( sinh(a2x) - math.sinh(x) ) < delta assert abs( sqrt(a2x) - math.sqrt(x) ) < delta assert abs( tan(a2x) - math.tan(x) ) < delta assert abs( tanh(a2x) - math.tanh(x) ) < delta # example array and derivative calculation
src/n/u/numeric-for-engineer-HEAD/example10_6.py numeric-for-engineer(Download)
## example10_6
from fletcherReeves import *
from numarray import array,zeros,Float64
from math import cos,tan,pi
def F(x):
return 8.0/x[0] - x[0]*(tan(x[1]) - 2.0/cos(x[1]))
def gradF(x):
g = zeros((2),type=Float64)
g[0] = -8.0/(x[0]**2) - tan(x[1]) + 2.0/cos(x[1])
g[1] = x[0]*(-1.0/cos(x[1]) + 2.0*tan(x[1]))/cos(x[1])
x = array([2.0, 0.0]) x,nIter = optimize(F,gradF,x) b = 8.0/x[0] - x[0]*tan(x[1]) print "h =",x[0],"m" print "b =",b,"m" print "theta =",x[1]*180.0/pi,"deg"
src/p/y/python-ply-HEAD/example/BASIC/basinterp.py python-ply(Download)
def __init__(self,prog):
self.prog = prog
self.functions = { # Built-in function table
'SIN' : lambda z: math.sin(self.eval(z)),
'COS' : lambda z: math.cos(self.eval(z)),
'TAN' : lambda z: math.tan(self.eval(z)),
src/c/b/cbflib-HEAD/trunk/CBFlib_bleeding_edge/ply-3.2/example/BASIC/basinterp.py cbflib(Download)
def __init__(self,prog):
self.prog = prog
self.functions = { # Built-in function table
'SIN' : lambda z: math.sin(self.eval(z)),
'COS' : lambda z: math.cos(self.eval(z)),
'TAN' : lambda z: math.tan(self.eval(z)),
src/c/b/cbflib-HEAD/CBFlib_bleeding_edge/ply-3.2/example/BASIC/basinterp.py cbflib(Download)
def __init__(self,prog):
self.prog = prog
self.functions = { # Built-in function table
'SIN' : lambda z: math.sin(self.eval(z)),
'COS' : lambda z: math.cos(self.eval(z)),
'TAN' : lambda z: math.tan(self.eval(z)),
src/p/y/pydy-HEAD/examples/bicycle/bicycle_lib_hand.py pydy(Download)
from sympy import var
from math import sin, cos, tan, pi
def dependent_qdot(_x, _params):
"""Linear mapping from lean rate, steer rate, front wheel rate to yaw rate, rear
wheel rate, pitch rate, rear wheel contact point velocity in N[1] and N[2]
directions.
s0 = sin(q0)
s3 = sin(q3)
s4 = sin(q4)
t1 = tan(q1)
# Calculate return values
q0d = c3*u2/c1 - s3*u0/c1
s1 = sin(q1)
s3 = sin(q3)
s4 = sin(q4)
t1 = tan(q1)
# Nested terms
e1c_s = rf*(s1*s4 - c1*c4*s3)/(1 - (c4*s1 + c1*s3*s4)**2)**(1/2)
src/p/y/pydy-HEAD/examples/bicycle/bicycle_lib.py pydy(Download)
from __future__ import division
from math import sin, cos, tan, pi
def dependent_qdot(_x, _params):
"""Linear mapping from lean rate, steer rate, front wheel rate to yaw rate, rear
wheel rate, pitch rate, rear wheel contact point velocity in N[1] and N[2]
directions.
s0 = sin(q0)
s3 = sin(q3)
s4 = sin(q4)
t1 = tan(q1)
# Calculate return values
q0d = c3*u2/c1 - s3*u0/c1
s1 = sin(q1)
s3 = sin(q3)
s4 = sin(q4)
t1 = tan(q1)
# Nested terms
e1c_s = rf*(s1*s4 - c1*c4*s3)/(1 - (c4*s1 + c1*s3*s4)**2)**(1/2)
src/p/y/pylon-HEAD/examples/national_grid/tikz.py pylon(Download)
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/p/y/pydy-HEAD/examples/rigidbody/rigidbody_lib.py pydy(Download)
from __future__ import division
from math import sin, cos, tan
def eoms(_x, t, _params):
"""Rigidy body equations of motion.
_x is an array/list in the following order:
c2 = cos(q2)
c3 = cos(q3)
s3 = sin(q3)
t2 = tan(q2)
# Calculate return values
q1d = c3*u3/c2 - s3*u1/c2
src/b/a/baum-HEAD/examples/guitest/guitest.py baum(Download)
curve5 = []
for val in curve1:
curve3.append( math.cos(val) );
curve4.append( math.tan(val) );
curve5.append( math.fabs(val) );
node.AddChild(Baum.Table("5 Column Table", [curve1,curve2, curve3,curve4,curve5], ["Curve 1", "Curve 2","Curve 3", "Curve 4","Curve 5",] ))
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next