What would the equation to this graph look like?

666 Views Asked by At

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:

https://i.stack.imgur.com/oG1EW.gif

https://i.stack.imgur.com/IJgtW.gif

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.

2

There are 2 best solutions below

2
On

$$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$.

2
On

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.

enter image description here

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.$$