PHP commonly used mathematical functions

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags echo function functions network network programming php php tutorial programming

The math functions commonly used in php tutorials

The tanh () function returns the hyperbolic tangent.

grammar
tanh (x) Parameter Description
x Required. A few.

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 tan () function returns the tangent.

grammar
tan (x) Parameter Description
x Required. A few.

Description
tan () Returns the tangent of parameter 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 / *
sinh () function php math function definition and usage sinh () function returns a number of hyperbolic sine. Syntax sinh (x) Parameter Description x Required. A number
* /

echo sinh (-m_pi); // Output -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.

grammar
sin (x) Parameter description
x Required. A few.

Description
sin () returns the sine of parameter x. The unit of parameter x is radian.

* /

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.

grammar
cosh (x) Parameter Description
x Required. A few.

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.

grammar
cos (x) Parameter description
x Required. A few.

Description
cos () Returns the cosine of parameter x. The unit of parameter x is radian.

* /

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 the arctangent of a number with a return 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); // Output 0.785398163397

Related Article

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.