View Question
Q: Formula of a curve, from a set of xy values ( No Answer,   6 Comments )
 Question
 Subject: Formula of a curve, from a set of xy values Category: Science > Math Asked by: jimboston-ga List Price: \$10.00 Posted: 25 May 2006 12:25 PDT Expires: 24 Jun 2006 12:25 PDT Question ID: 732367
 ```How can I find a formula for a curve if I have a set of X and Y values? I'd like to find Y for any given X up to about x = 70 The values I have are: when x=3 y=1300 when x=6 y=700 when x=12 y=350 when x=24 y=155 when x=40 y=75```
 There is no answer at this time.

 Subject: Re: Formula of a curve, from a set of xy values From: frankcorrao-ga on 25 May 2006 16:20 PDT
 ```http://en.wikipedia.org/wiki/Interpolation There are no guarantees though.```
 Subject: Re: Formula of a curve, from a set of xy values From: falcoboy7-ga on 25 May 2006 18:31 PDT
 ```Using a TI-83/83+/84, plug the values into a stat->edit Then go to Stat->Calc->(regression model-for example QuadReg) Then put in the values of the table columns so you have... QuarReg L1,L2,Y1 This plugs the formula into Y1 You may need to experiment a bit with this.```
 Subject: Re: Formula of a curve, from a set of xy values From: jimboston-ga on 27 May 2006 14:07 PDT
 ```I'm able to use interpolation functions within excel to get answers, but I'd like to know how to derive a single formula for expressing this type of curve from a set of values.```
 Subject: Re: Formula of a curve, from a set of xy values From: brix24-ga on 27 May 2006 19:31 PDT
 ```Hello jimboston, I suspect there are several possible answers, depending on the context of your question. Based only on the information given, I would infer the type of curve and the equation to use by examining a plot of the data. To me, a plot in Excel suggests the data approximates a simple hyperbola confined to the first quadrant. The fit won?t be exact for such a simple hyperbola (xy=c) since the product of the xy values is not truly constant, so a "best fit" determination would be needed. (In a real world situation, these deviations from a constant value would probably reflect experimental variation.) x y xy 3 1300 3900 6 700 4200 12 350 4200 24 155 3720 40 75 3000 (My apologies if the above table doesn?t appear correctly. I haven?t figured out how to get data to stay aligned correctly after a comment is posted.) If a hyperbola of the simple type, xy=, is chosen as the curve, you?ll have to do a best fit to get the constant. In most situations, the type of curve that you would fit the data to would be based on the type of xy relationship expected from whatever physical, chemical, or biological process was being modeled. Since that information is lacking here, I chose a simple curve suggested by graphing the data. Note: there are other solutions, including at least two curves that exactly match the five data points given. Exact curve 1: If you absolutely had to have a curve that fit the data exactly, it?s always possible to derive a fourth degree polynomial in x that fits 5 xy values exactly. You can get a good approximation to this equation by entering your values at http://www.savetman.com/curvefit/index.html (You?ll get y = 0.0157103006367711 x^4 - 1.34519104188221 x^3 + 39.0410079196841 x^2 - 472.984707396469 x + 2402.63267469149). However, this is not a solution most of us would prefer. For instance, if you solved this equation for y using x=35, you?ll get y = -426; because the curve is more complex than a simple ?one-bend? hyperbola, the interpolated y value from the polynomial is not what one would expect by looking the trends in the original data. Exact curve 2: You can get an exactly matching hyperbola in this case by using the general formula for a hyperbola. The xy=c formula for a hyperbola is one that I remember from high school; this hyperbola does not cross either the x axis or the y axis. A hyperbola can, of course, be positioned elsewhere. A google search for hyperbola equation leads to other equations for a hyperbola, such as, x^2/a^2 ? y^2/b^2 = 1 (which is also a special case) and to a general formula for a hyperbola at http://en.wikipedia.org/wiki/Hyperbola ?Ax2 + Bxy + Cy2 + Dx + Ey + F = 0 such that B2 > 4AC, where all of the coefficients are real, and where more than one solution, defining a pair of points (x, y) on the hyperbola, exists.? We can derive an exact match from this equation because we have 5 pairs of xy values that give 5 equations, which, in turn, can be solved for the five coefficients, A ? E. (F can be chosen almost arbitrarily; all that matters is that F is not arbitrarily chosen as zero. I don?t know what a mathematician would call F, but I?ll call it a scalable Factor. It is equivalent to the right-hand term in these equations, which all represent the same straight line: 2x + 3y = 6, x + 1.5y = 3, 10x + 15y = 30.) I set F to 1 initially and solved the five simultaneous linear equations. At the end, I multiplied all terms by 100000 to get coefficients that were easier for me to compare. Here is the final result: -6.25969943795458 x^2 + 18.0792113361007 xy -0.00592726833278236 y^2 + 1344.03199473387 x + 27.3326158325765 y = 100000 (A necessary check: B^2 is indeed > 4AC). The key point is to know what type of curve / relationship would be expected from the properties of the system you are observing or, barring that, what type of curve you deduce from looking at a plot of the data. Then it?s a matter of finding the equation (general if need be) that describes that curve and either solving exactly (possible in some situations) or finding the "best fit" for the chosen curve type to the data. Note that the hyperbola equation that exactly matches the data is not in the form, y=f(x), making interpolation more complicated. On the other hand, a best fit of the data to xy=c makes calculation of interpolated y values simpler since y is easily calculated as y=c/x. (Ideally, I should have done some interpolation checks for the "exact match" hyperbola, but I'm "mathed out" at the moment.) If your data described observations of a real world system, I would probably have chosen fitting the ?xy=? equation to the data rather than finding a hyperbola that matched exactly. Interpolation and extrapolation: Interpolation of y values for x between ~3 and ~40 is relatively safe, but extrapolation much outside that range might not be reliable in a real world situation. In general, I wouldn?t place much confidence in extrapolation at an x value of 70 without further evidence that the equation truly represents the data in the ?known? region.```
 Subject: Re: Formula of a curve, from a set of xy values From: brix24-ga on 27 May 2006 19:40 PDT
 ```Sorry, the last sentence should have ended: "...without further evidence that the equation truly represents the data _outside_ the ?known? region.```
 Subject: Re: Formula of a curve, from a set of xy values From: activealexaoki-ga on 11 Jun 2006 13:47 PDT
 ```As for myself, I hate to rely on instruments to solve math, like so many crowds of people. The sole reason is that you won't know why, in which case people can neglect the reasoning and just steal the result. There is a method in Numerical Analysis. Someone mentioned before - Interpolation. My method of interpolation, I could not confirm the validity of the equation online. Many sites are just introducing the principle or Lagrange interpolation, which seems very simple but not comprehensible. My method is not going to guarantee the result but it should be mathematically correct. Step 1. Recognize polynomial By recognizing the points, you can guess how far your polynomial should consider to ensure that your points are all interpolated. Since one point cannot draw any non-trivial line, two points are needed to draw straight line. Two points cannot guess unique quadric equation, you need three points. So and so. The highest degree of polynomial is always one less than the number of known points - at least. In your case, since you have 5 known points, you may only take fourth power polynomial. (Of course, by plotting points, if you see the graph exponential, you can write the equation in terms of exponential function. You may figure that out by yourself, or let me know.) Step 2. Reasoning of method From Step 1, I decided to take polynomial such that a*x^4+b*x^3+c*x^2+d*x^1+e*x^0=y Let x's and y's are vectors, the underline reason of interpolation is that the vector sum satisfies. By simplifying the equation the vector product of the interpolation will look like: |a| |b| [x^4,x^3,x^2,x^1,x^0]*|c|=[y] |d| |e| As you can see, you only need to solve the augmented matrix: [x^4,x^3,x^2,x^1,x^0 | y] Since you have five points, |x1^0 x1^1 x1^2 x1^3 x1^4 || y1| |x2^0 x2^1 x2^2 x2^3 x2^4 || y2| |x3^0 x3^1 x3^2 x3^3 x3^4 || y3| |x4^0 x4^1 x4^2 x4^3 x4^4 || y4| |x5^0 x5^1 x5^2 x5^3 x5^4 || y5| Just solve the augmented matrix above and you can find the interpolated function manually. If you read more about Lagrange Interpolation, you find it simpler. If you find explanation for Incremental Newton Interpolation, you find it very accessible.```