Skip to content

Tan ​

The tangent of x, in radians.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaTrigonometric functionsMathWorldTangentTrigonometricFunctionsWikidataQ93344nLabtrigonometric functionBritannicatopic/trigonometric-functionDLMF4.14.E4FungrimTan✓Fungrim entry1f026d✓1f026d:solvec7f7a5ee56b9✓f516e3f516e3:solveWolfram LanguageTan!
Tan(x)the tangent of x, in radians.
SageMathtan(x)✓SymPytan(x)mpmathtan(x)Juliaenumeratio_ball(tan, x)Rusttan(x)
Typed signatures
TypePackageApplies
(complex | quantity) -> numberanalyticreplaces compute-enginealways
(complex | quantity) -> numbercompute-enginealways

Domain: Elementary functions

Details
  • tan⁡(x)=sin⁡(x)cos⁡(x)\tan(x) = \frac{\sin(x)}{\cos(x)}.
  • Odd function: tan⁡(−x)=−tan⁡(x)\tan(-x) = -\tan(x).
  • Period π\pi -- half the period of Sin and Cos.
  • Undefined wherever cos⁡(x)=0\cos(x) = 0, i.e. at odd multiples of π/2\pi/2; compute-engine returns ComplexInfinity there rather than an error.

Examples

8 more kept as data, checked against the oracles
Basic #
live ↗
Intan⁡(0)\tan(0)Out00
live ↗
Intan⁡(π6)\tan(\frac{π}{6})Out33\frac{\sqrt{3}}{3}
live ↗
Intan⁡(π4)\tan(\frac{π}{4})Out11
live ↗
Intan⁡(π3)\tan(\frac{π}{3})Out3\sqrt{3}

tan⁡30∘=33\tan 30^\circ = \frac{\sqrt3}{3}, exactly

live ↗
Intan⁡(30∘)\tan(30^{∘})Out33\frac{\sqrt{3}}{3}

A machine-precision argument evaluates numerically

live ↗
Intan⁡(1.2)\tan(1.2)Out2.572 151 622 126 318 935 412.572\,151\,622\,126\,318\,935\,41
live ↗
InSeries⁡(tan⁡(x),x,0,10)\operatorname{Series}(\tan(x), x, 0, 10)Outx+x33+2x515+17x7315+62x92 835+O(x11)x+\frac{x^3}{3}+\frac{2x^5}{15}+\frac{17x^7}{315}+\frac{62x^9}{2\,835}+O\left(x^{11}\right)
live ↗
InSeries⁡(tan⁡(x),x,π2,5)\operatorname{Series}(\tan(x), x, \frac{π}{2}, 5)Out−1x−π2+13(x−π2)+145(x−π2)3+1945×2(x−π2)5+O((x−π2)7)-\frac{1}{x-\frac{π}{2}}+\frac{1}{3}(x-\frac{π}{2})+\frac{1}{45}(x-\frac{π}{2})^3+\frac{1}{945}×2(x-\frac{π}{2})^5+O\left((x-\frac{π}{2})^7\right)
Scope #

N(...) of an exact argument gives an arbitrary-precision value

live ↗
InN(tan⁡(65))N(\tan(\frac{6}{5}))Out2.572 151 622 126 318 935 412.572\,151\,622\,126\,318\,935\,41

Evaluates at a complex argument

live ↗
Intan⁡(2.5+i)\tan(2.5+i)Out−0.237 013 830 916 270 57+0.896 437 917 127 861 7i-0.237\,013\,830\,916\,270\,57+0.896\,437\,917\,127\,861\,7i

Threads element-wise over a matrix

live ↗
Intan⁡([[5π6,π],[π3,−π]])\tan(\bigl\lbrack\bigl\lbrack\frac{5π}{6}, π\bigr\rbrack, \bigl\lbrack\frac{π}{3}, -π\bigr\rbrack\bigr\rbrack)Out[[−31/23,0],[3,0]]\bigl\lbrack\bigl\lbrack-\frac{3^{1/2}}{3}, 0\bigr\rbrack, \bigl\lbrack\sqrt{3}, 0\bigr\rbrack\bigr\rbrack

tan⁡(π/8)=2−1\tan(\pi/8) = \sqrt2 - 1

live ↗
Intan⁡(π8)\tan(\frac{π}{8})Out2−1\sqrt{2}-1

tan⁡(π/12)=2−3\tan(\pi/12) = 2 - \sqrt3

live ↗
Intan⁡(π12)\tan(\frac{π}{12})Out2−32-\sqrt{3}

tan⁡(π/5)=5−25\tan(\pi/5) = \sqrt{5 - 2\sqrt5}

live ↗
Intan⁡(π5)\tan(\frac{π}{5})Out5−25\sqrt{5-2\sqrt{5}}

tan⁡(π/10)=1−2/5\tan(\pi/10) = \sqrt{1 - 2/\sqrt5}

live ↗
Intan⁡(π10)\tan(\frac{π}{10})Out1555−25\frac{1}{5}\sqrt{5}\sqrt{5-2\sqrt{5}}

tan⁡(5π/12)=2+3\tan(5\pi/12) = 2 + \sqrt3

live ↗
Intan⁡(5π12)\tan(\frac{5π}{12})Out2+32+\sqrt{3}
live ↗
Intan⁡(3π4)\tan(\frac{3π}{4})Out−1-1

Interval arithmetic: the image of [0,π/3][0, \pi/3] is [0,3][0, \sqrt3]

live ↗
Intan⁡(Interval(0,π3))\tan(\mathrm{Interval}(0, \frac{π}{3}))OutInterval(0,3)\mathrm{Interval}(0, \sqrt{3})

Uncertainty propagation: tan⁡(2±0.02)≈−2.185±0.115\tan(2 \pm 0.02) \approx -2.185 \pm 0.115

live ↗
Intan⁡(Around(2,0.02))\tan(\mathrm{Around}(2, 0.02))OutAround(−2.185 039 863 261 519,0.115 487 984 080 838 35)\mathrm{Around}(-2.185\,039\,863\,261\,519, 0.115\,487\,984\,080\,838\,35)

tan⁡(ix)=itanh⁡x\tan(ix) = i\tanh x

live ↗
Intan⁡(ix)\tan(i x)Outitanh⁡(x)i\tanh(x)

Oddness pulls the sign out of a symbolic argument: tan⁡(−x)=−tan⁡x\tan(-x) = -\tan x

live ↗
Intan⁡(−x)\tan(-x)Out−tan⁡(x)-\tan(x)

tan⁡(arctan⁡x)=x\tan(\arctan x) = x for every xx

live ↗
Intan⁡(arctan⁡(x))\tan(\arctan(x))Outxx

tan⁡(arctan⁡(2))=2\tan(\arctan(2)) = 2

live ↗
Intan⁡(arctan⁡(2))\tan(\arctan(2))Out22

tan⁡(arcsin⁡x)=x1−x2\tan(\arcsin x) = \frac{x}{\sqrt{1 - x^2}}

live ↗
Intan⁡(arcsin⁡(x))\tan(\arcsin(x))Outx1−x2\frac{x}{\sqrt{1-x^2}}

Derivative: sec⁡2x\sec^2 x

live ↗
Indtan⁡(x)dx\frac{\mathrm{d}\tan(x)}{\mathrm{d}x}Outsec⁡(x)2\sec(x)^2

Antiderivative: ln⁡∣sec⁡x∣\ln|\sec x|

live ↗
In∫ ⁣tan⁡(x) dx\int\!\tan(x)\, \mathrm{d}xOutln⁡(∣sec⁡(x)∣)\ln(\vert\sec(x)\vert)

Taylor series about 0

live ↗
InSeries⁡(tan⁡(x),x,0,7)\operatorname{Series}(\tan(x), x, 0, 7)Outx+x33+2x515+17x7315+O(x9)x+\frac{x^3}{3}+\frac{2x^5}{15}+\frac{17x^7}{315}+O\left(x^9\right)

To 30 significant digits, every one correctly rounded

live ↗
InN(tan⁡(1),30)N(\tan(1), 30)Out1.557 407 724 654 902 230 506 974 807 461.557\,407\,724\,654\,902\,230\,506\,974\,807\,46

A 50-digit value of tan⁡65\tan\frac65

live ↗
InN(tan⁡(65),50)N(\tan(\frac{6}{5}), 50)Out2.572 151 622 126 318 935 409 994 236 033 363 956 529 409 306 043 42.572\,151\,622\,126\,318\,935\,409\,994\,236\,033\,363\,956\,529\,409\,306\,043\,4

Tangent takes every real value

live ↗
InFunctionRange(tan⁡(x),x,y)\mathrm{FunctionRange}(\tan(x), x, y)OutTrue\mathrm{True}

The period is π\pi, not 2π2\pi

live ↗
InFunctionPeriod(tan⁡(x),x)\mathrm{FunctionPeriod}(\tan(x), x)Outππ

Not analytic because of its poles

live ↗
InFunctionAnalytic(tan⁡(x),x)\mathrm{FunctionAnalytic}(\tan(x), x)OutFalse\mathrm{False}

Meromorphic: analytic except for poles

live ↗
InFunctionMeromorphic(tan⁡(x),x)\mathrm{FunctionMeromorphic}(\tan(x), x)OutTrue\mathrm{True}

Onto the reals

live ↗
InFunctionSurjective(tan⁡(x),x)\mathrm{FunctionSurjective}(\tan(x), x)OutTrue\mathrm{True}

Singular where cos⁡x=0\cos x=0

live ↗
InFunctionSingularities(tan⁡(x),x)\mathrm{FunctionSingularities}(\tan(x), x)Outcos⁡(x)=0\cos(x)=0

Discontinuous exactly at the poles

live ↗
InFunctionDiscontinuities(tan⁡(x),x)\mathrm{FunctionDiscontinuities}(\tan(x), x)Outcos⁡(x)=0\cos(x)=0

A triangular matrix function with exact entries

live ↗
InMatrixFunction(_1⁡↦tan⁡(_1⁡),[[5π6,π],[π3,−π]])\mathrm{MatrixFunction}(\operatorname{\_1}↦\tan(\operatorname{\_1}), \bigl\lbrack\bigl\lbrack\frac{5π}{6}, π\bigr\rbrack, \bigl\lbrack\frac{π}{3}, -π\bigr\rbrack\bigr\rbrack)Out[[−31/239,2313],[2339,−4313]]\bigl\lbrack\bigl\lbrack-\frac{3^{1/2}}{39}, \frac{2\sqrt{3}}{13}\bigr\rbrack, \bigl\lbrack\frac{2\sqrt{3}}{39}, -\frac{4\sqrt{3}}{13}\bigr\rbrack\bigr\rbrack

tan⁡(∞)\tan(\infty) is a type error at boxing; Wolfram gives the oscillation range, all of (−∞,∞)(-\infty, \infty)

live ↗
live ↗
InAssuming(m∈Z,Refine(tan⁡(πm)))\mathrm{Assuming}(m∈ℤ, \mathrm{Refine}(\tan(πm)))Outtan⁡(πm)\tan(πm)
live ↗
InAssuming(m∈Z,FullSimplify(Refine(tan⁡(π(1/2+m)))))\mathrm{Assuming}(m∈ℤ, \mathrm{FullSimplify}(\mathrm{Refine}(\tan(π(1/2+m)))))Outtan⁡(π(m+12))\tan(π(m+\frac{1}{2}))
Applications #

Threads element-wise over a list

live ↗
Intan⁡([0,π4])\tan(\bigl\lbrack0, \frac{π}{4}\bigr\rbrack)Out[0,1]\bigl\lbrack0, 1\bigr\rbrack
Properties #

tan⁡(x)=sin⁡(x)cos⁡(x)\tan(x) = \frac{\sin(x)}{\cos(x)}

live ↗
Intan⁡(π4)=sin⁡(π4)cos⁡(π4)\tan(\frac{π}{4})=\frac{\sin(\frac{π}{4})}{\cos(\frac{π}{4})}OutTrue\mathrm{True}

Odd function: tan⁡(−x)=−tan⁡(x)\tan(-x) = -\tan(x)

live ↗
Intan⁡(−π4)\tan(-\frac{π}{4})Out−1-1

Period π\pi, not 2π2\pi: adding a half turn doesn't change the value

live ↗
Intan⁡(π4+π)\tan(\frac{π}{4}+π)Out11

sin⁡x/cos⁡x\sin x / \cos x simplifies to tan⁡x\tan x

live ↗
InSimplify(sin⁡(x)cos⁡(x))\mathrm{Simplify}(\frac{\sin(x)}{\cos(x)})Outtan⁡(x)\tan(x)

Rewritten in exponentials

live ↗
InTrigToExp(tan⁡(x))\mathrm{TrigToExp}(\tan(x))Out−i(eix−e−ix)eix+e−ix\frac{-i(e^{i x}-e^{-i x})}{e^{i x}+e^{-i x}}

tan⁡(3π/10)\tan(3\pi/10) in nested radicals

live ↗
Intan⁡(3π10)\tan(\frac{3π}{10})Out1555+25\frac{1}{5}\sqrt{5}\sqrt{5+2\sqrt{5}}

Known value · Wolfram MathematicalFunctionData, Tan

tan⁡(3π/8)=1+2\tan(3\pi/8) = 1+\sqrt2

live ↗
Intan⁡(3π8)\tan(\frac{3π}{8})Out1+21+\sqrt{2}

Known value · Wolfram MathematicalFunctionData, Tan

live ↗
InN((1−tan⁡(1/2)2)tan⁡(1))N((1-\tan(1/2)^2)\tan(1))Out1.092 604 979 687 581 026 512 117 609 759 424 481 869 161.092\,604\,979\,687\,581\,026\,512\,117\,609\,759\,424\,481\,869\,16

Known value · Wolfram MathematicalFunctionData, Tan, FunctionalEquations

live ↗
InN(tan⁡(12+π2))N(\tan(\frac{1}{2}+\frac{π}{2}))Out−1.830 487 721 712 451 919 27-1.830\,487\,721\,712\,451\,919\,27

Known value · Wolfram MathematicalFunctionData, Tan, FunctionalEquations

live ↗
InN((1−tan⁡(2)2)tan⁡(4))N((1-\tan(2)^2)\tan(4))Out−4.370 079 726 523 037 983 281 860 374 993 791 294 936-4.370\,079\,726\,523\,037\,983\,281\,860\,374\,993\,791\,294\,936

Known value · Wolfram MathematicalFunctionData, Tan, FunctionalEquations

live ↗
InN(tan⁡(2+π2))N(\tan(2+\frac{π}{2}))Out0.457 657 554 360 285 763 750.457\,657\,554\,360\,285\,763\,75

Known value · Wolfram MathematicalFunctionData, Tan, FunctionalEquations

Possible issues #

A pole: cos⁡(π/2)=0\cos(\pi/2) = 0, so the ratio blows up

live ↗
Intan⁡(π2)\tan(\frac{π}{2})Out∞~\tilde∞

Same rule as Sin and Cos: a non-special numeric argument stays symbolic

live ↗
Intan⁡(1)\tan(1)Outtan⁡(1)\tan(1)

Tan(ComplexInfinity) is Indeterminate -- poles recur every period π\pi, arbitrarily close to any large argument

live ↗

Known value · DLMF 4.14.10

About
Examples63
Checked againstWolfram Language 54 agree8 differ1 unevaluatedSageMath 47 agree1 unevaluated2 errorSymPy 48 agree2 differ1 unevaluatedmpmath 28 agree2 differ3 unevaluatedJulia 34 agree4 errorRust 27 agree6 differ3 unevaluated
CrosswalkWikipediaMathWorld ×2WikidatanLabBritannicaDLMFFungrimFungrim entry ×6Wolfram LanguageSageMathSymPympmathJuliaRust

Implementation

mappedwolframpackages/oracle/src/mappings.ts
mappedsympypackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts

See also: Sin, Cos, Cot, Arctan