[PD] is this a spectral gate?

Charles Henry czhenry at gmail.com
Fri Feb 23 01:40:53 CET 2007

>   When should you use rectangular notation and when should you use
>   polar?
Addition vs. Multiplication, of course

Addition must be done in rectangular coordinates
a+bi + c+di=(a+c) + (b+d)i
which we cannot do in polar coordinates, we have to convert back to rect. coords

Multiplication is simpler in polar coordinates
(a+bi) * (c+di)=(a*c-b*d) + (a*d+b*c)i
vs. polar coordinates:
r1*e^(a*i) * r2*e^(b*i)=r1*r2*e^((a+b)*i)
it's simpler in polar coordinates--requires fewer calculations

>   Rectangular notation is usually the best choice for
>   calculations, such as in equations and computer programs.

This is also true for the FFT.  FFT is just a convenient factorization
of the fourier transform, that speeds up computations from O(N^2) to
O(N*log(N)).  The fourier transform consists of multiplying and adding
complex numbers (a complex valued matrix equation), so the numbers
should be kept in rect. form for the sake of doing addition.

Plus, of course, we have no native data types in C for doing complex
multiplication.  Fortran is another thing; it even works with complex
vectors.  In C, you have to write the loop and write the whole
equation for doing complex multiplication.  In fortran, you just say
x*y.  Multiply this matrix, A*b....Fortran says, yes, sir.  (Fortran
90, at least, not sure about Fortran 77)

It is nearly pointless to convert to polar coordinates just for the
sake of doing multiplication, unless you have a lot of things you want
to multiply.
I think we should have some simple abstractions to do the simple
operations for complex multiplication, division, conjugate, addition,
subtraction, probably several more.  I don't know why I haven't done
it yet.  *Every single time I have to do one of the butterfly
calculations on a pair of fft's, I have to write it down on paper
first.*  :)

I agree that the polar form is easier to read, and the multiplication
of two complex numbers shows very clearly what happens.  The
amplitudes multiply, and the phases add.


More information about the Pd-list mailing list