Python math.exp() – Exponential Function

Python math.exp()

math.exp(x) function returns the value of e raised to the power of x, where e is the base of natural logarithm.

exp(x) = e^x

Syntax

The syntax to call exp() function is

math.exp(x)

where

Parameter Required Description
x Yes A numeric value.

Examples

In the following example, we find the exponential power of 2, using exp() function of math module.

Python Program

import math

x = 2
result = math.exp(x)
print('exp(x) :', result)
Run Code

Output

exp(x) : 7.38905609893065

Now, let us find the exponential power of a negative number.

Python Program

import math

x = -2
result = math.exp(x)
print('exp(x) :', result)
Run Code

Output

exp(x) : 0.1353352832366127

Summary

In this Python Examples tutorial, we learned the syntax of, and examples for math.exp() function.

Related Tutorials

Privacy Policy Terms of Use

SitemapContact Us