Common mathematical functions in php

Source: Internet
Author: User
Tags cos mathematical functions sin

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.