# get function from a graph (2d points)

This topic is 3973 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hey, i've got 4 points: p1(0.25, 90) p2(0.75, 150) p3(1.25, 190) p4(2.00, 175) easy to graph, but how do i find it's function? i basically want to find at what value of x, y is the highest, so the maximum. thanks, Scott

##### Share on other sites
4 points doesn't explicitly define a continuous function. You'd have to know something about the nature of the function before a graph through it would have much meaning. If, for instance, these were points sampled from frictionless projectile motion you'd know that they lie on a parabola and the maximum of that parabola would be your solution, but without any more information it's impossible to say.

##### Share on other sites
well, it's not continuous. the x values are the masses of a chemical during a separation of metal from ore. the y value is the amount of metal collected for the x value. lets say the values are going to be known to give a parabola shape. does that help?

amount of chemical (x) metal collected (y)
0.25 g 90 g
0.75 g 150 g
1.25 g 190 g
2.00 g 175 g

it was four tests, and i want to try and determine at what value of x will give the highest value of y. if there's a better approach then let me know :) i dont necessary care if i need to find the function or not, just the answer.

##### Share on other sites
For polynomials through points the problem reduces to solving a system of linear equations. I posted something like this a while back where I needed a function for a cubic through 4 arbitrary points:
http://www.gamedev.net/community/forums/topic.asp?topic_id=425162

That may work as is for what you're trying to do, but if you actually know it's going to be quadratic then you're stuck with trying to solve an overdetermined system of equations(4 constraints and 3 variables), and you'd have to use a different method like least squares to estimate the function.

##### Share on other sites
Nibbles. There are infinitely many functions passing through those four points. Indeed, there is an infinity of infinities of such functions [rolleyes]. We need some constraints.

It does help to say that it's a 'parabola shape', but I'm sure you can do better than that. Without going into too much detail, there is no parabola (that is, quadratic polynomial) that fits your data exactly. There is a best-fitting such parabola, but I'm not convinced that's what you're after.

Tell us more about the nature of the reaction. I suspect that the law of mass-action can be applied to determine the form of an ideal model. Once we know what function stochastically brought up your data, we can help give you the right answer, rather than the wrong answer, beaten and twisted to look like the right one.

##### Share on other sites
i did 4 froth flotations with the same (as near as i could get) conditions except for the collector.

i'm writing a tech report on designing an experiment to separate base metals from an ore sample. so what i did was i performed 4 flotations with the only difference being the amount of collector reagent used. (0.25g, 0.75g, 1.25g, 2.00g). at the end of each test i weigh the sample of metal collected. i haven't seen the results yet (not 'til tomorrow when they're dried) but i assume that there is going to be an upward trend.

what i want to do is find out what the best volume of collector should be based on the amount of ore and water i used. if i use too much collector there will be an excess, therefore a waste.

from the volumes i used, i may not have even used up to the excess, but i should be able to, in that case, extrapolate what that volume should be from my data, or interpolate if i did hit the excess. i dont know if my actual recovered metal will decrease if i go over my excess... it'll probably just plane out.

am i right in thinking this?

##### Share on other sites
I'll give you some keywords to google (I recommend the first one):
1) least squares adjustment formula statistics

or

2) Taylor Polynomial

Like TheAdmiral said you won't get a formula that will exactly go through all your points. You'll get a formula that "fits best" to those points.

The math theory behind these two methods can be overwhelming at first, but what you actually need (just the formulas) is pretty simple.

Hope this helps
Dark Sylinc

PS: I apoligize if you find this post short, but it's late and I'm tired. Good luck on your problem (and solution)

##### Share on other sites
By the sounds of things, the relation between these two variables is rather complex, and so trying to find an appropriate form to fit the data may be tricky without more data. In that case, you'd need something more general-purpose, such as a smoothing algorithm to find a spline-based fit with a lowered modulus-of-continuity from which to find the optimum value.

But don't worry too much about understanding that because, I'm afraid, you simply have far too few samples for this technique to be of any use. If there is more data to come, then I'll go into further detail, but as things stand, the optimum point could feasibly lie anywhere in [1, 1.75], and no amount of high-powered mathematics can help you narrow this interval.

If this really is all the data you can afford, then we can probably find something half-decent, but don't expect any miracles. First, answer me a couple more questions, as I have absolutely no idea how to predict the yield of froth floatation.

1. Would you expect the yield to reach zero as the collector mass approaches zero?
2. At what point (if any) would the yield hit zero as the collector mass increases? Would it perhaps taper off to zero as the mass goes to infinity, or would the reaction cease at a sooner point? Perhaps the yield wouldn't tend to zero but some constant level as this happens.

The picture in my mind's eye goes something like this:

That's y = Ax/(B+x2).

Is that at all realistic? If so, a bit of trickery could coerce it into linear least-squares form and solve for the parameters, and hence get you an estimate for the peak.

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632955
• Total Posts
3009451
• ### Who's Online (See full list)

There are no registered users currently online

×