I’ve been solving a lot of quadratic formulas lately, and I grew tired of searching for web-based tools to solve them. I was not able to format the output of the answers either, so I decided to write a Java application that I could manipulate. I knew that I wanted to have real and imaginary answers that were good to 3 decimal places. That keeps my answers to a good precision. I wanted the output to look like: -0.707 + 0.707j, -0.707 – 0.707j!
(-b+SQRT(b^2-4ac))/(2a) and (-b-SQRT(b^2-4ac))/(2a). This is a simple formula, but doing it by hand more than once is tedious. This program was written in the time I was supposed to be solving pole-zero plots for my DSP class. I was done solving these problems when I decided I wanted my own program to solve them for me.
I have written a Java application that runs on your local computer.
For Windows users, simply download the .jar file and click it. It should run. I’ve tried it on XP with no issues. You may need the Java Runtime Environment. It can be downloaded from Sun for free.
For Linux/Ubuntu users, You’ll need to do a little work before you can use it. This is not a terminal program, but it can be opened easiest using the terminal until I figure out how to make it more user friendly. Download the .jar file. Open it with package manager and put the two class files in a folder where you can find them. I chose to put them on my desktop in a directory called QuadEquation. Extract the two class files into that folder. Then open a terminal and ‘cd /home/username/Desktop/QuadEquation’. Finally type ‘java QuadEquationTest.class’. The program will run like a champ, I hope.
The program also has a divide by zero protection. Dividing by zero is too much fun for this app, so it displays a prompt that alerts the user that it happened and then re-prompts for correct data. A final note, if you start the program, you’ll have to enter at least one equation to exit. (I like a=1, b=1.4142, c=1).
Good luck, and please let me know if you use it and like it. If you don’t like it, constructive criticism is the only form accepted.