numpy.reciprocal(x, /, out=None, *, where=True)
The numpy.reciprocal()
function takes the following parameter values.
x
: This represents input array and is a required parameter.out
: This represents the location where the result is stored and is an optional parameter. where
: This is the condition over which the input is being broadcast. The resulting array will be set to the ufunc
result at a given location where this condition is True
. Otherwise, the resulting array will retain its original value. This is an optional parameter.**kwargs
: This represents other keyword arguments and is an optional parameter.import numpy as np# creating an arrayx = np.array([0.5, 1, 2])# implementing the numpy.reciprocal() functionmyarray = np.reciprocal(x)print(myarray)
numpy
module.x
using the array()
method.np.reciprocal()
function on the array. The result is assigned to a variable, myarray
.myarray
variable.