multiply(x1, x2, out=None, **kwargs)

Multiply arguments element-wise.

  • x2 (x1,) – The arrays to be multiplied. If x1.shape != x2.shape, they must be broadcastable to a common shape (which may be the shape of one or the other).

  • out (ndarray) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.


  • out (ndarray or scalar) – The difference of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.

  • .. note:: – This operator now supports automatic type promotion. The resulting type will be determined according to the following rules:

    • If both inputs are of floating number types, the output is the more precise type.

    • If only one of the inputs is floating number type, the result is that type.

    • If both inputs are of integer types (including boolean), not supported yet.


>>> np.multiply(2.0, 4.0)
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> np.multiply(x1, x2)
array([[ 0.,  1.,  4.],
       [ 0.,  4., 10.],
       [ 0.,  7., 16.]])