Home  >  Article  >  Backend Development  >  How does python e represent

How does python e represent

coldplay.xixi
coldplay.xixiOriginal
2021-03-02 15:41:4539771browse

Python e representation method: use the [exp()] method, the code is [import math;math.exp(x);], [exp()] cannot be accessed directly, and the math module needs to be imported. , calling this method through a static object.

How does python e represent

The operating environment of this tutorial: Windows 7 system, python version 3.9, DELL G3 computer.

Python e representation method:

exp() method returns the exponent of x, ex.

Syntax

The following is the syntax of the exp() method:

import math
math.exp( x )

Note: exp() cannot be accessed directly Yes, you need to import the math module and call this method through a static object.

Parameters

x -- Numeric expression.

Return value

Returns the exponent of x, ex.

Example

The following shows an example of using the exp() method:

#!/usr/bin/python
import math   # 导入 math 模块
print "math.exp(-45.17) : ", math.exp(-45.17)
print "math.exp(100.12) : ", math.exp(100.12)
print "math.exp(100.72) : ", math.exp(100.72)
print "math.exp(119L) : ", math.exp(119L)
print "math.exp(math.pi) : ", math.exp(math.pi)

The output result after running the above example is:

math.exp(-45.17) :  2.41500621326e-20
math.exp(100.12) :  3.03084361407e+43
math.exp(100.72) :  5.52255713025e+43
math.exp(119L) :  4.7978133273e+51
math.exp(math.pi) :  23.1406926328

Related free learning recommendations: python video tutorial

The above is the detailed content of How does python e represent. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn