Skip to content

Commit 3e8a86c

Browse files
committed
added tan, needed for rotational velocity transforms
1 parent 58a9fb6 commit 3e8a86c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spatialmath/base/symbolic.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,28 @@ def cos(theta):
134134
else:
135135
return math.cos(theta)
136136

137+
def tan(theta):
138+
"""
139+
Generalized tangent function
140+
141+
:param θ: argument
142+
:type θ: float or symbolic
143+
:return: tan(θ)
144+
:rtype: float or symbolic
145+
146+
.. runblock:: pycon
147+
148+
>>> from spatialmath.base.symbolic import *
149+
>>> theta = symbol('theta')
150+
>>> tan(theta)
151+
>>> tan(0.5)
152+
153+
:seealso: :func:`sympy.cos`
154+
"""
155+
if issymbol(theta):
156+
return sympy.tan(theta)
157+
else:
158+
return math.tan(theta)
137159

138160
def sqrt(v):
139161
"""

0 commit comments

Comments
 (0)