2

Is there a simple way to produce a smooth repetitive oscillation, using just basic arithmetic expressions, without trig functions, powers, square roots, etc.?

The numbers don't have to mean anything or approximate anything, it should just plot to something wavy.

I've spent lots of time searching but can only find things like the Taylor series, Bézier curves, etc. which are fairly complex because they're trying to calculate something in particular rather than just produce something curvy.

Thanks for your help.

3 Answers3

3

$$(x\bmod 1)(1-(x\bmod 1))(-1)^{\lfloor x\rfloor}.$$ You cannot spare the modulo.

enter image description here

Note that this is a quadratic Bezier curve.

3

If the floor function bothers you, you can use $$ (x\%2)*(x\%2\, - \,1)*(x\%2\, - \,2) $$ Here $x\%2$ denotes $x$ mod 2. This is a string of cubic (Bezier) curves.

enter image description here

bubba
  • 44,617
  • Cool. ObWolf: https://www.wolframalpha.com/input/?i=plot:+(x+mod+2)%E2%88%97((x+mod+2)+%E2%88%92+1)%E2%88%97((x+mod+2)+%E2%88%92+2) – DenverCoder9 Mar 12 '17 at 16:12
1

Chebyshev polynomials of the first kind wiggle up and down nicely. There are some pictures on the Wikipedia page.

They only require multiplication and addition.

If you want more wiggles, you can either increase the degree or string together several functions of lower degree.

If you want infinite wiggles that go on forever, you can construct periodic versions of the Chebyshev polynomials by using the mod function.

See also this question.

bubba
  • 44,617