Skip to content
Oakfield Operator Calculus Function Reference Site

Hyperbolic Tangent

For xRx \in \mathbb{R},

tanhx=exexex+ex\tanh x = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}

tanh\tanh is analytic on C\mathbb{C} except at the poles of cosh\cosh, i.e. z=(k+12)πiz = \left(k+\tfrac12\right)\pi i for kZk\in\mathbb{Z}. For real inputs, tanh:R(1,1)\tanh:\mathbb{R}\to(-1,1).


tanh(x)=tanhx,limxtanhx=1,limxtanhx=1\tanh(-x) = -\tanh x, \qquad \lim_{x\to\infty}\tanh x = 1, \qquad \lim_{x\to-\infty}\tanh x = -1
ddxtanhx=sech2x=1tanh2x\frac{d}{dx}\tanh x = \operatorname{sech}^2 x = 1 - \tanh^2 x

As xx\to\infty, 1tanhx2e2x1-\tanh x \sim 2e^{-2x}, and as xx\to-\infty, tanhx+12e2x\tanh x + 1 \sim 2e^{2x}.


Near the origin, tanhxx\tanh x \sim x. The principal singularities in the complex plane occur at z=(k+12)πiz = \left(k+\tfrac12\right)\pi i.


Logistic sigmoid σ(x)=1/(1+ex)\sigma(x) = 1/(1+e^{-x}) is an affine rescaling; smooth saturation functions generalize the bounded response.


Oakfield uses tanh as a bounded, smooth nonlinearity in both operator kernels and visualization:

  • Analytic warp: the analytic_warp operator has a TANH profile; its gradient uses 1tanh2(x)1-\tanh^2(x), making it a safe “LEVEL0” warp for smooth bounded deformation.
  • Remainder: the remainder operator supports a tanh nonlinearity option before differencing, useful for saturating large amplitudes while keeping the response smooth.
  • Visualization: the GPU phase view uses tanh to compress magnitude into a bounded value channel for display (helps handle large dynamic ranges).

Hyperbolic functions arose as analogues of trigonometric functions for the geometry of hyperbolas and became standard tools in analysis and differential equations through 18th–19th century development.

tanh\tanh is a canonical smooth saturating nonlinearity and a standard building block in numerical modeling, optimization, and signal processing.


  • NIST Digital Library of Mathematical Functions (DLMF), §4
  • Abramowitz & Stegun, Handbook of Mathematical Functions