BillLuvsU Posted December 28, 2009 Posted December 28, 2009 (edited) Ok, I have three points along a parabola. I need to figure out the highest point on the parabola. My math skills are a little rusty, any help is greatly appreciated. Edit: My main trouble is converting a system of equations to code form. Edited December 28, 2009 by BillLuvsU [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
evilertoaster Posted December 28, 2009 Posted December 28, 2009 (edited) You're just comparing y-values then? If there's only 3 you can just do an if-then case. Considering you already have the 3 points, you simply pass the y-values to some function: Some psuedo-code func (y1,y2,y3) if (y1>=y2) and (y1>=y3) then return y1 if (y2>=y1) and (y2>=y3) then return y2 return y3 endfunc Edited December 28, 2009 by evilertoaster
BillLuvsU Posted December 28, 2009 Author Posted December 28, 2009 Aight, I just made some guestimation type code. It actually works better for my purposes anyways. Thanks for the help Toaster. [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
Lococobra Posted December 28, 2009 Posted December 28, 2009 The general form of a parabola is given by the equation: Ax2+Bx+C=yWhere A, B, and C are real constants.You have three pairs of points that are (x,y) ordered pairs. Substitute the x and y values of each point into the equation for a parabola. You will get three linear equations in three unknowns, the three constants. You can then easily solve this system of three equations for the values of A, B, and C, and you'll have the equation of the parabola that intersects your 3 points. The vertex is where the first derivative is 0, a little algebra gives: (-B/2A , C-B^2/4A) for the vertex.Translating that into code however, would be hard.Given the points (1,3), (2,5), and (-3,2)You get the following set of linear equationsA+B+C=34A+2B+C=59A-3B+C=2You would have to write a program that solved simple sets of linear algebra like the ones above then plug the constants into the equation for the vertex and you have your answers. Or maybe there's already such a program that you could just use?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now