I repeatedly come across objections to using complex numbers for DSP. I wonder if there is a good way that I can explain without struggling? The current case concerns ultrasound, where the measurement is of pressure (on a transducer). My processing uses complex numbers, which naturally arise when I demodulate the signal. The question I am asked is, why are complex numbers necessary when the signal itself seems to be real-valued? My answer (one of them) is that the signal is modelled using complex exponentials (Fourier analysis) and so this is the natural way to handle those quantities. But often, a measurement of 'amplitude' (instantaneous, real-valued, pressure) is desired, and this seems to be a real-valued quantity. My argument here is that this is modelled as the sum of two complex exponentials, contra-rotating (one with +ve and one with -ve frequency), to produce a resultant that happens to have zero imaginary part. So far so clear. But we can also derive Foruier transforms that are based on sums of sine and cosine functions - each of which seem to be real-valued quantities, and so this bypasses the complex implementation. My argument here is that this is the same as complex numbers, only in a different form where the complex arithmetic is done explicitly by the way the sine and cosine terms are added and multiplied, and where amplitude/phase replace real/imaginary in a different arithmetic. But my current disputee convincingly suggests that the complex representation is therefore unnecessary. Two questions: 1) am I correct in saying that the sine+cosine transform simply duplicates complex arithmetic by inventing a sort of phase/amplitude arithmetic? 2) is there a simple and convincing argument to explain this if it is the case? One further issue. If I am interested in 'amplitude', then for example if I average two numbers of equal amplitude and opposite phase, then if I use a complex representation the 'average' amplitude is zero, whereas if I average only their amplitudes then the average is equal to either of the original amplitudes. Clearly the second case is not the same measure as the first, but is there an easy explanation as to why and what it measures? Thanks, Chris ===================== Chris Bore BORES Signal Processing www.bores.com

# Complex versus real numbers

Started by ●August 25, 2009

Posted by ●August 25, 2009

On 25 Aug, 14:28, Chris Bore <chris.b...@gmail.com> wrote:> I repeatedly come across objections to using complex numbers for DSP. > I wonder if there is a good way that I can explain without struggling?One argument that ought to be decisive is that 99.98% of all literature on DSP uses complex arithemtic. If your clients want you to do things differently, they will have to pay you to rewrite the standard literature.> The current case concerns ultrasound, where the measurement is of > pressure (on a transducer). My processing uses complex numbers, which > naturally arise when I demodulate the signal. The question I am asked > is, why are complex numbers necessary when the signal itself seems to > be real-valued?They are not *necessary*, but they are *convenient*. Once you sample the sensors, you no longer have *physical* data (which are constrained by nature to be real-valued); you have *numbers*. Numbers aren't physical entities, they are mathematical entities. So you can do whatever you like, within the constraints of *maths*.> My answer (one of them) is that the signal is modelled using complex > exponentials (Fourier analysis) and so this is the natural way to > handle those quantities. But often, a measurement of > 'amplitude' (instantaneous, real-valued, pressure) is desired, and > this seems to be a real-valued quantity.No, it isn't. It's a *mathemathically* derived quantity. The *physical* measurement might be a modulated pulse. In that case, the *physics* show lots of zero crossings inside the wavelet. That's the physics. You want to crunch the *numbers* to produce an envelope value (amplitude) for the sime instance where a zero-crossing occurs.> My argument here is that this > is modelled as the sum of two complex exponentials, contra-rotating > (one with +ve and one with -ve frequency), to produce a resultant that > happens to have zero imaginary part. > > So far so clear. But we can also derive Foruier transforms that are > based on sums of sine and cosine functions - each of which seem to be > real-valued quantities, and so this bypasses the complex > implementation. My argument here is that this is the same as complex > numbers, only in a different form where the complex arithmetic is done > explicitly by the way the sine and cosine terms are added and > multiplied, and where amplitude/phase replace real/imaginary in a > different arithmetic. But my current disputee convincingly suggests > that the complex representation is therefore unnecessary. > > Two questions: > > 1) am I correct in saying that the sine+cosine transform simply > duplicates complex arithmetic by inventing a sort of phase/amplitude > arithmetic?Yes. You can connect the two representations through manipulating Euler's relations. The benefit of complex arithmetic is that it is far simpler than the sine+cosine form. Pull out a standard formula collection and compare the product between two arbitrary sinusoidals on sine+cosine form and y = A_1*A_2*exp(j(w_1+w_2)) Or use as example some other operation you find to be more relevant to your disputee.> 2) is there a simple and convincing argument to explain this if it is > the case?That the forms are equivalent? It would be Euler's relations, cos(x) = 1/2 (exp(jx)+exp(-jx)) sin(x) = 1/j2 (exp(jx)-exp(-jx)) (maybe I got the signs wrong.)> One further issue. If I am interested in 'amplitude', then for example > if I average two numbers of equal amplitude and opposite phase, then > if I use a complex representation the 'average' amplitude is zero, > whereas if I average only their amplitudes then the average is equal > to either of the original amplitudes. Clearly the second case is not > the same measure as the first, but is there an easy explanation as to > why and what it measures?If you average the signals straight off, phase becomes important, as you have discovered. If you want general characteristics for different realizations of the data, use something like the power spectrum. Rune

Posted by ●August 25, 2009

On Aug 25, 1:49�pm, Rune Allnor <all...@tele.ntnu.no> wrote:> On 25 Aug, 14:28, Chris Bore <chris.b...@gmail.com> wrote: > > > I repeatedly come across objections to using complex numbers for DSP. > > I wonder if there is a good way that I can explain without struggling? > > One argument that ought to be decisive is that 99.98% of all > literature on DSP uses complex arithemtic. If your clients > want you to do things differently, they will have to pay you > to rewrite the standard literature. > > > The current case concerns ultrasound, where the measurement is of > > pressure (on a transducer). My processing uses complex numbers, which > > naturally arise when I demodulate the signal. The question I am asked > > is, why are complex numbers necessary when the signal itself seems to > > be real-valued? > > They are not *necessary*, but they are *convenient*. Once you > sample the sensors, you no longer have *physical* data (which > are constrained by nature to be real-valued); you have *numbers*. > Numbers aren't physical entities, they are mathematical entities. > So you can do whatever you like, within the constraints of > *maths*. > > > My answer (one of them) is that the signal is modelled using complex > > exponentials (Fourier analysis) and so this is the natural way to > > handle those quantities. But often, a measurement of > > 'amplitude' (instantaneous, real-valued, pressure) is desired, and > > this seems to be a real-valued quantity. > > No, it isn't. It's a *mathemathically* derived quantity. > The *physical* measurement might be a modulated pulse. In > that case, the *physics* show lots of zero crossings inside > the wavelet. That's the physics. > > You want to crunch the *numbers* to produce an envelope > value (amplitude) for the sime instance where a zero-crossing > occurs. > > > > > > > My argument here is that this > > is modelled as the sum of two complex exponentials, contra-rotating > > (one with +ve and one with -ve frequency), to produce a resultant that > > happens to have zero imaginary part. > > > So far so clear. But we can also derive Foruier transforms that are > > based on sums of sine and cosine functions - each of which seem to be > > real-valued quantities, and so this bypasses the complex > > implementation. My argument here is that this is the same as complex > > numbers, only in a different form where the complex arithmetic is done > > explicitly by the way the sine and cosine terms are added and > > multiplied, and where amplitude/phase replace real/imaginary in a > > different arithmetic. But my current disputee convincingly suggests > > that the complex representation is therefore unnecessary. > > > Two questions: > > > 1) am I correct in saying that the sine+cosine transform simply > > duplicates complex arithmetic by inventing a sort of phase/amplitude > > arithmetic? > > Yes. You can connect the two representations through > manipulating Euler's relations. The benefit of complex > arithmetic is that it is far simpler than the sine+cosine > form. Pull out a standard formula collection and compare > the product between two arbitrary sinusoidals on sine+cosine > form and > > y = A_1*A_2*exp(j(w_1+w_2)) > > Or use as example some other operation you find to be more > relevant to your disputee. > > > 2) is there a simple and convincing argument to explain this if it is > > the case? > > That the forms are equivalent? It would be Euler's > relations, > > cos(x) = 1/2 �(exp(jx)+exp(-jx)) > sin(x) = 1/j2 (exp(jx)-exp(-jx)) > > (maybe I got the signs wrong.) > > > One further issue. If I am interested in 'amplitude', then for example > > if I average two numbers of equal amplitude and opposite phase, then > > if I use a complex representation the 'average' amplitude is zero, > > whereas if I average only their amplitudes then the average is equal > > to either of the original amplitudes. Clearly the second case is not > > the same measure as the first, but is there an easy explanation as to > > why and what it measures? > > If you average the signals straight off, phase becomes > important, as you have discovered. If you want general > characteristics for different realizations of the data, > use something like the power spectrum. > > Rune- Hide quoted text - > > - Show quoted text -Thanks, that is really helpful. :-)

Posted by ●August 25, 2009

Chris Bore <chris.bore@gmail.com> writes:> I repeatedly come across objections to using complex numbers for DSP. > I wonder if there is a good way that I can explain without struggling? > [...]Hi Chris, I find your inquiry very interesting. From the point of view of algebraic number systems (groups, rings, fields, etc.), the complex numbers are not merely "convenient" but *required*. The well-known example that illustrates this is that, without it, we cannot find all roots of algebraic equations with coefficients over the real numbers. I know this flies in the face (contradicts) what some people here say, since they think it's a convenience, but I say otherwise. -- Randy Yates % "Though you ride on the wheels of tomorrow, Digital Signal Labs % you still wander the fields of your mailto://yates@ieee.org % sorrow." http://www.digitalsignallabs.com % '21st Century Man', *Time*, ELO

Posted by ●August 25, 2009

Chris Bore wrote:> I repeatedly come across objections to using complex numbers for DSP. > I wonder if there is a good way that I can explain without struggling? > > The current case concerns ultrasound, where the measurement is of > pressure (on a transducer). My processing uses complex numbers, which > naturally arise when I demodulate the signal. The question I am asked > is, why are complex numbers necessary when the signal itself seems to > be real-valued? > > My answer (one of them) is that the signal is modelled using complex > exponentials (Fourier analysis) and so this is the natural way to > handle those quantities. But often, a measurement of > 'amplitude' (instantaneous, real-valued, pressure) is desired, and > this seems to be a real-valued quantity. My argument here is that this > is modelled as the sum of two complex exponentials, contra-rotating > (one with +ve and one with -ve frequency), to produce a resultant that > happens to have zero imaginary part. > > So far so clear. But we can also derive Foruier transforms that are > based on sums of sine and cosine functions - each of which seem to be > real-valued quantities, and so this bypasses the complex > implementation. My argument here is that this is the same as complex > numbers, only in a different form where the complex arithmetic is done > explicitly by the way the sine and cosine terms are added and > multiplied, and where amplitude/phase replace real/imaginary in a > different arithmetic. But my current disputee convincingly suggests > that the complex representation is therefore unnecessary. > > Two questions: > > 1) am I correct in saying that the sine+cosine transform simply > duplicates complex arithmetic by inventing a sort of phase/amplitude > arithmetic?I don't think so. The complex representation is mathematically equivalent to the earlier sine-cosine representation. Since it simplifies calculation, we prefer it. With de Moivre's formula, complex algebra can do everything trig can do, and more simply. With complex numbers, we trade away conceptual simplicity to gain computational simplicity.> 2) is there a simple and convincing argument to explain this if it is > the case?Contrariwise. I think complex arithmetic simply duplicates the sine/cosine representation, as I wrote above.> One further issue. If I am interested in 'amplitude', then for example > if I average two numbers of equal amplitude and opposite phase, then > if I use a complex representation the 'average' amplitude is zero, > whereas if I average only their amplitudes then the average is equal > to either of the original amplitudes. Clearly the second case is not > the same measure as the first, but is there an easy explanation as to > why and what it measures?I don't think you mean amplitude in the strict sense. Given a sinusoid f(t) = A*cos(wt + phi), A is the amplitude (usually assumed positive) at all times. I think you mean magnitude -- not to be confused with absolute magnitude -- i.e., the value of f(t) at a particular instant. We need a better vocabulary! If the average of two values of f(t) has meaning, use it. Otherwise, define what you want accomplished. I hope this is somehow useful. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●August 25, 2009

Randy Yates wrote:> Chris Bore <chris.bore@gmail.com> writes: > >> I repeatedly come across objections to using complex numbers for DSP. >> I wonder if there is a good way that I can explain without struggling? >> [...] > > Hi Chris, > > I find your inquiry very interesting. > > From the point of view of algebraic number systems (groups, rings, > fields, etc.), the complex numbers are not merely "convenient" but > *required*. The well-known example that illustrates this is that, > without it, we cannot find all roots of algebraic equations with > coefficients over the real numbers. > > I know this flies in the face (contradicts) what some people here say, > since they think it's a convenience, but I say otherwise.Complex numbers are needed to find all the roots, but they are not needed to modulate or demodulate single-side-band signals. For that, they are merely convenient. (So convenient, that one must be a glutton for punishment to eschew them.) Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●August 25, 2009

On Aug 25, 10:01�am, Randy Yates <ya...@ieee.org> wrote:> Chris Bore <chris.b...@gmail.com> writes: > > I repeatedly come across objections to using complex numbers for DSP. > > I wonder if there is a good way that I can explain without struggling? > > [...] > > Hi Chris, > > I find your inquiry very interesting. > > From the point of view of algebraic number systems (groups, rings, > fields, etc.), the complex numbers are not merely "convenient" but > *required*. The well-known example that illustrates this is that, > without it, we cannot find all roots of algebraic equations with > coefficients over the real numbers. > > I know this flies in the face (contradicts) what some people here say, > since they think it's a convenience, but I say otherwise. > -- > Randy Yates � � � � �� � � � � �% "Though you ride on the wheels of tomorrow,> Digital Signal Labs � � � �� � �% �you still wander the fields of your> mailto://ya...@ieee.org � � � ��% �sorrow."http://www.digitalsignallabs.com% '21st Century Man', *Time*, ELO I think the problem is much simpler than some make it out to be. Basically there are a couple of questions. 1) Are complex numbers necessary - yes - some problems need them such as finding roots of polynomials. And as Paul Nahin states in his book "An Imaginary Tale, the story of the square root of minus one", complex numbers were developed for solving cubic equations. Some methods of estimating frequency involve root finding. 2) Are complex numbers useful - yes some problems are more easily solved by the use of complex numbers. The mathematician Jacques Hadamard stated "The shortest path between truths in the real domain passes through the complex domain." Think about the simplicity of manipulation afforded by analytic signals. A seemingly contradictory point (real vs complex) though comes from the field of Quantum Mechanics. QM uses as a basic tenet the idea that all observables (things that can be measured) are real valued. But QM itself uses complex valued functions. QM uses Hermitian operators which we know will always have real eigenvalues (observables). Fourier transforms exhibit Hermitian symmetry. For DSP, use what is efficient and gets the job done. Chris, I understand about your clients - if they knew how to do it, they wouldn't hire you to do it. So yeah, you will have to educate them some. Certainly cite Rune's statement that DSP litature is replete with complex variables and numbers. Clay

Posted by ●August 25, 2009

On 25 Aug, 16:01, Randy Yates <ya...@ieee.org> wrote:> Chris Bore <chris.b...@gmail.com> writes: > > I repeatedly come across objections to using complex numbers for DSP. > > I wonder if there is a good way that I can explain without struggling? > > [...] > > Hi Chris, > > I find your inquiry very interesting. > > From the point of view of algebraic number systems (groups, rings, > fields, etc.), the complex numbers are not merely "convenient" but > *required*. The well-known example that illustrates this is that, > without it, we cannot find all roots of algebraic equations with > coefficients over the real numbers.I suspect most people who know even the slightest maths world accept that the equation x^2+1 = 0 has complex roots. The question is if that is relevant at all. My impression of Chris' post is that the dispute is over manipulating sinusoidals. If so, the complex exponential notation is one of convenience, not necessity. Rune

Posted by ●August 25, 2009

On Tue, 25 Aug 2009 05:28:00 -0700, Chris Bore wrote:> I repeatedly come across objections to using complex numbers for DSP. I > wonder if there is a good way that I can explain without struggling? > > The current case concerns ultrasound, where the measurement is of > pressure (on a transducer). My processing uses complex numbers, which > naturally arise when I demodulate the signal. The question I am asked > is, why are complex numbers necessary when the signal itself seems to be > real-valued? > > My answer (one of them) is that the signal is modelled using complex > exponentials (Fourier analysis) and so this is the natural way to handle > those quantities. But often, a measurement of 'amplitude' > (instantaneous, real-valued, pressure) is desired, and this seems to be > a real-valued quantity. My argument here is that this is modelled as the > sum of two complex exponentials, contra-rotating (one with +ve and one > with -ve frequency), to produce a resultant that happens to have zero > imaginary part. > > So far so clear. But we can also derive Foruier transforms that are > based on sums of sine and cosine functions - each of which seem to be > real-valued quantities, and so this bypasses the complex implementation. > My argument here is that this is the same as complex numbers, only in a > different form where the complex arithmetic is done explicitly by the > way the sine and cosine terms are added and multiplied, and where > amplitude/phase replace real/imaginary in a different arithmetic. But my > current disputee convincingly suggests that the complex representation > is therefore unnecessary. > > Two questions: > > 1) am I correct in saying that the sine+cosine transform simply > duplicates complex arithmetic by inventing a sort of phase/amplitude > arithmetic?I'll sidestep Jerry's argument here and say that they are equivalent, i.e. each 'duplicates' the other.> 2) is there a simple and convincing argument to explain this if it is > the case?Do the math! Show that in manipulating signals using the 'inphase/ quadrature' terminology results in the same signals being multiplied by the same numbers in the same places as using the complex formulation -- then point out that the complex formulation has a ton more theory behind it to keep you on the straight and narrow, mathematically. (I like Rune's suggestion, too -- if the customer doesn't like how it's done, suggest one or two classic books in the field and give them a price to rewrite them without using complex math).> One further issue. If I am interested in 'amplitude', then for example > if I average two numbers of equal amplitude and opposite phase, then if > I use a complex representation the 'average' amplitude is zero, whereas > if I average only their amplitudes then the average is equal to either > of the original amplitudes. Clearly the second case is not the same > measure as the first, but is there an easy explanation as to why and > what it measures?I once fixed some code that 'averaged' a vector of samples by summing the amplitude of each sample and dividing by the vector size, then counting the number of minus samples, then finally negating the average magnitude if the majority of samples in the vector were negative. My version just added all the samples and divided by the vector size. Guess which one worked better? The only time it makes sense to average the amplitudes would be if you had an application where that were the quantity you were measuring -- and even then you'd have to accept the bias caused by zero-mean noise. -- http://www.wescottdesign.com

Posted by ●August 25, 2009

Clay wrote:> On Aug 25, 10:01 am, Randy Yates <ya...@ieee.org> wrote: >> Chris Bore <chris.b...@gmail.com> writes: >>> I repeatedly come across objections to using complex numbers for DSP. >>> I wonder if there is a good way that I can explain without struggling? >>> [...] >> Hi Chris, >> >> I find your inquiry very interesting. >> >> From the point of view of algebraic number systems (groups, rings, >> fields, etc.), the complex numbers are not merely "convenient" but >> *required*. The well-known example that illustrates this is that, >> without it, we cannot find all roots of algebraic equations with >> coefficients over the real numbers. >> >> I know this flies in the face (contradicts) what some people here say, >> since they think it's a convenience, but I say otherwise. >> -- >> Randy Yates % "Though you ride on the wheels of tomorrow, >> Digital Signal Labs % you still wander the fields of your >> mailto://ya...@ieee.org % sorrow."http://www.digitalsignallabs.com%'21st Century Man', *Time*, ELO> > > I think the problem is much simpler than some make it out to be. > > Basically there are a couple of questions. > > 1) Are complex numbers necessary - yes - some problems need them such > as finding roots of polynomials. And as Paul Nahin states in his book > "An Imaginary Tale, the story of the square root of minus one", > complex numbers were developed for solving cubic equations. Some > methods of estimating frequency involve root finding. > > 2) Are complex numbers useful - yes some problems are more easily > solved by the use of complex numbers. The mathematician Jacques > Hadamard stated "The shortest path between truths in the real domain > passes through the complex domain." Think about the simplicity of > manipulation afforded by analytic signals. > > A seemingly contradictory point (real vs complex) though comes from > the field of Quantum Mechanics. QM uses as a basic tenet the idea that > all observables (things that can be measured) are real valued. But QM > itself uses complex valued functions. QM uses Hermitian operators > which we know will always have real eigenvalues (observables). Fourier > transforms exhibit Hermitian symmetry. > > For DSP, use what is efficient and gets the job done. > > Chris, I understand about your clients - if they knew how to do it, > they wouldn't hire you to do it. So yeah, you will have to educate > them some. > > Certainly cite Rune's statement that DSP litature is replete with > complex variables and numbers.It's a matter of convenience of computation. To calculate sqrt(a^2+b^2) on a slide rule, experienced users calculate a/sin(atan(a/b)). That can be done by setting the slide, setting the cursor, then moving the slide once more. (The angle is read in the process.) While that's an excellent way to convert rectangular to polar (and second nature to EEs before electronic calculators), it's not a very good way to think about it. I submit that much of what we do with complex arithmetic is analogous. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������