Computer Science, asked by raavimounisha5, 5 hours ago

1
Lamb
How do you obtain the real and imaginary parts of a complex number "p" as separate?
Select one:
a. real(p), imag(p)
O b. p.real(), p.imag()
O c. p.real(O),p.imag(0)
O d. p.real, p.imag
You are logged in as MOUNISHA RAAVI (Logout)​

Answers

Answered by VineetaGara
0

The correct answer is option b. (p.real(), p.imag()

  • To obtain the real and imaginary parts of a complex number "p" as separate, we use p.real() and p.imag() functions in Python.
  • While, we work with complex numbers, sometimes we need to divide the imaginary and real part s from the number, so that we can perform operations based on mathematics.
  • For ex., We might need to multiply a complex integer by a scalar or add two complex numbers together. Python's real() and imag() methods are used to do this. In Python, complex numbers are denoted by the notation "a + bj" or "a + bj," where "a" denotes the real component and "b" denotes the imaginary part.
  • The real() and imag() functions, respectively, return the real and imaginary halves of the complex number.
  • For instance, using the real() and imag() functions, we may separate the real and imaginary components of the complex number p = 3 + 4j as follows:

real_part = p.real() # returns 3

imag_part = p.imag() # returns 4

  • With these values, we may now conduct mathematical operations individually on the real and imaginary parts of the complex number.

#SPJ1

Similar questions