Prev: dict's as dict's key.
Next: enhancing 'list'
From: Steve Holden on 15 Jan 2010 09:44 r0g wrote: > Alf P. Steinbach wrote: >> But maybe you're simply not able to understand the algorithm, trivial as >> it is. >> >> So, a Python implementation (note, this program takes some time to run!): >> >> >> <code filename="sinewave_from_squares.py"> >> # Generating a sine wave as a sum of square waves of various amplitudes > > > Pwned! Good one Alf :) > > I think those guys owe you an apology really, but I wouldn't hold your > breath! > Well as you can now see at least one of "those guys" doesn't mind admitting (and apologizing) when he is wrong. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/
From: Grant Edwards on 15 Jan 2010 10:37 On 2010-01-15, Steve Holden <steve(a)holdenweb.com> wrote: > I will, however, observe that your definition of a square wave is what I > would have to call a "'square' wave" (and would prefer to call a "pulse > train"), as I envisage a square wave as a waveform having a 50% duty > cycle, as in > > ___ ___ > | | | | > | | | | > | | | | > +---+---+---+---+ and so on ad infinitum, (though I might allow you > | | | | to adjust the position > | | | | of y=0 if you want) > |___| |___| That is a square wave. > as opposed to your > > _ > | | > | | > ______| |______ ______ > | | > | | > |_| That isn't. Arguing to the contrary is just being Humpty Dumpty... > Or, best of all, you could show me how to synthesize any > waveform by adding square waves with a 50% duty cycle. Then I > *will* be impressed. Isn't that what he claimed? He said that his algorithm for summing square waves demonstrated the converse of the ability to construct a periodic function (like a square wave) from a sine-cosine summation. -- Grant Edwards grante Yow! On the road, ZIPPY at is a pinhead without a visi.com purpose, but never without a POINT.
From: r0g on 15 Jan 2010 11:30 Steve Holden wrote: > r0g wrote: <snip> >> I think those guys owe you an apology really, but I wouldn't hold your >> breath! >> > Well as you can now see at least one of "those guys" doesn't mind > admitting (and apologizing) when he is wrong. > > regards > Steve I stand corrected, fair play sir :) Roger.
From: Alf P. Steinbach on 15 Jan 2010 20:33 * Steve Holden: > > For the record, yes, summing any waveforms that can be represented as > Fourier Series will necessarily result in another Fourier series, since > any linear combination of Fourier series must itself, be a Fourier > series, and therefore the representation of the sum of the summed waveforms. As it is I do not know whether the above represents what I've written, or might perhaps be /misprepresenting/ the conclusions of this thread. If I knew a lot more about Fourier series (it's been a long time since college! lots forgotten) I might agree or disagree with the above as it applies to constructing a sine wave from square waves. I just note that representing a sine wave as square waves, forming it from square waves, in the practical sense works (demonstrated here), even though it's totally impractical :-), but just in answer to your original question. And I note that in the mathematematical sense when n goes to infinity and vanishingly thin pulses result from sums of square waves, like *impulse* waves, then one is over in some regime where it is not at all clear to me that it is valid to talk about Fourier series any more. Perhaps it's valid if the term "Fourier series" does not necessarily imply sum of sine waves. I don't know. I'm guessing that applying the Fourier series view for that is like actually dividing by zero to maintain the running product of a collection of numbers when an instance of 0 is removed from the collection. It's no practical problem to maintain a running product (for programmers it's interesting to note that polar representation complex numbers can do the job), and it's well-defined also mathematically, with any /reasonable/ approach. But the simple-minded direct way, just dividing the current product by the number removed from the collection, is then invalid. And some people might take that limited applicability of the direct simple way as evidence that it's impossible to remove numbers, failing to see any of the trivial practical solutions. ;-) Cheers, - Alf
From: Alf P. Steinbach on 16 Jan 2010 01:26
* Grant Edwards: > On 2010-01-15, Steve Holden <steve(a)holdenweb.com> wrote: > >> I will, however, observe that your definition of a square wave is what I >> would have to call a "'square' wave" (and would prefer to call a "pulse >> train"), as I envisage a square wave as a waveform having a 50% duty >> cycle, as in >> >> ___ ___ >> | | | | >> | | | | >> | | | | >> +---+---+---+---+ and so on ad infinitum, (though I might allow you >> | | | | to adjust the position >> | | | | of y=0 if you want) >> |___| |___| > > That is a square wave. > >> as opposed to your >> >> _ >> | | >> | | >> ______| |______ ______ >> | | >> | | >> |_| > > That isn't. > > Arguing to the contrary is just being Humpty Dumpty... Neither I nor Steve has called that latter wave a square wave. Steve, quoted above, has written that I defined a square wave that way. I have not. So Steve's statement is a misrepresentation (I described it as a sum of two square waves, which it is), whatever the reason for that misrepresentation. >> Or, best of all, you could show me how to synthesize any >> waveform by adding square waves with a 50% duty cycle. Then I >> *will* be impressed. > > Isn't that what he claimed? He said that his algorithm for > summing square waves demonstrated the converse of the ability > to construct a periodic function (like a square wave) from a > sine-cosine summation. Not by itself, no: it just synthesizes a sine. For the more general case read e.g. the PS in my reply to your earlier (single) article in this thread. For information about what the algorithm does, what you refer to as a "claim" (but note that a Python implementation has been posted to this thread, and that it works, and that besides the algorithm is trivial so that "claim" is a rather meaningless word here), read the article that you then responded to. Cheers & hth., - Alf |