NumPy Mathematical Functions
Numpy Mathematica Functions
The NumPy is the best python library for mathematics. In NumPy Mathematical Functions blog going to learn most useful mathematical functions.
NumPy Arithmetic Operations
Using Python NumPy functions or operators solve arithmetic operations.
To use NumPy need to import it.
1 |
|
Note: In this blog, all practical perform on Jupyter Notebook. If you are working on another IDE rather than it. So please assign the return value to any variable and to show it as output using a print() function.
Creating two arrays using np.arange() function and reshape it in 2D using np.reshape() function.
1 2 3 4 5 6 |
|
1 2 3 4 5 6 7 8 |
|
Addition of Two Numpy Array
Using + Operator
1 |
|
1 2 3 4 |
|
using np.add() function
1 |
|
1 2 3 4 |
|
Subtraction of Two NumPy Array
using – Operator
1 |
|
1 2 3 4 |
|
Using np.subtract() function
1 |
|
1 2 3 4 |
|
Division of Two NumPy Array
using – Operator
1 |
|
1 2 3 4 |
|
Using np.divide() function
1 |
|
1 2 3 4 |
|
Multiplication of Two NumPy Array
using * Operator
1 |
|
1 2 3 4 |
|
Using np.multiply() function
1 |
|
1 2 3 4 |
|
Matrix Product of Two NumPy Array (matrix)
using @ Operator
1 |
|
1 2 3 4 |
|
Using np.dot() function
1 |
|
1 2 3 4 |
|
NumPy Mathematical Built-in functions
np.max()
To find maximum value from an array.
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
np.argmax()
1 |
|
1 |
|
np.min()
To find minimum value from an array.
1 |
|
1 |
|
1 |
|
1 |
|
np.argmin()
1 |
|
1 |
|
np.sum()
Return sumation of NuPy array.
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
np.mean()
Return mean of NumPy array.
1 |
|
1 |
|
np.sqrt()
Return square root of each element of NumPy array.
1 |
|
1 2 3 4 |
|
np.std()
Return standerd division of Numpy array.
1 |
|
1 |
|
no.exp()
Return exponential value of each element of the NumPy array.
1 |
|
1 2 3 4 |
|
no.log()
Return natural log of each element of NumPy array.
1 |
|
1 2 3 4 |
|
np.log10()
Return log to the base 10 value of each element of NumPy array.
1 |
|
1 2 3 4 |
|
Conclusion
In the blog of NumPy mathematical functions, we covered the most useful mathematical functions. These are the best to solve machine learning and data science project. If you want to learn more functions, then jump on the official website of Numpy.
Download Jupyter file of above source code.
Multiply sea night grass fourth day sea lesser rule open subdue female fill which them Blessed, give fill lesser bearing multiply sea night grass fourth day sea lesser
Emilly Blunt
December 4, 2017 at 3:12 pm