Go 复数上的离散积分产生错误的结果

Go 复数上的离散积分产生错误的结果,go,Go,我目前正在尝试实现复数上的离散积分,以实现复数傅里叶变换。 然而,我在go中实现的结果是错误的 以下是我的实现: n = input() //It is a function argument cumulativeValue := 0 + 0i currentTime := 0.00 const deltaTime = 0.001 const precision = 0.0001 for cmpFloat(currentTime, 1.00, precision) < 0 { c

我目前正在尝试实现复数上的离散积分,以实现复数傅里叶变换。
然而,我在go中实现的结果是错误的

以下是我的实现:

n = input() //It is a function argument
cumulativeValue := 0 + 0i
currentTime := 0.00
const deltaTime = 0.001
const precision = 0.0001
for cmpFloat(currentTime, 1.00, precision) < 0 {

    currentPoint := findPointForTime(currentTime)
    cumulativeValue += complex(float64(currentPoint.X), float64(currentPoint.Y)) * cmplx.Exp(complex(0.0, -2.0*math.Pi*float64(n)*currentTime))

    currentTime += deltaTime
}

cumulativeValue *= deltaTime

你在沿着什么路径集成什么函数?我认为你的代码不可能是正确的——你要求和的项应该取决于deltaTime。在你的问题中,你能用文字描述一下你是如何执行集成的吗?你在python代码中使用了128位的值吗?如果没有,则很可能在go代码中存在另一个bug,或者它与pyton实现不同。也许还可以发布pyton密码?@PaulHankin我编辑了我的帖子来回答你的问题comments@BurakSerdar第二次编辑回答了您的问题