Is there any maths software to help determine the formulas of given curves?

8.3k Views Asked by At

I am looking for a piece of software if it exists, which would allow me to give 2 points on a graph, (say (0,0) and (100,100) as an example), it would then connect the 2 points with a straight line, and then I can pull out the centre of the line to create different curves, S shaped curves etc to my liking. Once satisfied, I could then retrieve the formula of the curve I just created.

Does this exist to your knowledge? Would be a really useful tool. Approximations are more than OK, things don't need to be hyper accurate just something to give an idea.

3

There are 3 best solutions below

3
On

It sounds like you're talking about drawing Bézier patches. Lots of programs let you draw these (e.g. essentially every graphic design program) and all of them would have an internal representation of the equation, although I'm not sure how to get most of them to tell it to you. But that should tell you what to Google.

I found this thing online:

http://cs.jsu.edu/~leathrum/gwtmathlets/mathlets.php?name=bezier

See the "notes" tab.

0
On

Pretty much any drawing or CAD program can do the curve manipulation you described. This includes Inkscape, Adobe Illustrator, AutoCAD, CorelDraw, or even Powerpoint.

In most cases, these programs create cubic Bézier curves. If you want to get the equation of the curve, the first step is to get the "control points". There are four of these for each Bezier curve, so let's call them $\mathbf{P}_0$, $\mathbf{P}_1$, $\mathbf{P}_2$, $\mathbf{P}_3$, where $\mathbf{P}_i = (x_i, y_i)$. The programs typically give you some way to get the coordinates of these control points, though you might have to write some code to get them, in some cases. For example, Inkscape saves its files in the SVG format, and the saved data will contain the control points of each curve you draw. CAD programs usually have some sort of "Info" function that gives you the control points of a selected curve.

Then, once you have the control points $\mathbf{P}_i = (x_i, y_i)$, the equation of the curve is $$ x(t) = (1-t)^3x_0 + 3t(1-t)^2x_1 + 3t^2(1-t)x_2 + t^3x_3 $$ $$ y(t) = (1-t)^3y_0 + 3t(1-t)^2y_1 + 3t^2(1-t)y_2 + t^3y_3 $$ Of course, not every shape can be described by Bézier curves, but they are very flexible and provide enough freedom for most design tasks.

2
On

It is unclear if your question is about arbitrary curves or arbitrary functions.

A curve can be intersected by horizontals/verticals as many times as you want, and can be freely rotated. It can be described by parametric equations

$$x=f(t),y=g(t).$$

A function needs to be univocal, i.e. at most one $y$ per $x$; rotating a function doesn't make sense. It is described by an explicit equation

$$y=f(x).$$

In the first case, you will find a lot of so-called free form curves solutions such as B-splines, NURBS, cubic splines... and interactive graphical editors. None of them will give you the equations, though, but rather the coordinates of control points.

In the second case, you can think of Lagrangian interpolation, giving a polynomial, or cubic splines, giving piecewise cubics, among others. You will find numerous applets about these.

For a better answer, tell us curve or function.


By the way, you will find no tool able to tell you general equations like, say $y=\sin(3x)-4\ln_7(x)$ when you draw the graph of such a function, even precisely. State-of-the-art just doesn't allow to do that.

All you will find constructs [piecewise] polynomials or rational fractions that interpolate or approximate an ordered point set.

Lastly, there exist fitting techniques that can adjust a few parameters when you give the functional form of a curve such as, say $y=a\sin(bx)+c\ln(x)$, where $a,b,c$ are unknown.