tanh . math . sncode
latest
This function computes the hyperbolic tan of a number.
TANH(1e)
NAME
tanh - This function computes the hyperbolic tan of a number.
SYNOPSIS
tanh(argument)
DESCRIPTION
This mathematical function allows the user to compute the hyperbolic tan of an argument defined between -infinity to infinity. The answer has to be between -1 and 1. This is not a periodic function, unlike its basis function: the tan function. It returns a value only in the 1st or the 3rd quadrant of the xy plane, meaning that if x<0, y<0, and if x>0, y>0. The tanh function is defined as tanh x = ( exp(x) - exp(-x))/(exp(x)+exp(-x)), so tanhx= sinh(x)/cosh(x) and tanh(x)=-itan(ix).
PARAMETERS
- number
- Specify the number (float) used as argument for the tanh function.
RETURN
- The tanh value of the argument.
EXAMPLES
Note: In the followings examples, the _ between the { should be removed to make it work.
One can use this function with positive integers: test(q(res={_{tanh(1);}}.),q(res=.761594.)); With negative integers: test(q(res={_{tanh(-1);}}.),q(res=-.761594.)); Note that tanh(-x)=-tanh(x). With big integers: test(q(res={_{tanh(45);}}.),q(res=1.)); With other variables: test(q(res={_{ %include "/includes/extenso.sn"; a=0; tanh(a); }}.), q(res=0.)); With another trigonometric function: test(q(res={_{ %include "/includes/extenso.sn"; a=sin(0); tanh(a); }}.), q(res=0.)); With an array: test(q(res={_{tanh(1,0,-1);}}.),q(res=\[.761594,0,-.761594\].));
AUTHOR
Written by Caroline Laplante, <claplante@sednove.com>