I have a standard quadratic formula solving program and the only fancy-schmancy thing I have is that it also reads the discriminant. However, I also need the roots to be in a different form. For example, x = -1 + or - √2. Are there any changes I can make to also get answers like these on my calculator? Maybe just a way to convert my decimal answers to the one above?
If I understand your question correctly, you are getting 1.41421356237 (the decimal expansion) instead of √2.
You haven't specified which calculator you are using so I will assume you're using a ti-84 plus family calculator, which is arguably the most popular series.
What you're looking for is called an exact math engine, and there is none on the ti-84 series. Therefore, you can't just convert the answer into a "pretty" format. However, since we already know the formula that the program is solving, the program could be edited to return the sqrt token followed by the determinant if the root of the determinant would return a fractional result. This would require a couple extra lines of code, but should be very doable.
This would look something like this:

Code:
```If fPart(sqrt(D)) Then Disp "sqrt("+D+")" Else Disp sqrt(D) End ```

Where D is the determinant. This is not at all an exact math engine though so don't expect to always get the desired answer.
I recently posted a program that solves for the exact roots like you explained before. It is called EXACT Quadratic Solver and is located under TI-84 Plus CE Math Programs.

Hope that helps.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum