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

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

Popular Tags

python x 4429
android x 1590
java x 1475
javascript x 1383
c x 903
c++ x 828
ruby-on-rails x 679
php x 678
python3 x 651
html x 631

© 2022 OneMinuteCode. All rights reserved.