Python built-in math module knowledge points

Source: Internet
Author: User
Tags mathematical functions

The Math module implements a number of mathematical functions for floating-point numbers. These functions are generally a simple encapsulation of functions of the same name in the Platform C Library, so the results of calculations under different platforms may be slightly different and sometimes even very large.

The Python math function must import math
Function description Instructions Example
Returns the inverse cosine of x Math.acos (x)
Returns the inverse hyperbolic cosine of x Math.acosh (x)
Return x's Inverse chord Math.asin (x)
Returns the inverse hyperbolic sine of x Math.asinh (x)
Returns the inverse tangent of X Math.atan (x)
Return y/x of the arc tangent Math.atan2 (y,x)
Returns the inverse hyperbolic tangent of x Math.atanh (x)
Returns the minimum integer of ≧x Math.ceil (x) Math.floor (3.4) Results 4
Returns the X value of the same number as Y Math.copysign (x, y)
Returns the cosine of X Math.Cos (x)
Returns the hyperbolic cosine of x Math.cosh (x)
Turn x (arc length) into angle, and radians as inverse function Math.degrees (x)
Constant E = 2.7128 ... Math.e
Back to ex, math.e**x. Math.exp (x)
Returns the absolute value of X Math.fabs (x)
Back to x! Math.factorial (x)
Returns the largest integer of ≦x Math.floor (x) Math.floor (3.4) Results 3
Returns the remainder of the X-to-y modulo
Fmod is similar to%, but the result may be different from%, because the former takes Y to determine the remainder of the symbol, the latter you x to determine the remainder of the symbol.
Math.fmod (x, y)
Returns a 2-tuple (2-tuple) divided by a false number m (float) and
an exponent n (int), that is, x = mx2n and ldexp are inverse functions
Math.frexp (x) Math.frexp (1.625) results (0.8125,1)
Returns the values of the X array and Math.fsum (x) Math.frexp ([2,5]) Results 7
Return Math.hypot (x, y)
If x =±inf is also ±∞
Returns True
Math.isinf (x)
if x = Non (not a number)
Returns True
Math.isnan (x)
Return mx2n and frexp are inverse functions Math.ldexp (M,n)
Return, if not write a set E Math.log (X,a)
Return MATH.LOG10 (x)
Return MATH.LOGLP (x)
Returns the number of decimal parts of x and the integral parts MATH.MODF (x)
return constant π (3.14159 ...) Math.PI
Return to XY Math.pow (x, y)
Turn x (angle) into arc length, with degrees as inverse function Math.radians (d)
Returns the sine of X Math.sin (x)
Returns the hyperbolic sine of x Math.sinh (x)
Return MATH.SQRT (x)
Returns the tangent of X Math.tan (x)
Returns the hyperbolic tangent of X Math.tanh (x)
Returns the integral part of x, equal to int Math.trunc (x)

Python built-in math module knowledge points

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.