Pmlsa / Discrete-Fourier-Transform

A python implementation of the Discrete Fourier Transform.
1 stars 2 forks source link

Complex numbers are not actually complex #1

Open yiheinchai opened 5 months ago

yiheinchai commented 5 months ago
    def exp(self, x : float) -> "Eulers Formula":
        return math.cos(x) + complex(math.sin(x))

the complex class takes in two parameters, the real part and the imaginary part.

it should be instead,

    def exp(self, x : float) -> "Eulers Formula":
        return  complex(math.cos(x), math.sin(x))

given this error, i am wondering why the code still works

Pmlsa commented 5 months ago

You are correct, it should be complex(math.cos(x), math.sin(x)). The updated code should produce the correct frequency domain.