On Fri, 28 Aug 2009, brandt@subnet.at wrote:
how is it possible to calculate with imaginary numbers in PD besides the fft stuff.
basically, if you know that something is an imaginary number, you can use a real number in its place and just remember to multiply by square root of -1 in your head.
but if you want to combine real and imaginary numbers, then you need complex numbers, each of which is a real and an imaginary number.
let i be sqrt(-1)... then let's say you have two complex numbers, a+bi, c+di, as four floats. the sum is (a+c)+(b+d)i, that is you add the real parts together, and add the imaginary parts together. From this, you can guess how to subtract. The product formula is (a*c-b*d)+(a*d+b*c)i, which you can often see in Miller's FFT patches as a cluster of four [*~].
You can find more such formulas on Wikipedia, PlanetMath, MathWorld, or other, but if you can't find one or have trouble getting one to work, ask pd-list again.
Abstractions could have been made for some of these, especially *, /, exp, log, but I don't think any such library exists. GridFlow provides those operations as an external if you need something fast.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801