numpy.conjugate()
methodThe numpy.conjugate()
method returns a complex conjugate of an input array that is passed to it. This is done element by element.
Note: In Python, we can use a list of lists to create a two-dimensional (2-D) array.
numpy.conjugate(arr, /, out=None, *, where=True,)
arr1
: This represents the input array.out
: This optional parameter specifies the location where the result is saved.where
: This is an optional parameter representing the condition in which the input gets broadcasted.The method numpy.conjugate()
returns the complex element-wise conjugate of the input array passed to it.
The following code shows how to use the numpy.conjugate()
method for two-dimensional (2-D) arrays.
# import numpyimport numpy as np# create listx1 = [1+2j,1+5j,1+3j]x2 = [1+7j,1+2j,1+5j]# convert the lists to 2D array using np.arrayarr = np.array([x1,x2])# compute the complex array values# and store the result in resultresult = np.conjugate(arr)print(result)
numpy
library to the code.x1
and x2
.np.array()
method to turn the lists into a 2-D array and save the result in a new variable named arr
.np.conjugate()
method and store the result in the result
variable.