Skip to content

Tanh ​

Hyperbolic tangent: tanh⁡(x)=sinh⁡(x)cosh⁡(x)\tanh(x) = \frac{\sinh(x)}{\cosh(x)}.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaHyperbolic functionsMathWorldHyperbolicTangentHyperbolicFunctionsWikidataQ204034Britannicatopic/hyperbolic-functionsDLMF4.28.E4FungrimTanh✓Fungrim entry6f3fec✓Wolfram LanguageTanh✓
Tanh(x)the hyperbolic tangent of x.
SageMathtanh(x)SymPytanh(x)mpmathtanh(x)Juliaenumeratio_ball(tanh, x)Rusttanh(x)
Typed signatures
TypePackageApplies
(complex | quantity | signed_infinity) -> numbercompute-enginealways
(complex | complex | infinity | quantity | signed_infinity) -> numberanalyticreplaces compute-enginealways

Domain: Elementary functions

Details
  • tanh⁡(x)=sinh⁡(x)cosh⁡(x)\tanh(x) = \frac{\sinh(x)}{\cosh(x)}, ranging over (−1,1)(-1, 1).
  • Odd function: tanh⁡(−x)=−tanh⁡(x)\tanh(-x) = -\tanh(x).
  • Same fold-only-with-N(...) behavior as Sinh and Cosh.

Examples

2 more kept as data, checked against the oracles
Basic #

N(...) forces the numeric result that plain evaluation withholds

live ↗
InN(tanh⁡(0))N(\tanh(0))Out0.00.0
live ↗
InN(tanh⁡(1))N(\tanh(1))Out0.761 594 155 955 764 888 1190.761\,594\,155\,955\,764\,888\,119

Exact at 0, as Sinh and Cosh are

live ↗
Intanh⁡(0)\tanh(0)Out00

A float argument evaluates directly, no N(...) needed

live ↗
Intanh⁡(2.2)\tanh(2.2)Out0.975 743 130 031 451 520 4140.975\,743\,130\,031\,451\,520\,414
live ↗
InSeries⁡(tanh⁡(x),x,0,10)\operatorname{Series}(\tanh(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⁡(tanh⁡(x),x,12iπ,3)\operatorname{Series}(\tanh(x), x, \frac{1}{2}i π, 3)Out1x+(−12i)π+13(x+(−12i)π)−145(x+(−12i)π)3+O((x+(−12i)π)5)\frac{1}{x+(-\frac{1}{2}i)π}+\frac{1}{3}(x+(-\frac{1}{2}i)π)-\frac{1}{45}(x+(-\frac{1}{2}i)π)^3+O\left((x+(-\frac{1}{2}i)π)^5\right)
Scope #

Arbitrary precision via N(...)

live ↗
InN(tanh⁡(115))N(\tanh(\frac{11}{5}))Out0.975 743 130 031 451 520 4140.975\,743\,130\,031\,451\,520\,414

Evaluates at a complex argument

live ↗
Intanh⁡(2.5+i)\tanh(2.5+i)Out1.005 548 011 895 06+0.012 322 138 255 828 353i1.005\,548\,011\,895\,06+0.012\,322\,138\,255\,828\,353i

Interval arithmetic: tanh⁡\tanh is increasing, so tanh⁡[0,ln⁡2]=[0,35]\tanh[0, \ln 2] = [0, \tfrac35]

live ↗
Intanh⁡(Interval(0,ln⁡(2)))\tanh(\mathrm{Interval}(0, \ln(2)))OutInterval(0,35)\mathrm{Interval}(0, \frac{3}{5})

Uncertainty propagation: tanh⁡(2/3±0.1)≈0.819±0.033\tanh(2/\sqrt3 \pm 0.1) \approx 0.819 \pm 0.033

live ↗
Intanh⁡(Around(23,0.1))\tanh(\mathrm{Around}(\frac{2}{\sqrt{3}}, 0.1))OutAround(0.819 305 290 078 300 8,0.032 873 884 164 971 15)\mathrm{Around}(0.819\,305\,290\,078\,300\,8, 0.032\,873\,884\,164\,971\,15)

The horizontal asymptote at +∞+\infty

live ↗
Intanh⁡(∞)\tanh(∞)Out11

tanh⁡(iπ/4)=itan⁡(π/4)=i\tanh(i\pi/4) = i\tan(\pi/4) = i

live ↗
Intanh⁡(iπ4)\tanh(\frac{i π}{4})Outii

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

live ↗
Intanh⁡(−x)\tanh(-x)Out−tanh⁡(x)-\tanh(x)

tanh⁡(artanh⁡x)=x\tanh(\operatorname{artanh} x) = x for every xx

live ↗
Intanh⁡(artanh(x))\tanh(\mathrm{artanh}(x))Outxx

tanh⁡(artanh⁡(2))=2\tanh(\operatorname{artanh}(2)) = 2, even past (−1,1)(-1, 1)

live ↗
Intanh⁡(artanh(2))\tanh(\mathrm{artanh}(2))Out22

Derivative: sech⁡2x\operatorname{sech}^2 x

live ↗
Indtanh⁡(x)dx\frac{\mathrm{d}\tanh(x)}{\mathrm{d}x}Outsech(x)2\mathrm{sech}(x)^2

Antiderivative: ln⁡cosh⁡x\ln\cosh x

live ↗
In∫ ⁣tanh⁡(x) dx\int\!\tanh(x)\, \mathrm{d}xOutln⁡(cosh⁡(x))\ln(\cosh(x))

tanh⁡\tanh has no limit at complex infinity, undefined from any direction: NaN

live ↗
Intanh⁡(∞~)\tanh(\tilde∞)OutNaN⁡\operatorname{NaN}

To 30 significant digits, every one correctly rounded

live ↗
InN(tanh⁡(1),30)N(\tanh(1), 30)Out0.761 594 155 955 764 888 119 458 282 6050.761\,594\,155\,955\,764\,888\,119\,458\,282\,605

A 50-digit value of tanh⁡115\tanh\frac{11}5

live ↗
InN(tanh⁡(115),50)N(\tanh(\frac{11}{5}), 50)Out0.975 743 130 031 451 520 414 306 668 030 114 652 781 305 034 057 990.975\,743\,130\,031\,451\,520\,414\,306\,668\,030\,114\,652\,781\,305\,034\,057\,99

Threads over a matrix of imaginary angles, giving itan⁡θi\tan\theta

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

On the imaginary axis, tanh⁡(iθ)=itan⁡θ\tanh(i\theta)=i\tan\theta, a radical for π/5\pi/5

live ↗
Intanh⁡(15iπ)\tanh(\frac{1}{5}i π)Outi5−25i\sqrt{5-2\sqrt{5}}

Left as a tangent when no radical form is known

live ↗
Intanh⁡(124iπ)\tanh(\frac{1}{24}i π)Outitan⁡(π24)i\tan(\frac{π}{24})

A matrix function of a triangular matrix of imaginary angles

live ↗
InMatrixFunction(_1⁡↦tanh⁡(_1⁡),[[(1/3)iπ,(−(1/3)i)π],[0,(−(1/6)i)π]])\mathrm{MatrixFunction}(\operatorname{\_1}↦\tanh(\operatorname{\_1}), \bigl\lbrack\bigl\lbrack(1/3)i π, (-(1/3)i)π\bigr\rbrack, \bigl\lbrack0, (-(1/6)i)π\bigr\rbrack\bigr\rbrack)Out[[3i,−8×31/29i],[0,−31/23i]]\bigl\lbrack\bigl\lbrack\sqrt{3}i, -\frac{8×3^{1/2}}{9}i\bigr\rbrack, \bigl\lbrack0, -\frac{3^{1/2}}{3}i\bigr\rbrack\bigr\rbrack
live ↗
InFunctionMeromorphic(tanh⁡(x),x)\mathrm{FunctionMeromorphic}(\tanh(x), x)OutTrue\mathrm{True}
Properties #

tanh⁡(x)=sinh⁡(x)cosh⁡(x)\tanh(x) = \frac{\sinh(x)}{\cosh(x)}

live ↗
Intanh⁡(1)=sinh⁡(1)cosh⁡(1)\tanh(1)=\frac{\sinh(1)}{\cosh(1)}OutTrue\mathrm{True}

In exponentials: tanh⁡x=ex−e−xex+e−x\tanh x = \frac{e^x - e^{-x}}{e^x + e^{-x}}

live ↗
InTrigToExp(tanh⁡(x))\mathrm{TrigToExp}(\tanh(x))Outex−e−xex+e−x\frac{e^{x}-e^{-x}}{e^{x}+e^{-x}}

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

live ↗
Intanh⁡(112iπ)\tanh(\frac{1}{12}i π)Outi(2−3)i(2-\sqrt{3})

Known value · Wolfram MathematicalFunctionData, Tanh

A tenth of π\pi gives nested radicals

live ↗
Intanh⁡(110iπ)\tanh(\frac{1}{10}i π)Out55i5−25\frac{\sqrt{5}}{5}i\sqrt{5-2\sqrt{5}}

Known value · Wolfram MathematicalFunctionData, Tanh

A ninth of π\pi stays as a tangent

live ↗
Intanh⁡(19iπ)\tanh(\frac{1}{9}i π)Outitan⁡(π9)i\tan(\frac{π}{9})

Known value · Wolfram MathematicalFunctionData, Tanh

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

live ↗
Intanh⁡(18iπ)\tanh(\frac{1}{8}i π)Outi(2−1)i(\sqrt{2}-1)

Known value · Wolfram MathematicalFunctionData, Tanh

A seventh of π\pi stays as a tangent

live ↗
Intanh⁡(17iπ)\tanh(\frac{1}{7}i π)Outitan⁡(π7)i\tan(\frac{π}{7})

Known value · Wolfram MathematicalFunctionData, Tanh

tanh⁡(iπ/6)=i3\tanh(i\pi/6)=\frac{i}{\sqrt3}

live ↗
Intanh⁡(16iπ)\tanh(\frac{1}{6}i π)Out33i\frac{\sqrt{3}}{3}i

Known value · Wolfram MathematicalFunctionData, Tanh

Another non-constructible angle, 2π/92\pi/9

live ↗
Intanh⁡(29iπ)\tanh(\frac{2}{9}i π)Outitan⁡(2π9)i\tan(\frac{2π}{9})

Known value · Wolfram MathematicalFunctionData, Tanh

live ↗
InN((1+tanh⁡(1/2)2)tanh⁡(1))N((1+\tanh(1/2)^2)\tanh(1))Out0.924 234 314 520 019 517 003 851 527 548 909 824 992 150.924\,234\,314\,520\,019\,517\,003\,851\,527\,548\,909\,824\,992\,15

Known value · Wolfram MathematicalFunctionData, Tanh, FunctionalEquations

live ↗
InN(tanh⁡(12+12iπ))N(\tanh(\frac{1}{2}+\frac{1}{2}i π))Out2.163 953 413 738 6532.163\,953\,413\,738\,653

Known value · Wolfram MathematicalFunctionData, Tanh, FunctionalEquations

live ↗
InN((1+tanh⁡(2)2)tanh⁡(4))N((1+\tanh(2)^2)\tanh(4))Out1.928 055 160 151 633 767 891 606 112 455 327 689 634 8961.928\,055\,160\,151\,633\,767\,891\,606\,112\,455\,327\,689\,634\,896

Known value · Wolfram MathematicalFunctionData, Tanh, FunctionalEquations

live ↗
InN(tanh⁡(2+12iπ))N(\tanh(2+\frac{1}{2}i π))Out1.037 314 720 727 548 21.037\,314\,720\,727\,548\,2

Known value · Wolfram MathematicalFunctionData, Tanh, FunctionalEquations

About
Examples40
Checked againstWolfram Language 39 agreeSageMath 33 agree1 errorSymPy 35 agree2 differmpmath 27 agreeJulia 25 agree2 errorRust 10 agree1 error
CrosswalkWikipediaMathWorld ×2WikidataBritannicaDLMFFungrimFungrim entryWolfram LanguageSageMathSymPympmathJuliaRust

Implementation

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

See also: Sinh, Cosh