Recall & Review
beginner
What is a complex number in numpy?
A complex number in numpy has a real part and an imaginary part. It is represented as
a + bj, where a is the real part and b is the imaginary part.Click to reveal answer
beginner
How do you create a complex number array in numpy?
You can create a complex number array using
numpy.array with complex values, for example: np.array([1+2j, 3+4j]).Click to reveal answer
intermediate
What numpy data types represent complex numbers?
Numpy uses
complex64 and complex128 to represent complex numbers. complex64 uses 32 bits for real and 32 bits for imaginary parts, while complex128 uses 64 bits for real and 64 bits for imaginary parts.Click to reveal answer
beginner
How can you access the real and imaginary parts of a numpy complex array?
Use the
.real attribute to get the real parts and .imag attribute to get the imaginary parts of a numpy complex array.Click to reveal answer
intermediate
Why are complex numbers useful in data science?
Complex numbers help in fields like signal processing, quantum computing, and electrical engineering where data has both magnitude and phase information.
Click to reveal answer
Which numpy data type is used for complex numbers with 64-bit real and imaginary parts?
✗ Incorrect
complex128 uses 64 bits for both real and imaginary parts.
How do you get the imaginary part of a numpy complex array named
z?✗ Incorrect
The correct attribute to access the imaginary part is
.imag.What does the complex number
3 + 4j represent?✗ Incorrect
In
a + bj, a is real and b is imaginary.Which numpy function can create an array of complex numbers?
✗ Incorrect
You create complex arrays using
np.array with complex values.Why might data scientists use complex numbers?
✗ Incorrect
Complex numbers represent data with both magnitude and phase, useful in many scientific fields.
Explain how to create and access parts of a complex number array in numpy.
Think about how you write complex numbers and how numpy stores them.
You got /4 concepts.
Describe the difference between complex64 and complex128 in numpy.
Consider how many bits are used for each part.
You got /4 concepts.