Exponential Functions: math.exp()
00:22 When the exponent is a positive integer, these functions are usually called polynomial functions. On the other hand, exponential functions are power functions, but here, the base is fixed and it’s the exponent that changes. A lot of times these are written as, say, a to the power of x. a is the base—, that’s fixed—and it’s the power x that’s changing.
00:48 The fixed base a is a positive number in most applications. Otherwise, you’re going to have to deal with complex numbers. Qualitatively, when a, the base, is greater than 1, the values of the function increase as x increases. So, in other words, if this base a is greater than 1, as we make this exponent larger, the entire output of the function also increases. On the other hand, if a is between 0 and 1, then the values of the output of the function—they’re going to decrease as the input x increases.
02:06 The exponential function is important in many applications involving exponential growth or decay. We’ll take a look at an example in the next lesson of this, but for now, let’s just get comfortable with the exponential function.
Let’s just compute a couple values of the exponential function. So, say, evaluated at
3 or evaluated at, say,
-3. And so, here, the input can be any float, any number. It doesn’t matter whether it’s negative or positive.
The exponential is defined for every real number. Now, the exponential function being e to the power of x means that if we evaluate the exponential function at
1, it should be pretty close to the value of
e in the
But go ahead and see what happens when you do this. We get
True. Python’s doing a good job in being consistent that e to the power of 1 is exactly e, and so the value in the
e constant in the
math module does evaluate exactly to the exponential function evaluated at
Now, the exponential function is just a power function, so if I compute the power of
e to the power of
2, that should be pretty close to the exponential function evaluated at
2. Let’s see what Python does in this case.
Become a Member to join the conversation.