# Numpy Exponential Function in Python

Hi, guys today we have got a very easy topic i.e **exponential function in ****Numpy – Python.**

So let’s start.

The first question comes in our mind that what is the* E xponential Function* and what it does?

So as we know about the exponents, this * Exponential Function* in Numpy is used to find the exponents of

*.*

**‘e’**We know that the value of * ‘e’* is

*‘2.71828183’.*If we need to find the exponential of a given array or list, the code is mentioned below.

import numpy as np #create a list l1=[1,2,3,4,5] print(np.exp(l1))

The output of the following code is:-

import numpy as np l1=np.array([1,2,3,4,5,6,7]) print(l1) print(np.exp(l1))

The output of the following code is:-

Now the above things are the basics.

Here is the complete syntax of the **numpy.exp**

**numpy.exp(array, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None)**

### numpy.exp() with matplotlib

As we know we can plot the graph of * ‘e’. *Python gives as a special module

**matplotlib.pyplot.**By using this module we can plot the graph of the **‘e’**

Here is the example code for that.

import numpy as np import matplotlib.pyplot as plt x= np.array([1,2,3,4,5]) y=np.exp(x) plt.plot(x,y) plt.show()

The output of the code is a graph shown below.

Now there is a question arises that what to do if we have to plot two graphs together.

So, no need to worry because we can plot n numbers of the graphs using the module I have mentioned above.

import numpy as np import matplotlib.pyplot as plt x= np.array([1,3,5]) y=[2,4,6] z=np.exp(x) w=np.exp(y) plt.plot(x,z,color="blue",marker='*') plt.plot(y,w,color="red",marker='o') plt.xlabel("X Axis--------->") plt.ylabel("Y Axis--------->") plt.show()

Here is the output of the following code.

So, I hope you have understood this topic very well.

## Leave a Reply