## numpy.dot()

Numpy.dot() function Is it a tool that is responsible for returning the dot equivalent product for two different areas that had been entered by the user. In the case of a one-dimensional array, the function returns the inner product with respect to the adjudicating vectors. On the contrary, for two-dimensional arrays, the function returns the value which is equal to the resultant output returned on the multiplication of two arrays. Assuming the coder is not aware of the dimensions of the array (in case the address entered by the user) the output is equivalent to the sum-product derivative of the 2nd last axis of an array ‘b1’ and last access of the first array ‘a1’.

## Syntax for NumPy.dot()

The following sentence is used for the functional operation of Numpy.dot() in a python programming language:

numpy *. * dot * (a, * * b *, * * * out * = * None *) * * * * * * * * * * * * * * *

The function is responsible for returning the dot-product of arrays while keeping the following projections in perspective:

• For a 1-D array, the function returns the inner product with respect to the adjudicating vectors
• In the case of a 2-D array, the function returns the value which is equal to the resultant output returned on the multiplication of two arrays.
• In case, the arrays are dimensionless or 0-D (i.e., scalar entities) the resultant output is the sum-product of the last axis
• In the case of N-D arrays, where the users are not aware of the dimensions of the array, the output is equivalent to the sum-product derivative of the 2nd last axis of an array ‘b1’ and last access of the first array ‘a1’.

The format of syntax in such condition would be:

Numpy *.* dot * (a1 *, * b1 *) * [i1 *, * j1, * k1, * m1] * * * = * * * sum * (* a1 * [* i1 *, * j1,:] * * * * b1[k1 *,:,m1)

## Examples of Using Numpy.dot()

Below are the examples:

## # Program which illustrates using NuPy.dot() in python language

```import numpy as n1
# Code written for Scalar Values entered by the user
output1 = n1.dot(50, 40)
print("The output generated for dot-product of the provided values (scalar) is  : ", output1)
# Code for 1D array
v_a1 = 20 + 30j
v_b1 = 40 + 50j
output2 = n1.dot(v_a1, v_b1)
print("The output generated for dot-product of the provided values (single dimensional values) is  : ", output2)
```

## # Program which illustrates using NuPy.dot() in python language

### # Code for 2-D array

```import numpy as n1
v_a1 = n1.array([[10, 40], [50, 60]])
v_b1 = n1.array([[20, 40], [50, 20]])
ans1 = n1.dot(v_a1, v_b1)
print("The output generated for dot-product of the provided values (two dimensional array A and B) is: \n", ans1 )
ans2 = n1.dot(v_b1, v_a1)
print("The output generated for dot-product of the provided values (two dimensional array B and A) is: \n", ans2 )
```

Apply now for Advanced Python Training Course