numpy.frexp(x, out1, out2, out=None, *, where=True)
x
: This is the input array of numbers to be decomposed. It is a required parameter.out1
: This is the output array for the mantissa. It must have the same shape as the input array, x
. It is an optional parameter.out2
: This is the output array for the exponent. It must have the same shape as the input array, x
. It is an optional parameter.out
: This represents the location where the result is stored. It 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. It is an optional parameter.**kwargs
: This represents other keyword arguments. It is an optional parameter.The numpy.frexp()
function returns an output array showing an array of mantissa values for each element, and another array of
import numpy as np# creating an arrayx = np.array([1, 2, 3, 4, 5])# obtaining the frexp valuesmyarray = np.frexp(x)print("Input: " , x)print("Mantissas : ", myarray[0])print("Exponents : ", myarray[1])
numpy
module.x
.numpy.frexp()
function on the array x
. We assign the result to a variable myarray
.x
to the console.myarray
to the console.