Pretty squiggles

Here’s an image that came out of something I was working on this morning. I thought it might make an interesting border somewhere.

The blue line is sin(x), the green line 0.7 sin(φ x), and the red line is their sum. Here φ is the golden ratio (1 + √5)/2. Even though the blue and green curves are both periodic, their sum is not because the ratio of their frequencies is irrational. So you could make this image as long as you’d like and the red curve would never exactly repeat.

Tagged with:
Posted in Graphics
12 comments on “Pretty squiggles
  1. Nemo says:

    Little known fact: If you play the red curve through speakers you will hear the voice of God

  2. I. J. Kennedy says:

    Very interesting although I can’t say the “border” appeals to me aesthetically.
    A few other perhaps surprising facts about sums of periodic functions:

    (a) The sum of two periodic functions can be a periodic function with a frequency higher than both constituents.

    (b) It is possible to write the function f(x) = x as the sum of two periodic functions.

    (c) It is impossible to write x² as the sum of two periodic functions.

  3. @IJ (a) seems straight forward but (b) is blowing my mind a little. I assume the periodic functions aren’t continuous?

  4. I. J. Kennedy says:

    @Steven, that’s right. In fact, the functions are so strange you need the Axiom of Choice to assert their existence.

  5. Nemo says:

    Do you have a reference? It seems to me any periodic function defined everywhere must be bounded, and the sum of two bounded functions must be bounded… What am I missing?

  6. I. J. Kennedy says:

    I don’t have a solid reference handy but take a look here:

  7. Adriano Mitre says:

    As far as I know, the fact that actual computers have finite precision implies that the ratio of the constituents frequency will be rational, given that each frequency will be a multiple of some negative power of two or ten. Therefore, their sum will in fact be periodic. Irrational numbers can only be represented symbolically in computers.

  8. Chris Taylor says:

    @I. J. Kennedy, what is it that means you can write f(x) = x as the sum of two periodic functions, but not f(x) = x²? Is it to do with x being uniformly continuous but x² not?

    @John D. Cook, presumably the red line comes arbitrarily close to being periodic, in some sense, in the same way that rational combinations of 1 and sqrt(2) can come arbitrarily close to being rational?

  9. I feel like I should be able to figure this out by myself, but just to confirm — when you say “the curve will never exactly repeat,” are you simply saying it’s not (globally) periodic, or that there exists no two non-empty intervals that match exactly?

  10. The math is beyond me (as are most of the other comments here!) but I attempted to implement a SAS-language version of the squiggles. Thanks for the fun exercise — and let me know if I’ve got it wrong.

  11. Jandos Jayikbaev says:

    If f and g are non-constant continuous periodic functions then f+g is periodic iff the ratio of principal periods of f and g is a rational number.



1 Pings/Trackbacks for "Pretty squiggles"
  1. [...] provided that the natural frequency ω0 is not equal to the driving frequency ω. This says that the general solution is the sum of two periodic functions, one with the natural frequency ω0 and one with the frequency of the driving force ω. In general, the sum of two periodic functions can be fairly complicated, and not necessarily periodic. More on that here. [...]