numpy.sort_complex() is used to sort a complex array. It sorts the array using the real part first and then the imaginary part.
Syntax: numpy.sort_complex (arr)
arr: [array_like] Input array.
Return: [complex ndarray] A sorted complex array. p>
Code # 1:
Input array: [2, 8, 7, 5, 9] Output sorted array: [2. + 0.j 5. + 0.j 7. + 0.j 8. + 0.j 9. + 0.j]
Code no. 2:
Input array: [(2 + 4j), (5 + 9j), (3-2j), (4-3j), (3 + 5j), (2-4j), 5] Output sorted array: [2.-4.j 2. + 4.j 3.- 2.j 3. + 5.j 4.-3.j 5. + 0.j 5. + 9.j]
This encyclopedia will be an indispensable resource for our time as it reflects the fact that we are currently living in an expanding data-driven world. ...
Systems programming provides the basis for global calculation. Developing performance-sensitive code requires a programming language that allows programmers to control the use of memory, processor tim...
Python Workout isn’t designed to teach you Python, although I hope and expect that you’ll learn quite a bit along the way. It is meant to help you improve your understand- ing of Python and how to...
Python for Programmers: with Big Data and Artificial Intelligence Case Studies This book, written for programmers with a high-level experience in another language, uses how-to instructions to teach...