How to plot complex exponential function in python
Show
Exploring
Your
Making a
evaluate it at a range of values:
same values with just 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 Exponential 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)) Run this code online 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)) Run this program online 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 matplotlibAs 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. What is complex exponential function?The complex exponential. The exponential function is a basic building block for solutions of ODEs. Complex numbers expand the scope of the exponential function, and bring trigonometric functions under its sway.
How do you write imaginary I in Python?In Python, the symbol j is used to denote the imaginary unit.
How do I plot a function in Python using MatPlotLib?MatPlotLib with Python. Set the figure size and adjust the padding between and around the subplots.. Create a user-defined function using, def, i.e., f(x).. Create x data points using numpy.. Plot x and f(x) using plot() method.. To display the figure, use show() method.. |