# What would the equation to this graph look like?

I have an equation built from obscure (step) functions, which I'd like to approximate in standard mathematical functions; it is quite lengthy and produces an odd geometric shape, which I cannot decipher:

Might someone assist me in finding an equation roughly following this shape? Many thanks.

EDIT:

By "non-obscure functions", I intended for any function built from standard operators (addition, subtraction, multiplication, division, powers) and trigonometric functions. The absolute value function may also be used, though it would be preferable if fractional part functions, sigma notation, etc. were not included - really anything seen below highschool-level precalculus.

• "in standard mathematical functions": be explicit, which functions ? Those in the original expression are quite standard, nothing obscure. – Yves Daoust May 3 '16 at 9:17
• My apologies on the vagueness of my original post! I am aware it has caused some confusion in the answers. The post has been edited. – Rocco M May 3 '16 at 16:42

The function isn't so hard to understand.

If you focus on one arch of the sinusoid $\sin(\pi x)$, for $x\in[0,1]$, it looks like a parabola such as $y=4x(1-x)$, which exactly coincides at $(0,0),(\frac12,0),(1,0)$ and slightly deviates elswhere.

The blue curve is the difference between the two, shown here with amplitude magnification.

Now the function repeats with period $1$, so that you should replace $x$ by its fractional part $x-\lfloor x\rfloor$, which we can denote $\{x\}$. Your equation is equivalent to

$$y=\frac{4\{x\}(1-\{x\})-\sin(\pi\{x\})}8$$

If you don't like the sine, you can replace the function with a quartic polynomial of similar characteristics, evaluated at $\{x\}$

$$y=\{x\}(1-\{x\})(1-2\{x\})^2.$$

• Thank you very much for the clear information! Pardon my vagueness in the original post, I have edited my definition of "non-obscure functions". I am trying to see if there is an equation built purely from trig functions, standard operators, etc. (which I've summarized in the edit as "below highschool level precalculus notation"), and so the fractional part may not be included. – Rocco M May 3 '16 at 16:48
• @RoccoM: in this case, banning the fractional part function is a pity. You can emulate it with $\arctan(\tan((x-1/2)\pi)/\pi+1/2$, but this is a total waste. – Yves Daoust May 3 '16 at 17:10

$$y(x)= -\frac{1}{8}|\sin(\pi x)| +\frac{1}{2}\left(-(x-\lfloor x\rfloor )^2 -\lfloor x\rfloor )x^2 \right) -\frac{1}{2}(x-1)x$$ On the range $0<x<1 \qquad y(x)=f(x)=-\frac{1}{8}\sin(\pi x) -\frac{1}{2}(x-1)x$

Since the function is periodic, a method to accurately approximate it is the Fourier series : $$y(x)\simeq a_0 + \sum_{k=1}^{k=n} a_k \cos(2\pi k x)$$ No need for the sin terms because the function is even.

The values of the coefficients are computed with the next integrals : $$a_0=\int_0^1 f(x)dx = \int_0^1 \left(-\frac{1}{8}\sin(\pi x) -\frac{1}{2}(x-1)x \right)dx$$ $$a_k=2\int_0^1 f(x)\cos(2\pi k x)dx =2\int_0^1 \left(-\frac{1}{8}\sin(\pi x) -\frac{1}{2}(x-1)x \right)\cos(2\pi k x)dx$$

The deviations depend on the number of terms $n$.

For example, with $n=10$ , mean absolute error = $0.000077$

The maximum error lies around the integer values of $x$.

For example with $n=10$ :

$...=y(-2)=y(-1)=y(0)=y(1)=y(2)=...=0.001024\quad$ instead of $0$.

• Don't you make it even more obscure to the OP and more lengthy ? (Not counting that the convergence is poor at the singular points.) – Yves Daoust May 3 '16 at 9:42
• This is right - it does become more "obscure" based on my definition in the post's edit. I do appreciate the help however, and insight was spawned. – Rocco M May 3 '16 at 16:45