Jump to content

Parabola Search


 Share

Recommended Posts

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 by BillLuvsU

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

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 by evilertoaster
Link to comment
Share on other sites

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

Link to comment
Share on other sites

The general form of a parabola is given by the equation:

Ax2+Bx+C=y

Where 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 equations

A+B+C=3

4A+2B+C=5

9A-3B+C=2

You 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?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...