All Samples(656) | Call(535) | Derive(0) | Import(121)
tan(x) Return the tangent of x (measured in radians).
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/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/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/n/u/numeric-for-engineer-HEAD/example4_3.py numeric-for-engineer(Download)
#!/usr/bin/python ## example4_3 from math import tan from rootsearch import * from bisect import * def f(x): return x - tan(x)
src/s/h/shedskin-HEAD/examples/ml/camera.py shedskin(Download)
# MiniLight Python : minimal global illumination renderer # # Copyright (c) 2007-2008, Harrison Ainsworth / HXA7241 and Juraj Sukop. # http://www.hxa7241.org/ from math import pi, tan
src/p/y/pyx-HEAD/trunk/pyx/pyx/path.py pyx(Download)
from __future__ import nested_scopes
import math
from math import cos, sin, tan, acos, pi
try:
from math import radians, degrees
except ImportError:
try:
# two tangent points
xt1_pt = self.x1_pt - dx1*self.r_pt*tan(abs(alpha)/2)
yt1_pt = self.y1_pt - dy1*self.r_pt*tan(abs(alpha)/2)
xt2_pt = self.x1_pt + dx2*self.r_pt*tan(abs(alpha)/2)
yt2_pt = self.y1_pt + dy2*self.r_pt*tan(abs(alpha)/2)
src/p/y/pyx-HEAD/pyx/pyx/path.py pyx(Download)
from __future__ import nested_scopes
import math
from math import cos, sin, tan, acos, pi
try:
from math import radians, degrees
except ImportError:
try:
# two tangent points
xt1_pt = self.x1_pt - dx1*self.r_pt*tan(abs(alpha)/2)
yt1_pt = self.y1_pt - dy1*self.r_pt*tan(abs(alpha)/2)
xt2_pt = self.x1_pt + dx2*self.r_pt*tan(abs(alpha)/2)
yt2_pt = self.y1_pt + dy2*self.r_pt*tan(abs(alpha)/2)
src/w/e/weewx-HEAD/trunk/experimental/astral.py weewx(Download)
import datetime import time from math import cos, sin, tan, acos, asin, atan2, floor, radians, degrees __version__ = "0.3+" __author__ = "Simon Kennedy <python@sffjunkie.co.uk>"
if exoatmElevation > 85.0:
refractionCorrection = 0.0
else:
te = tan(radians(exoatmElevation))
if exoatmElevation > 5.0:
refractionCorrection = 58.1 / te - 0.07 / (te * te * te) + 0.000086 / (te * te * te * te * te)
elif exoatmElevation > -0.575:
def _eq_of_time(juliancentury):
epsilon = _obliquity_correction(juliancentury)
l0 = _geom_mean_long_sun(juliancentury)
e = _eccentricity_earth_orbit(juliancentury)
m = _geom_mean_anomaly_sun(juliancentury)
y = tan(radians(epsilon) / 2.0)
def _hour_angle(latitude, solar_dec, solar_depression):
latRad = radians(latitude)
sdRad = radians(solar_dec)
HA = (acos(cos(radians(90 + solar_depression)) / (cos(latRad) * cos(sdRad)) - tan(latRad) * tan(sdRad)))
return HA
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
#======================================================
#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))
if AtmElevation > 85:
RefractionCorrection = 0
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:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next