简体   繁体   English

如何在python中获得带有虚数的指数

[英]How to get exponent with imaginary number in python

I am doing fft shift and I got 我正在做班次换班

p = p =

How to get constant d if I know all other variables? 如果我知道所有其他变量,如何获得常数d? I tried to use math.log1p but it keeps giving me "Casting complex values to real discards the imaginary part". 我尝试使用math.log1p,但是它一直给我“将复杂值投射为实数会丢弃虚部”。

I get p = 0.0656073874479-0.399102149653j , it can be represented as formula above where N = 20000 , k = 1 . 我得到p = 0.0656073874479-0.399102149653j ,它可以表示为上面的公式,其中N = 20000k = 1

I want to calculate what d is. 我想计算d是多少。

您应该使用cmath来获取复杂对数的某些分支:

cmath.log(p)*N/(-2*cmath.pi*1j*k)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM