Abstract
Two point spline based approximations for \(\mathrm{tanh}(x)\), valid over the interval \([0,\infty ]\), which can be made arbitrarily accurate, have uniform convergence, and which have better convergence than existing series, are detailed. Explicit formulas for the errors in the approximations are specified. Applications are detailed and these include, first, upper and lower bound functions for \(\mathrm{tanh}(x)\) with arbitrary accuracy. Second, a rapidly convergent series for Catalan’s constant. Third, approximations for \(\mathrm{sech}(x)\), \({\mathrm{sech}}\left(x\right)^{2}\), \({\mathrm{tanh}\left(x\right)}^{2}\), \(\mathrm{ln}[\mathrm{cosh}(x)]\), \(\mathrm{ln}\left[\mathrm{sech}\left(x\right)\right]\) and approximations for the unknown integrals of \(\mathrm{ln}\left[\mathrm{cosh}\left(x\right)\right]\) and \(\mathrm{ln}\left[\mathrm{sech}\left(x\right)\right]\), \(\mathrm{cosh}\left({k}_{o}x\right)\mathrm{tanh}\left(x\right)\) and \(\mathrm{sech}{\left({k}_{o}x\right)}^{2}\mathrm{tanh}\left(x\right)\) which are valid, with arbitrary accuracy, over the positive real line. Fourth, approximations for the integral of \(x\mathrm{tanh}\left(x\right)\) which have better convergence properties than the standard series approximation that is used. Fifth, an approximation to the response of a damped second order system to a hyperbolic tangent function input signal. Sixth, simple approximations for the Laplace transform of the hyperbolic tangent function and approximations for the response of a linear filter to a hyperbolic tangent function input signal. Seventh, a structure for a comb filter that extracts the odd harmonics and suppresses the even harmonics of a signal. Finally, explicit approximate analytical expressions for the output power and harmonic distortion arising, for the sinusoidal case, from a hyperbolic tangent function nonlinearity.
Similar content being viewed by others
Data availability
Not applicable.
Code availability
Not applicable.
References
Bagul, Y. J.: New inequalities involving circular, inverse circular, hyperbolic, inverse hyperbolic and exponential functions, Advances in Inequalities and Applications, Article ID 5, (2018). https://doi.org/10.28919/aia/3556.
Bagul, Y.J., Chesneau, C.: Some new simple inequalities involving exponential, trigonometric and hyperbolic functions. CUBO 21(1), 21–35 (2019). https://doi.org/10.4067/S0719-06462019000100021
Barnett, J.H.: Enter, stage center: The early drama of the hyperbolic functions. Math. Mag. 77(1), 15–30 (2004)
Basokur, A.T.: Designing frequency selective filters via the use of hyperbolic tangent functions. Bullet. Earth Sci. Appl. Res. Centre Hacettepe Univ. 32(1), 69–88 (2011)
Bercu, G., Wu, S.: Refinements of certain hyperbolic inequalities via the Padé approximation method. J. Nonlinear Sci. Appl. 9, 5011–5020, (2016)
Bhayo, B.A., Klén, R., Sándor, J.: New trigonometic and hyperbolic inequalities. Miskolc Math. Notes 18(1), 125–137 (2017). https://doi.org/10.18514/MMN.2017.1560
Brandt, M., Bitzer, J.: Hum removal filters: Overview and analysis, 132nd Convention of the Audio Engineering Society, April 26–29, 2012, Budapest, Hungary, 6 pages, (2012)
Champeney, D.C.: A Handbook of Fourier Theorems. Cambridge University Press, Cambridge (1987)
Erdélyi, A. (ed.): Table of Integral Transforms, vol. 1, McGraw Hill, (1954).
Gilbert, B.: The multi-tanh principle: A tutorial overview. IEEE J. Solid-State Circuits 33, 2–17 (1998)
Gradshteyn, I. S., Ryzhik, I. M.: Tables of Integrals, Series and Products, Edited by Jeffery, A. & Zwillinger, D., 7th ed. Academic Press, (2007)
Howard, R.M.: Dual Taylor series, spline based function and integral approximation and applications. Math. Comput. Appl. 24, 35 (2019). https://doi.org/10.3390/mca24020035
Johannesson, T., Distner, M.: Dynamic loading of synchronous belts. J. Mech. Des. 124, 79–85 (2002). https://doi.org/10.1115/1.1426088
Kalman, B. L., Kwasny, S. C.: Why tanh: choosing a sigmoidal function. In: Proceedings of the International Joint Conference on Neural Networks (IJCNN), Baltimore, MD, USA, vol. 4, pp. 578–581, (1992). https://doi.org/10.1109/IJCNN.1992.227257.
Malfliet, W., Hereman, W.: The tanh method: I Exact solutions of nonlinear evolution and wave equations. Phys. Scripta 54, 563–568 (1996)
Malfliet, W.: The tanh method: a tool for solving certain classes of nonlinear evolution and wave equations. J. Comput. Appl. Math. 164–165, 529–541 (2004). https://doi.org/10.1016/S0377-0427(03)00645-9
Marichev, O., Sondow, J., Weisstein, E. W.: Catalan's Constant, eqn 33, From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/CatalansConstant.html. Accessed 14 Sept. 2020
Meher, J., Meher, P., Dash, G.: Improved comb filter based approach for effective prediction of protein coding regions in DNA sequences. J. Signal Inf. Process. 2, 88–99 (2011). https://doi.org/10.4236/jsip.2011.22012
Nwankpa, C., Ijomah, W., Gachagan, A., Marshall, S.: Activation Functions: Comparison of trends in Practice and Research for Deep Learning, http://arxiv.org/abs/1602.07360 (2018)
Özbal, S., Südor, H. C., Keskin, A. Ü.: Chaotic dynamics of a jerk function with hyperbolic tangent nonlinearity, 2018 Medical Technologies National Congress (TIPTEKNO), Magusa, pp. 1–4, (2018). https://doi.org/10.1109/TIPTEKNO.2018.8596866
Paris, R. B.: Struve and Related Functions, ch. 11, NIST Handbook of Mathematical Functions, Editors: Olver, F. W., Lozier, D. W., Boisvert, R. F., & Clark, C. W., National Institute of Standards and Technology and Cambridge University Press, (2010)
Paul, S.K., Choubey, C.K., Tiwari, G.: Low power analog comb filter for biomedical applications. Analog Int. Circ. Sig. Process 97, 371–386 (2018). https://doi.org/10.1007/s10470-018-1329-8
Roy, R., Olver, F. W. J.: Elementary functions, ch. 4, NIST Handbook of Mathematical Functions, Editors: Olver, F. W., Lozier, D. W., Boisvert, R. F., Clark, C. W., National Institute of Standards and Technology and Cambridge University Press, (2010)
Schuck Jr., A., Bodman, B. E. J.: Audio nonlinear modeling through hyperbolic tangent functionals. In: Proceedings of the 19th International Conference on Digital Audio Effects (DAFx-16), Brno, Czech Republic, September 5–9, 2016, pp. DAFX-103 to DAFX-108, (2016)
Spiegel, M. R., Lipshutz, S., Liu, J.: Mathematical Handbook of Formulas and Tables, Third Ed., McGraw Hill, (2009)
Weisstein, E. W.: Hyperbolic Cotangent, From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/HyperbolicCotangent.html. Accessed September 14, 2020
Zhu, L., Sun, J.: Six new Redheffer-type inequalities for circular and hyperbolic functions. Comput. Math. Appl. 56, 522–529 (2008)
Acknowledgements
The author is pleased to acknowledge the support of Prof. A. Zoubir, SPG, Technische Universität Darmstadt, Darmstadt, Germany, who hosted a visit where the research underpinning this paper, along with the writing of the paper, was completed.
Funding
This research was not supported by any external funding.
Author information
Authors and Affiliations
Contributions
RH is the sole contributor to the manuscript.
Corresponding author
Ethics declarations
Conflict of interest
The author declares that he has no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
Appendix 1: Proof of Theorem 3.1
The approximations for the hyperbolic tangent function arise from utilizing the spline based approximation, defined by Eq. (30), to approximate the function.
over the interval \([\mathrm{0,1}]\). The \(n\mathrm{th}\) order approximation is
As
which implies \({f}_{1}^{(k)}(0)=k!/{2}^{k}\) and \({f}_{1}^{k)}(1)=2k!\) , it follows that
Explicit approximations, of orders zero to six, are:
The associated approximations for tanh (x), as stated in Eqs. (37) to (43), then arise from the result \({f}_{n}(x)={f}_{1,n}\left[{h}^{-1}(x)\right]\) with \({h}^{-1}(x)=1-\mathrm{exp }(-2x)\).
To prove the general form for the coefficients, consider the coefficient array associated with the approximations for \(\mathrm{tanh}(x)\), as stated in Eqs. (37) to (43) for \({c}_{n,k}\), \(n\le k\le 2n+1\):
The general definition for the coefficients then follows according to
Appendix 2: Proof of Theorem 3.2
Consider the error function.
associated with approximations for \({f}_{1}\left({x}_{1}\right)=\mathrm{tanh }\left[h\left({x}_{1}\right)\right]=\frac{{x}_{1}}{2-{x}_{1}}, {x}_{1}={h}^{-1}(x)=1-\mathrm{exp }(-2x)\) . The \(n\mathrm{th}\) order approximation, \({f}_{1,n}\), is specified by Eq. 178. Simplification (e.g. via use of Mathematica) leads to
Explicit expressions, valid for \({x}_{1}\in [\mathrm{0,1}]\), are:
The corresponding errors in the approximations for tanh(x) follow according to Lemma 1:
with the transformation of \(x=h\left({x}_{1}\right){, x}_{1}={h}^{-1}(x)\). Substitution and simplification yields
which is the required result.
Appendix 3: Proof of Theorem 4.1
First, convergence of the approximation stated in Theorem 3.1 implies
and, consistent with Theorem 3.3, the convergence is again uniform as \(x{e}^{-x}\) is bounded above for \(x\in [0,\infty )\). It then follows, consistent with Lemma 3, that function convergence leads to integral convergence according to
As
the required result follows from the definition specified in Eq. (58):
Appendix 4: Proof of Theorem 4.2
These results follows from Theorem 3.1 and the result \(\frac{\mathrm{d}}{\mathrm{d}x}\mathrm{tanh }(x)=\mathrm{sech}(x{)}^{2}\). Consider Eq. (44)
for the case of \(x>0\). Differentiation yields
where the error in the approximation is
This error has the following bound
which clearly converges to zero as the order of approximation increases. The convergence is uniform over \((0,\infty )\).
For the case of \(x=0\), \({e}_{2,n}(0)=0\) and the stated approximation for \({\mathrm{sech}\left(x\right)}^{2}\) is valid at this point. This result is consistent with the summation
and this result can readily be confirmed.
Appendix 5: Proof of Theorem 4.3
First, \(\mathrm{tanh}(x)\), and the approximations for \(\mathrm{tanh}(x)\) as stated in Theorem 3.1, satisfy the conditions specified in Lemma 3. Thus, function convergence leads to integral convergence, i.e.
Direct integration of \({f}_{n}\), as defined by Eq. (35), yields:
and it is the case that \({g}_{n}\left(0\right)=0\).
Convergence of \({g}_{n}\), for all finite intervals, according to \(\underset{n\to \infty }{\mathrm{lim}} {g}_{n}(x)=\mathrm{ln }[\mathrm{cosh }(x)]\) implies, consistent with Lemma 3, that
Direct integration then yields the approximations for \(h\):
Appendix 6: Proof of Theorem 4.4
Consider the differential equation
for the case where \({f}_{n}\) is the \(n\mathrm{th}\) order approximation to \(\mathrm{tanh}\) defined, consistent with Theorem 3.1, according to
The solution to the differential equation can be found by considering a signal form defined according to
which implies
Substitution of these expressions into the differential equations yields
As \({c}_{n,0 }=1\), it follows that \({{\alpha }}_{1}=-1\) and the requirement is then for
The initial condition of \(y\left(0\right)=0\) implies
As the solution of the differential equation
is \(y(t)=1-\mathrm{sech }(t)\) , it follows that a \(n\mathrm{th}\) order approximation to \(\mathrm{sech}(t)\) is given by
Proof of Convergence for Sech
The error in the approximation to \(\mathrm{sech}(x)\), as defined by \({\upvarepsilon }_{S,n}(x)=\mathrm{sech }(x)-{S}_{n}(x)\), is
The argument of the exponential function is the negative of the integral of the \(n\mathrm{th}\) order approximation, \({f}_{n}\), for \(\mathrm{tanh}(x)\) as specified in Theorem 3.1, i.e.
It then follows that
with the error being zero when \(x=0\). As
it follows that
From Eq. (44) it follows that \({\upvarepsilon }_{n}\) has the bound
and it then follows that
Thus, as \(n\) increases, the approximation
becomes increasingly valid and, hence:
for a constant \({k}_{S}\) which is close to one. Clearly, the convergence is uniform for \(x\in (0,\infty )\). It also follows that the relative error in the approximation for \(\mathrm{sech}(x)\) has the bound
Proof of Convergence for ln[Sech] and Integral of lnSech
Uniform convergence of \({S}_{n}\) to \(\mathrm{sech}\) for \(x\ge 0\) is consistent with: \(\forall\upvarepsilon >0\), \(\exists N>0\) such that for \(\forall n>N\) it is the case that
It then follows, for \(n\) suitably large, that
where the approximation is valid as \(\frac{\mathrm{sech}\left(x\right)}{{S}_{n}\left(x\right)}\approx 1\) and \(\frac{{\upvarepsilon }_{S,n}\left(x\right)}{\mathrm{sech}\left(x\right)}\ll 1\) (Eq. 223) as \(n\) increases. Hence, the error in the approximation \(\mathrm{ln }\left[\mathrm{sech }\left(x\right)\right]\approx \mathrm{ln }\left[{S}_{n}(x)\right]\) is
and this has the bound, consistent with Eq. (223), of
where \({k}_{L}\) is similar in magnitude to \({k}_{S}\). Thus, the convergence of \(\mathrm{ln} [{S}_{n}(x)]\) to \(\mathrm{ln} [\mathrm{sech}(x)]\) is uniform for \(x>0\).
Convergence of \({L}_{n}\), for all finite intervals, according to \(\underset{n\to \infty }{\mathrm{lim}}{ L}_{n}(x)=\mathrm{ln }[\mathrm{sech }(x)]\) implies, consistent with Lemma 3, that
Appendix 7: Proof of Theorem 4.5
The approximation for the hyperbolic tangent function, specified in Theorem 3.1, yields the \(n\mathrm{th}\) order approximation to the integral of \(\mathrm{cosh }\left({k}_{o}x\right)\mathrm{tanh }(x)\) according to
Standard analysis, with the restriction \({k}_{o}^{2}-4{k}^{2}\ne 0,k\in \{\mathrm{0,1},\ldots ,2n+1\}\) , leads to
and the alternative form then follows:
Convergence is guaranteed as
and, consistent with Lemma 3, function convergence leads to integral convergence, i.e.
Appendix 8: Proof of Theorem 4.6
Substitution of the approximations for \(\mathrm{tanh}(x)\) and \(\mathrm{sech }{\left(x\right)}^{2}\), as defined by Theorems 3.1 and 4.2, yields the approximation.
Interchanging the order of summation and integration leads to
and the required result:
Convergence is guaranteed as
and, consistent with Lemma 3, function convergence leads to integral convergence, i.e.
Appendix 9: Proof of Theorem 4.7
These results arise from the approximations for \(\mathrm{tanh }(x)\) specified in Theorem 3.1 and the Laplace transform result:
To prove convergence, note, consistent with Eq. (44), that
It then follows, with \(s=\upsigma +j\upomega \), that
which clearly converges to zero as \(n\) increases for \(\upsigma \ge 0\). Thus, for \(\mathrm{Re} \left(s\right)>0\), it is the case that \(\underset{n\to \infty }{\mathrm{lim}} {F}_{n}(s)=F(s)\) , as required.
Appendix 10: Proof of Theorem 4.8
The integral of \(x \mathrm{tanh}(x)\) is given by.
as \(\int\limits_{0}^{x}\mathrm{ tanh}(\uplambda )d\uplambda =\mathrm{ln }[\mathrm{cosh}(x)]\) . The unknown convolution integral has the Laplace transform
where \({\varvec{L}}\) is the Laplace transform operator. Utilizing the Laplace transform approximation for \(\mathrm{tanh}\), as specified in Theorem 4.7, it follows that
The partial fraction expansion
leads to
where the results
have been used. The required result then follows:
Proof for Second Approximation
Consider the approximation for \(\mathrm{tanh}(x)\) specified in Theorem 3.1 which implies
where the interchange of integral and limit is valid consistent with the dominated convergence theorem. It then follows that
as
The second approximation also follows from the first approximation by utilizing the approximation for \(\mathrm{ln} [\mathrm{cosh}(x)]\) specified in Theorem 4.3. As this approximation is convergent it follows from the convergence of the second approximation that the first approximation is also convergent over the positive real line.
Appendix 11: Proof of Theorem 4.9
The response of a system, with an impulse response defined by Eq. (142), to an exponential input signal, defined by \({x}_{m}(t)={e}^{-mt}u(t)\), is.
The integral result (e.g. [25], Eq. 17.25.10)
implies
As
the output simplifies to
The linearity of the system and the approximation of the hyperbolic tangent function input signal according to \(\sum_{k=0}^{2n+1} {c}_{n,k}\cdot {e}^{-2kt/\upgamma }\) (Theorem 3.1) leads to
which is the required result.
To prove convergence, consider
The interchange of limit and integration is valid, consistent with Lemma 3, for \(0<\upxi <1\) as the integrand comprises of differentiable bounded functions.
Appendix 12: Proof of Theorem 4.10
Using the approximation to the hyperbolic tangent function specified by Theorem 3.1, and the Laplace transform result
it follows that
and the Laplace transform of the \(n\mathrm{th}\) order approximation to the output signal is
As
it follows, with \({\alpha }=\gamma /2k\), \(\upbeta =\uptau \), that
Taking the inverse Laplace transform yields the required result:
To prove convergence, consider the time domain form for the output signal:
where \(h(t)=\frac{{t}^{i-1}{e}^{-t/\uptau }}{(i-1)!{\uptau }^{i}}\cdot u(t)\). The interchange of limit and integration is valid, consistent with Lemma 3, as the integrand comprises of differentiable bounded functions.
Appendix 13: Proof of Theorem 4.11
Consider.
where \({c}_{n,0 }=1\). The \(n\mathrm{th}\) order transfer function is defined by the approximation to the hyperbolic tangent function specified in Theorem 3.1. The impulse response follows from the Laplace transform relationship
where \(\updelta \) is the Dirac delta.
The magnitude response of the transfer function, by definition, is
To determine the values of \(f\) where the magnitude response is zero, consider
A sufficient condition for this to be zero is for
and this is satisfied when
For the case of \(f\in \{0, 1/2\uptau ,1/\uptau ,\ldots ,r/2\uptau ,\ldots \}\) , the magnitude response is a minimum with a value of zero as
where the equality to zero follows from Eq. (46).
For the case of \(f\in \{1/4\uptau ,3/4\uptau ,\ldots ,(2r+1)/4\uptau ,\ldots \}\) , the magnitude response has the value
where the final result can readily be confirmed numerically. Thus, the frequencies \(f\in \left\{0,\frac{1}{4\uptau },\frac{2}{4\uptau },\frac{3}{4\uptau },\ldots \right\}\) are consistent with alternating minima and maxima points and a comb filter structure as detailed in Fig. 23.
Appendix 14: Proof of Theorem 4.12
The odd nature of the hyperbolic tangent function, along with the approximations detailed in Theorem 3.1, yield the following explicit approximate expression for the output signal:
Utilizing the first half cycle of the signal, the output power has the associated approximation
Using a change of variable \(\lambda ={f}_{o}t\) the normalized form results
and the solution of the integral in terms of \({I}_{0}\) and \({L}_{0}\) arises from Mathematica.
The rth harmonic of the output signal is given by
and can be approximated according to
after a change of variable \(\lambda ={f}_{o}t\). With the further change of variable for the second integrals of \(\upgamma =\uplambda -1/2\) , it follows that
Hence
as
Evaluation, via Mathematica, of the integral in Eq. (281) yields the coefficient expressions detailed in Eqs. (169) to (172).
Rights and permissions
About this article
Cite this article
Howard, R.M. Arbitrarily Accurate Spline Based Approximations for the Hyperbolic Tangent Function and Applications. Int. J. Appl. Comput. Math 7, 215 (2021). https://doi.org/10.1007/s40819-021-01088-1
Accepted:
Published:
DOI: https://doi.org/10.1007/s40819-021-01088-1
Keywords
- Hyperbolic tangent
- Spline approximation
- Catalan’s constant
- Integral approximation
- Laplace transform
- Second order system
- Comb filter
- Harmonic distortion