answersLogoWhite

0


Best Answer

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

12y ago
This answer is:
User Avatar

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
Related questions

How do you compute the product of integers 1 to 10 in JAVA?

There are, of course, several ways to do this, but the simplest way is probably using a "for" loop: int product = 1; for(int i = 1; i<= 10; i++) product *= i;


What is a factorial loop?

An example in Java, to compute 10!: int factorial = 1; for(int i = 1; i < 11; i++) { factorial *= i; }


How do you control PowerPoint slides using java?

You can control Powerpoint Slides using Java with Aspose.Slides for Java Library: - http://www.aspose.com/java/powerpoint-component.aspx


What are the technologies without using java?

you can use type writer to avoid using java :)


What are java applications?

Applications that are built using the Java language are termed as Java applications.


Write a java that computes the value of 2?

Compute means to calculate. What do you want to "compute", if you already know it is 2? If you want to show the value:System.out.println("Your number is " + 2);Compute means to calculate. What do you want to "compute", if you already know it is 2? If you want to show the value:System.out.println("Your number is " + 2);Compute means to calculate. What do you want to "compute", if you already know it is 2? If you want to show the value:System.out.println("Your number is " + 2);Compute means to calculate. What do you want to "compute", if you already know it is 2? If you want to show the value:System.out.println("Your number is " + 2);


What is the areas of application of java?

Applications that are built using the Java language are termed as Java applications.


Has anyone developed web services using java?

of course, there are services developed using java technology


How do you execute a Java program?

You can run a Java application from the command line using "java <name of the class>"


Is it possible to draw in java without using applet?

Yes it is possible to draw in java by using AWT package. or by using javax package.


What has the author Joe Weber written?

Joe Weber has written: 'Using Java 1.2' -- subject(s): Java (Computer program language) 'Using Java 1.1' -- subject(s): Java (Computer program language)


Can you provide a solution to the diamond-square algorithm using Java and recursion?

Yes. It is possible to provide a solution to the diamond-square algorithm using Java and recursion.