Hyperbolic Tangent

Author

Eric W. Weisstein
August 24, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/HyperbolicTangent.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/HyperbolicTangent.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Definition

TrigToExp[Tanh[z]]

Simplify[%]

Plots

<<Utilities`Plot`
<<Utilities`Typesetting`

Real Axis

Plot[Tanh[x],{x,-5,5},AxesLabel->TraditionalForm/@{x,Tanh[x]},
Epilog->{RGBColor[1,0,0],AbsoluteDashing[{5,8}],Line[{{-10,#},{10,#}}]&/@{-1,1}}
]

Complex Plane

ComplexPlot3D[Tanh[z],{z,-5,5},PlotPoints->70,Mesh->False,ClipFill->None]//Timing

ComplexContourPlot[Tanh[z],{z,-5,5}]//Timing

Special Values

Tanh[0]

FullSimplify[Tanh[Log[GoldenRatio]]]

Limit[Tanh[x],x->#]&/@{-∞,∞}

Derivative and Integral

Derivative

(ds=Table[D[Tanh[x],{x,n}],{n,0,5}])//ColumnForm

Together[TrigToExp[ds]]//ColumnForm

<<DiscreteMath`Combinatorica`

Table[Eulerian[n,k],{n,0,5},{k,0,n-1}]//ColumnForm

Table[(((2^(n+1))Exp[2x])/(((1+Exp[2x]))^(n+1)))Sum[Eulerian[n,k](((-1))^k)Exp[2k x],{k,0,n-1}],{n,0,5}]//ColumnForm

ds-Table[(((2^(n+1))Exp[2x])/(((1+Exp[2x]))^(n+1)))Sum[Eulerian[n,k](((-1))^k)Exp[2k x],{k,0,n-1}],{n,5}]//FullSimplify

Higher Derivatives

Sum[Integrate[((((((2^(n+1))Exp[2x])/(((1+Exp[2x]))^(n+1)))Sum[Eulerian[n,k](((-1))^k)Exp[2k x],{k,0,n-1}]))^2),{x,-∞,∞}],{n,∞}]

Plot[Evaluate[Table[D[Tanh[x],{x,n}]^2,{n,0,3}]],{x,-5,5},PlotRange->All,PlotStyle->{Red,Yellow,Green,Blue,Purple}]

Integrate[((Tanh[x])^2),{x,-∞,∞}]

Table[Sum[Integrate[D[Tanh[x],{x,n}]^2,{x,-∞,∞}],{n,k}],{k,5}]

Table[Integrate[D[Tanh[x],{x,n}]^2,{x,-∞,∞}],{n,5}]

Through[{Numerator,Denominator}[%]]

Table[NIntegrate[D[Tanh[x],{x,n}]^2,{x,-∞,∞}],{n,5}]

5120/33.

Integral

Integrate[Tanh[z],z]

Series

Series[Tanh[x],{x,0,15}]

Table[%,{n,0,15}]

Table[(((2^(1+n)) (-1+(2^(1+n))) BernoulliB[1+n])/((1+n)!)),{n,10}]

v5.0

<<DiscreteMath`RSolve`

SeriesTerm[Tanh[z],{z,0,n}]

V6

SeriesCoefficient[Tanh[z],{z,0,n}]

V7

SeriesCoefficient[Tanh[z],{z,0,n}]//InputForm

TimeConstrained[GeneratingFunction[%,n,z],60]//Timing

Sums

(∑_n^∞)(x^n) Piecewise[(({{(((2^(n+1)) ((2^(n+1))-1) (Subscript[B, n+1]))/((n+1)!)), n mod 2==1∧n≥1}})),0]==tanh(x)

Sum[Piecewise[{{(2^(1 + n)*(-1 + 2^(1 + n))*BernoulliB[1 + n])/(1 + n)!, 
   Mod[n, 2] == 1 && n >= 1}}, 0]x^n,{n,∞}]

(∑_n^∞)(((z^n) ((2^(n+1)) ((2^(n+1))-1) (Subscript[B, n+1])))/((n+1)!))==tanh(z)

Sum[(((2^(n+1))((2^(n+1))-1)BernoulliB[n+1])/((n+1)!))(z^n),{n,∞}]

Differential Equation

V5

DSolve[{f''[x]/2==f[x]^3-f[x],f[0]==0,f'[Infinity]==0},f[x],x]

Simplify[%,x>0]

V6

DSolve[{f''[x]/2==f[x]^3-f[x],f[0]==0,f'[Infinity]==0},f[x],x]

Simplify[%,x>0]

V7

DSolve[{f''[x]/2==f[x]^3-f[x],f[0]==0,f'[Infinity]==0},f[x],x]

Check

Simplify[Subtract@@{f''[x]/2,f[x]^3-f[x]}/.f->Tanh]

{Tanh[0],Derivative[1][Tanh][∞]}

Damped Hyperbolic Tangent

Plot[Evaluate[Table[Exp[-(x-X)^2-x^2]Tanh[x],{X,-1,1,.5}]],{x,-3,3},PlotRange->All,PlotStyle->{Red,Yellow,Green,Blue,Purple}]

i11=Table[Integrate[Exp[-(x-X)^2]Tanh[x],{x,-∞,∞}],{X,0,5}]

myint1[n_]:=((2Sum[E^(k^2)(-1)^(k+(1-(-1)^n)/2),{k,n-1}]+E^(n^2)+(-1)^n)/E^(n^2))Sqrt[π]

i12=Together[myint1/@Range[0,5]]

Rest[i11-i12]

Refine[myint1[n],Mod[n,2]==0]

Refine[myint1[n],Mod[n,2]==1]

f[X_?NumericQ]:=NIntegrate[Exp[-(x-X)^2-x^2]Tanh[x],{x,-∞,∞}]

Plot[f[x],{x,-5,5}]

Plot[Tanh[x]Exp[-x^2],{x,-5,5},PlotRange->All]

Plot[Evaluate[Table[Exp[-(x-X)^2]Tanh[x],{X,-1,1,.5}]],{x,-3,3},PlotRange->All,PlotStyle->{Red,Yellow,Green,Blue,Purple}]

i21=Table[Integrate[Exp[-(x-X)^2-x^2]Tanh[x],{x,-∞,∞}],{X,0,5}]

myint2[n_]:=(2Sum[E^(k^2/2)(-1)^(k+(1-(-1)^n)/2),{k,n-1}]+E^(n^2/2)+(-1)^n)Sqrt[Pi/2]/E^(n^2)

i22=myint2/@Range[0,5]

Rest[i21-i22]//Simplify

Refine[myint2[n],Mod[n,2]==0]

Refine[myint2[n],Mod[n,2]==1]

Plot[Evaluate[Re[Table[Exp[-(x-X)^2-I x^2]Tanh[x],{X,-1,1,.5}]]],{x,-3,3},PlotRange->All,PlotStyle->{Red,Yellow,Green,Blue,Purple}]

Continued Fraction

tanhx==(x/(1+((x^2)/(3+((x^2)/(5+…))))))

((x^2)/(3+((x^2)/5)))//Factor

ContinuedFractionK[x^2,2n+1,{n,2}]

x/(1+ContinuedFractionK[x^2,2n+1,{n,∞}])

With[{x=2.2},{x/(1+ContinuedFractionK[x^2,2n+1,{n,20}]),Tanh[x]}]