answersLogoWhite

0

What do you mean by "compute"? Do you want to graph it? Factor it? Calculate it's function given a set of points that lie on it?

If you're looking to compute the function given three points that fall on the parabola, then I have just the code for you. If you're given three points, (x1, y1), (x2, y2) and (x3, y3), then you can compute the coefficients of your quadratic equation like this:

a = (y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2)) / (x1 * x1 * (x2 - x3) + x2 * x2 * (x3 - x1) + x3 * x3 * (x1 - x2))

b = (y1 - y2) / (x1 - x2) - a * (x1 + x2);

c = y1 - (x1 * x1) * a - x1 * b;

You now can calculate the y co-ordinate of any point given it's x co-ordinate by saying:

y = a * x * x + b * x + c;

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: How do you compute quadratic equation using java?
Write your answer...
Submit
Still have questions?
magnify glass
imp