Common mathematical functions in php tutorials
The tanh () function returns the hyperbolic tangent.
Syntax
Tanh (x) parameter description
X is required. A number.
Description
Returns the hyperbolic tangent of x, defined as sinh (arg)/cosh (arg ).
*/
Echo tanh (-m_pi); // output-0.996272076221
Echo "<br> ";
Echo tanh (1/2); // output. 46211715726
Echo "<br> ";
Echo tanh (m_pi); // output 0.996272076221
/*
The return tangent of the tan () function.
Syntax
Tan (x) parameter description
X is required. A number.
Description
Tan () returns the tangent of x. The unit of parameter x is radian.
*/
Echo tan (0); // output 0
Echo "<br> ";
Echo tan (m_pi/4); // output 1
Echo "<br> ";
Echo tan (3 * m_pi/4); // output-1
/*
The sinh () function is defined and used by the php math function. The sinh () function returns the hyperbolic sine of a number. The syntax sinh (x) parameter description x is required. A number
*/
Echo sinh (-m_pi); // outputs-11.5487393573
Echo "<br> ";
Echo sinh (1/2); // output 0.521095305494
Echo "<br> ";
Echo sinh (m_pi); // output 11.5487393573
/*
The sin () function returns the sine of a number.
Syntax
Sin (x) parameter description
X is required. A number.
Description
Sin () returns the sine of x. The unit of parameter x is radians.
*/
Echo sin (0); // output 0
Echo "<br> ";
Echo sin (m_pi/6); // output 0.5
Echo "<br> ";
Echo sin (7 * m_pi/6); // output-0.5
/*
The cosh () function returns the hyperbolic cosine of a number.
Syntax
Cosh (x) parameter description
X is required. A number.
Description
Returns the hyperbolic cosine of x, defined as (exp (arg) + exp (-arg)/2.
*/
Echo cosh (-m_pi); // output 11.5919532755
Echo "<br> ";
Echo cosh (1/2); // output 1.12762596521
Echo "<br> ";
Echo cosh (m_pi); // output 11.5919532755
/*
The cos () function returns the cosine of a number.
Syntax
Cos (x) parameter description
X is required. A number.
Description
Cos () returns the cosine of x. The unit of parameter x is radians.
*/
Echo cos (-m_pi); // output-1
Echo "<br> ";
Echo cos (m_pi/3); // output 0.5
Echo "<br> ";
Echo cos (m_pi); // output 1
/*
The atan () function returns an arc tangent of a value. The returned value is between-pi/2 and pi/2.
*/
Echo atan (-1); // output-0.785398163397
Echo "<br> ";
Echo atan (1/2); // output 0.463647609001
Echo "<br> ";
Echo atan (1); // 0.785398163397 output