numpy.einsum() Method Last Updated : 10 Aug, 2020 Comments Improve Suggest changes Like Article Like Report In NumPy, we can find Einstein’s summation convention of two given multidimensional arrays with the help of numpy.einsum(). We will pass two arrays as a parameter and it will return the Einstein’s summation convention. Syntax: numpy.einsum() Parameter: Two arrays. Return : It will return the Einstein’s summation convention. Example 1: Python import numpy as np array1 = np.array([1, 2, 3]) array2 = np.array([4, 5, 6]) # Original 1-d arrays print(array1) print(array2) r = np.einsum("n,n", a, b) # Einstein’s summation convention of # the said arrays print(r) Output: [1 2 3] [4 5 6] 32 Example 2: Python import numpy as np ar1 = np.arange(9).reshape(3, 3) ar2 = np.arange(10, 19).reshape(3, 3) # Original Higher dimension print(ar1) print(ar2) print("") r = np.einsum("mk,kn", ar1, ar2) # Einstein’s summation convention of # the said arrays print(r) Output: [[0 1 2] [3 4 5] [6 7 8]] [[10 11 12] [13 14 15] [16 17 18]] [[ 45 48 51] [162 174 186] [279 300 321]] Comment More infoAdvertise with us Next Article numpy.einsum() Method vipinyadav15799 Follow Improve Article Tags : Python Python-numpy Python numpy-ndarray Practice Tags : python Similar Reads Python | Decimal min() method Decimal#min() : min() is a Decimal class method which compares the two Decimal values and return the min of two. Syntax: Decimal.min() Parameter: Decimal values Return: the min of two. Code #1 : Example for min() method Python3 # Python Program explaining # min() method # loading decimal library fro 2 min read Python | sympy.Integer() method With the help of sympy.Integer() method, we can convert the floating point to integer values and this method very efficient in term of memory if we want to save integer value. Syntax : sympy.Integer() Return : Return integer value. Example #1 : In this example we can see that by using sympy.Integer( 1 min read Python | Decimal normalize() method Decimal#normalize() : normalize() is a Decimal class method which returns the simplest form of the Decimal value. Syntax: Decimal.normalize() Parameter: Decimal values Return: the simplest form of the Decimal value. Code #1 : Example for normalize() method Python3 # Python Program explaining # norma 2 min read Python | Decimal is_normal() method Decimal#is_normal() : is_normal() is a Decimal class method which checks whether the Decimal value is a normal finite number. Syntax: Decimal.is_normal() Parameter: Decimal values Return: true - if the Decimal value is a normal finite number; otherwise false Code #1 : Example for is_normal() method 2 min read Python | Decimal ln() method Decimal#ln() : ln() is a Decimal class method which returns the natural (base e) logarithm of the Decimal value. Syntax: Decimal.ln() Parameter: Decimal values Return: the natural (base e) logarithm of the Decimal value. Code #1 : Example for ln() method Python3 # Python Program explaining # ln() me 2 min read Python | Decimal is_nan() method Decimal#is_nan() : is_nan() is a Decimal class method which checks whether the Decimal value is NaN value. Syntax: Decimal.is_nan() Parameter: Decimal values Return: true - if the Decimal value is NaN value; otherwise false Code #1 : Example for is_nan() method Python3 # Python Program explaining # 2 min read Python | Decimal exp() method Decimal#exp() : exp() is a Decimal class method which returns the value of the (natural) exponential function e**x at the given number Syntax: Decimal.exp() Parameter: Decimal values Return: the value of the (natural) exponential function e**x at the given number Code #1 : Example for exp() method P 2 min read Python | Decimal max() method Decimal#max() : max() is a Decimal class method which compares the two Decimal values and return the max of two. Syntax: Decimal.max() Parameter: Decimal values Return: the max of two. Code #1 : Example for max() method Python3 # Python Program explaining # max() method # loading decimal library fro 2 min read Python | Decimal sqrt() method Decimal#sqrt() : sqrt() is a Decimal class method which returns the Square root of a non-negative number to context precision. Syntax: Decimal.sqrt() Parameter: Decimal values Return: the Square root of a non-negative number to context precision. Code #1 : Example for sqrt() method Python3 # Python 2 min read Python | Decimal logb() method Decimal#logb() : logb() is a Decimal class method which returns the adjusted exponent of the Decimal value. Syntax: Decimal.logb() Parameter: Decimal values Return: the adjusted exponent of the Decimal value. Code #1 : Example for logb() method Python3 # Python Program explaining # logb() method # l 2 min read Like