Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a free / open-source program that would allow me to drag and drop points of a cubic curve and displays the equation?

There are a number of equations that I could use in my game project and it would be a huge time saver if there is a tool that allows me to drag & drop and fine-tune curves to meet the desired effect.

In all circumstances I need to compute the value of y given x. This probably is not important, but both axis always range between -1 and 1.

share|cite|improve this question
up vote 3 down vote accepted

Here's a little JSXGraph web page. Click and drag the red dots to change the cubic. The equation for the cubic will be changed accordingly... Drag the green dot along the curve to see the coordinates.

Is this what you wanted?

The full source is in the html file from the download link, and is easily modified (I think). It uses the formulas for the cubic passing through four given points found on this page: Lagrange Polynomials.

Admittingly, the equation looks ugly, but one could expand the formulas found on the linked page to put it in standard form.

Be warned: I haven't checked this thoroughly. The equations may be off...

Sample screen shot is below:

enter image description here

share|cite|improve this answer
This is nice. It should be straightforward to modify the source so it can do Bézier curves instead of interpolating polynomials... – J. M. Feb 10 '12 at 1:25
Javascript is getting better all the time - but i am skeptical that cross-compatibility is easy to handle, and things like having multiple frames to draw in (say one frame to draw and edit the equation and another to display the graph). But that is personal preference and other than that Javascript surely is the way of the future (not that it will replace everything else but at least expand its niche). – Peter Sheldrick Feb 10 '12 at 1:40
Thanks for the heads-up for JSXGraph David. – Peter Sheldrick Feb 10 '12 at 1:42
@Peter Your welcome. I really like the MathJax incorporation (though the script in the link runs much faster with MathJax disabled). JSXgraph can do amazing things. It's a very nice library; though, it is a pain to use at times. – David Mitra Feb 10 '12 at 1:46
Many thanks, with a few changes that should help me solve my problem. – Lea Hayes Feb 10 '12 at 2:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.