Is there a site to draw a curve and get the equivalent equation?

9.8k Views Asked by At

I know there are many sites where we can input the equation and get the curve of the function (examples here, here and here).

What I want is the inverse: I have an idea of how I want the curve to be, and want to get to the equation from there. There are some nice lists of curves (here), others not so nice (here), but from there is hard to get to the curve I have in mind. That's the curve in this case (in red):

curve

but there will be many cases when such a software would be very useful. If nobody knows of such a site, then please at least help me identify the equation for the curve above.

2

There are 2 best solutions below

1
On

Your curve appears to be the cubic spline parametrized by $$ p(t) = (1 - t)^{3}\, p_{1} + 3(1 - t)^{2}t\, p_{2} + 3(1 - t)t^{2}\, p_{3} + t^{3}\, p_{4},\quad 0 \leq t \leq 1, $$ with $p_{1} = (0, 1)$, $p_{2} = (\frac{8}{3}, 1)$, $p_{3} = (\frac{4}{3}, 0)$, $p_{4} = (4, 0)$.

Dmitry Baranovskiy's Raphaël JavaScript library has an interactive demo for drawing splines.

A cubic spline

1
On

Try this:
$y=\frac{1+\cos{\frac{\pi·x}4}}2$
$====================$
RODRIGO'S COMMENT: Very good, Senex, thank you. But I like Weaam solution more, because I have more control to adjust it (closer to a sinoid vs. closer to a straight line). – Rodrigo
$====================$
EDIT PURSUANT TO RODRIGO'S COMMENT (2016·3·6):
Well, try this then:
C and L are weights to control how much influence the cosine curve and the straight line, respectively, will have in the shape of your desired curve.

examples:
$C=1\;\text{and}\;L=0\;\text{will give you the curve in my original presentation.}$
$C=0\;\text{and}\;L=1\;\text{will give you the pure straight line.}$
$C=1\;\text{and}\;L=1$
$\;\text{will give you a curve in which the two influences are balanced.}$
Other combinations of C and L will yield other results.

$y=\frac{C·\frac12·\left(1+\cos{\frac{\pi·x}4}\right)+L·\frac{4-x}4}{C+L}$