What are the "-" and "j" of "-9.96587885e+03j" with the number 1.54991569e+03-9.96587885e+03j?

Asked 2 years ago, Updated 2 years ago, 71 views

When I ran scipy.ftpack.ft(y), one of the returned values had the following numbers:

1.54991569e+03-9.96587885e+03j

I understand that "e+03" means the third power of 10, but

-9.96587885e+03j

What are '-' and 'j' in ?

python mathematics

2022-09-30 11:18

1 Answers

This is a complex number, in the form of a+bj, where j is an imaginary unit. 1.54991569e+03-9.96587885e+03j is a complex number with a real part of 1.54991569e+03 and an empty part of -9.96587885e+03.

The imaginary units used in high school mathematics in Japan are often written in i, but in some fields, j is used. Python is supposed to treat literal in the form of a+bj as complex numbers.

https://docs.python.org/ja/3/library/stdtypes.html#typesnumeric

If you add 'j' or 'J' to the numeric literal, you can give an imaginary number (a complex number with zero real parts) and add an integer or floating point number to it to obtain a complex number with real and imaginary parts.

The scipy.ftpack.ft document also states that this function returns ndarray as a complex number element.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.fft.html

Returns z:complex ndarray


2022-09-30 11:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.