Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

curved line graph

In this curved line graph, I need to be able to make a formula that can tell me the interpolated value at any point on the curved path given one Data input.

So for example if I wanted to know what value the line was at exactly half way between Point 2 and Point 3, I can eyeball it and tell it would be somewhere around 3.0 for a value, and to get it more exact I could use a ruler and some math. But that is the long way of finding 1 point on the curve at a time. Is there a generic formula that can take any arbitrary curved path with a set of points (a curved path that has no real pattern except that it's a collection of splines with known points to interpolate between) and turn it into a mathematical formula that you could input a Data 1 and it spits out the Data 2 value of the curve where the Data points meet, or vice versa?

For example,
Input Data 1 to math formula = Point 2.5
Data 2 = [Computed by math formula] 3.0

or

Input Data 2 to math formula = 3.0
Data 1 = [Computed by math formula] Point 2.5

Just need the method to develop the math formula!

share|improve this question
add comment

2 Answers

If you just have four data points (or some smallish number, anyway), then the easiest approach is probably something called "Lagrange interpolation".

The wikipedia page has a bunch of formulas that might be hard to understand, but the examples should be pretty clear:

http://en.wikipedia.org/wiki/Lagrange_polynomial

For four given data points, you will get a cubic (degree three) equation of the form $y = ax^3 + bx^2 + cx + d$, which you can then use to get intermediate values anywhere.

share|improve this answer
add comment
up vote 0 down vote accepted

I have realized this is impossible for my scenario. The actual application of this would be for a graph with hundreds of points, all using splines, not Lagrange polynomial curves, which curve the line differently than splines somewhat, throwing off the accuracy which is all-important. Even using spline interpolation in Mathematica with dozens of points wasn't accurate enough. The only way to do this that I have found is by using AutoCAD (or some other exact distance measurement) on the graph to interpolate as exactly as possible (to about 3 decimal places).

A formula would be rather impractical, however, a way to take a curved line/set of curved lines in AutoCAD and create 100,000 points on it evenly spaced could be possible in the future. You could then export the 100,000 points to something like Microsoft Access database as a table, then create a query that would find the nearest point out of the 100,000 points to whatever Data 1 or Data 2 you input, but I don't have a clue how to do this in practice.

share|improve this answer
    
Maybe I misunderstood. I thought you just wanted an equation for a curve passing through the given data points (four of them, in this case). Now it sounds like you want the equation to match the shape of the graph in your picture, not just match the four points. That can be done. Take a large sample of points from the graph, and fit a spline through them. To get answers accurate to about 3 decimal places, I'd guess that a few dozen points is enough. The technique you described (storing 100,000 values) is just a very crude form of approximation/interpolation. Better to use a spline. –  bubba Jan 19 '13 at 8:05
    
Obviously the answers given have not been successful. I'm pretty sure that there is nothing special about AutoCAD in this area. Anything that you can do in AutoCAD, you can do using the techniques described in my answer and comment. Curve fitting obviously is possible -- people do it every day, and they do it without using vast tables of points. –  bubba Oct 25 '13 at 0:43
add comment

Your Answer

 
discard

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.