Alternate form of the quadratic formula

In summary, the alternate form of the quadratic formula is useful in computer science applications as it can produce less random error. This is due to the fact that depending on the coefficients, the error can be less if they are placed in different parts of the formula. Additionally, the number of operations required to compute the formula can also affect the error. This is especially important in approximation theory, where series representations of solutions need to be expressed in the lowest number of operations possible. The concept of economization is used to simplify and improve the accuracy of these calculations. In physics, this concept is used to convert divergent series into convergent series, making it possible to accurately calculate values for large inputs. Overall, the alternate form of the quadratic formula is
Mathematics news on Phys.org
  • #2
Multiply the usual form with
[tex]1=\frac{-b\mp\sqrt{b^{2}-4ac}}{-b\mp{\sqrt{b^{2}-4ac}}[/tex]

Edited a small mistake
(Usual form:[tex]\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}[/tex])
 
Last edited:
  • #3
The alternative form comes in handy in some applications of computer science. One form of the quadratic equation will often produce more random error than the other. Just because two statements are equivalent doesn't mean the computer will run them the same.
 
  • #4
why doesn't the computer run them the same?
 
  • #5
Because you might know one of coefficients better than the others, and depending on whereit is (inside or outsode of the radical) it's error will be less. For example, let's just say you have f(C)=2C and g(C)=(C)^(1/2)

If your value of C is off by 0.5, then in f your answer will be off by 1, but in g your answer will be off by less than one.

Or, if you know each coefficient exactly, but they're way too long to compute with, depending on where you enter them into the formula, your forced rounding will matter less.

That's just my guess, anyway.
 
  • #6
It has to do with loss of significant digits when subtracting two nearly equal magnitudes from each other.
The loss of significant digits means that the relative error between exact value and computer value can become very large.
Hence, it is best to use the following expressions for the two roots:
[tex]x_{1}=-\frac{b+\sqrt{b^{2}-4ac}}{2a}[/tex]
[tex]x_{2}=-\frac{2c}{b+\sqrt{b^{2}-4ac}}[/tex]
 
  • #7
It also has to do with the number of operations you have to perform, although that isn't an issue here.
 
  • #8
JohnDubYa said:
It also has to do with the number of operations you have to perform...

Now, that's interesting..
I didn't know that, could you expound a bit?
(Is it merely that the expression in the numerator of one root might be used as the denominator in the other root?)
 
  • #9
Each time a computer performs an operation, it truncates the result (roundoff error). Furthermore, some numbers can be represented exactly in IEEE floating point notation, other's can't. See Rubin Landau's book Computational Physics.

This issue is especially important in approximation theory, where series representations of solutions need to be expressed in the lowest number of operations possible -- a process called economization. You can economize a Taylor series by incorporating information from the higher-order terms into the lower order terms, producing a series that produces roughly the same result but at lower order -- the so-called Chebyshev economization method.) The book Numerical Recipes discusses this method fairly well. Anthony Ralston's book on Numerical Methods probably has the best treatment on the subject. See also http://www.nhn.ou.edu/~walkup/researchdocuments/br3.pdf

If you have Mathematica, check out the relationship between Pade approximants and economized rational approximants. The latter is the economized version of the former.
 
  • #10
StonedPanda said:
If your value of C is off by 0.5, then in f your answer will be off by 1, but in g your answer will be off by less than one.

My value or the computer's value? What would cause the computer to make an error?

Or, if you know each coefficient exactly, but they're way too long to compute with, depending on where you enter them into the formula, your forced rounding will matter less.

That's just my guess, anyway.

IOW, putting it in the alternate form will simplify the computer processing, like JohnDubYa said. BTW, JohnDubYa, that was extremely interesting. How is this theory in particular used? Is "it's" specialty in processing...?
 
  • #11
How is this theory used? Hmmm...

1. Computers cannot really find exponentials and logarithms, because the circuit designs can only add, subtract, multiply and divide. So all buttons on the calculator have to be expressed in terms of those four basic operations. The most boneheaded way to accomplish that (other than lookup tables) is to use Taylor series expansions of the functions, so instead of computing [tex]e^x[/tex] you compute [tex]1+x + \frac{x^2}{2} + ...[/tex]. Since you cannot sum an infinite number of terms, you must truncate the series at some order. The problem is round-off error. Each term introduces round-off error, so the trick is to get an accurate representation at low order. This is where economization (and other tricks) come into play.

2. One of the most common ways to solve differential equations is by a series solution (for example, perturbation theory in quantum mechanics). But you again must truncate the solution to some finite order. As with the problem stated in (1), summing the series at some value of the independent variable introduces round-off error.

3. Converting series that diverge into convergent series.

Let me give you an example: If you place hydrogen in a magnetic field, you can write out a perturbation (series) expansion of the energy solution that is a function of the magnetic field strength. So you get something like (making up numbers)

[tex] E = 0.2 B + 0.004 B^2 + 0.00043 B^3 + ...[/tex]

If you tell me the field strength B, I will tell you the energy of the atom. But for sufficiently large values of B, this series diverges. (Adding on more terms makes the energy larger and larger.)

But a clever researcher would realize that you can re-cast the series into a new series that CONVERGES for large field strengths. One such method is Pade summation, which replaces the series expansion polynomial with a RATIO of polynomials. (This introduces a denominator that can mock the singularity structure of the physical system.) If that doesn't work, you can economize the Pade approximant, producing economized rational approximants. There are hundreds of techniques, and most physicistics are not even aware of them. (Ooodles of good research gets tossed every year because physicists do not realize that they can re-sum divergent series into convergent series.)

Let me give you an example.

Suppose your quantum system produced a series representation of the energy that looked like this:

[tex]E = 1 + B + B^2 + B^3 + ...[/tex]

Now, it is obvious that such a solution blows up for any value of B equal to or greater than 1. Wanna' know why? Factor a B out of the RHS:

[tex] E = 1 + B( 1 + B^2 + B^3 + ...), [/tex]

which means E = 1 + BE. Solve for E and you get [tex]E = \frac{1}{1 - B}[/tex]

Oh ho! There is a singularity at B = 1, so the series will diverge for values greater than 1.

So [tex]E = 1 + B + B^2 + B^3 + ... [/tex] is bad. So what can we do? Well, our series sucks because it does not contain a denominator, which is needed to simulate the pole at B = 1. So let's instead create a new series representation that DOES have a denominator. The most general case would be something like

[tex]E = \frac{a + bB + cB^2 + ...}{1 + dB + eB^2 + ...}.[/tex]

To find the coefficients, we simply match this ratio with the original series at B = 0. And then we match the derivative of this ratio with the derivative of the original series at B = 0. And then we match the second derivative... and so on. If you do that, you will find that a = 1, d = -1, and the rest are 0. In other words, we get

[tex]E = \frac{1}{1-B}[/tex]

This Pade approximant actually is equal to the original function because our original function was a ratio of polynomials. But you can apply it to any function, such as [tex]e^x[/tex].

So if your physics professor tells you that you can only apply perturbation theory for small values of the magnetic field, then he is wrong. (Yes, at some point the field gets so strong that any series representation will diverge, but you can push the envelope much further than textbooks allow.)


By the way, I'm writing a book on this topic. Interesting?
 
  • #12
Yes, very interesting. Surely it will be a success.

Let me make it quite clear that I am only in 9th grade. Please simplify on the maths...
(or just teach it to me if you lke, I'm a very fast learner...)
so instead of computing you compute

Can you explain the logic that goes into this please?

Each term introduces round-off error, so the trick is to get an accurate representation at low order
What's round-off error? I'm guessing "low order" refers to the order of polynomials?
 
  • #13
Maybe I'm being a fish out of water here, but I'm feeling kinda talkative at the moment...

[tex]1+x + \frac{x^2}{2} + ...[/tex]

is the Taylor Series expansion for [itex]e^x[/itex]. It's necessary because a computer doesn't understand e^x. It hardly understand e, in fact. Exponentiation like that isn't one of the operations a computer can perform. So you use a series representation or some other kind of representation that only contains operations that the computer can perform. The Taylor Series has only operations a computer likes, so there you go.

As you add more and more terms, the series gets closer and closer to equaling the original expression. The infinite sum of the terms is identically equal to the expression. But nothing but humans can handle an infinite number of terms, so you have to truncate the number for computers.

So a computer might say e^x = (1 + x + x^2 + x^3). (1 + x + x^2 + x^3) clearly isn't equal to e^x, so there's some error. Try a value of x and see for yourself. But if you add another term, say e^x = (1 + x + x^2 + x^3 + x^4), you get closer. Less error. Keep adding more and more terms and you get closer and closer. Add enough terms and you have a hard time telling the difference, and it becomes pretty practical.

Round off error's pretty easy. Say you have a number 1.23456789. But a computer can only store 8 digits. So it rounds the 9-digit number off to fit it into 8 digits. You get 1.2345679. 1.23456789 - 1.2345679 = -.000000001, so there's error. The computer literally isn't using the right value.

cookiemonster
 
Last edited:
  • #14
Good explanation, cookiemonster.

"So a computer might say e^x = (1 + x + x^2 + x^3). (1 + x + x^2 + x^3) clearly isn't equal to e^x, so there's some error. Try a value of x and see for yourself. But if you add another term, say e^x = (1 + x + x^2 + x^3 + x^4), you get closer. Less error. Keep adding more and more terms and you get closer and closer. Add enough terms and you have a hard time telling the difference, and it becomes pretty practical."

Aaaaaah, but there is a catch! As you add on more terms, you decrease the systematic error in the calculation, no doubt. But you INCREASE the roundoff error, because the result of each computaton has to be truncated internally to fit the computer's memory registers. (It takes longer to compute more terms too.) The more operations you perform, the worse the roundoff error becomes.

So you have two competing errors -- one that likes a large number of terms in the series, and another that likes a low number of terms. The best thing to do would be to take infomration from the higher order terms and introduce it into the lower order terms. This way you decrease both systematic error and roundoff error. This is the essence of economization.

One more thing -- you said that by adding more terms you get a closer result. This is only true if the series CONVERGES. The series representation for e^x always converges no matter what value of x you try because e^x is an entire function. But a Taylor series of (say) the tan(x) diverges badly for large values of x (that is, as you add on more terms, the systematic error gets WORSE, not better). The trick then is to convert the Taylor series into an approximant like the Pade approximent, which tends to have better convergence properties.

If a student understands the meaning of a polynomial, they can probably understand much of the fundamentals of this discussion. I think the Mathematica manual has one of the easiest discussions to read about this issue. Also the Numerical Recipes has a good discussion.
 
Last edited:
  • #15
RE: "Can you explain the logic that goes into this please?"

I suspect you didn't give the GIF file time to load. Try again.

RE: "What's round-off error?"

Pick up a pocket calculator and multiply 3.29443 and 5.34433 together. The result
is something like 17.6065210819. But the computer may not be able to store all of those digits because its memory registers are only so big. So it may have to truncate the result to 17.6065. By scrubbing off digits, the calculation loses accurary. This is round-off error.


I'm guessing "low order" refers to the order of polynomials?

Yes.

1 + 3.64x -> low (first) order

1 + 3.64x - 4.52x^2 + 67.33x^3 + 85.84x^4 -> higher (fourth) order
 
  • #16
arildno said:
Multiply the usual form with
[tex]1=\frac{-b\mp\sqrt{b^{2}-4ac}}{-b\mp\sqrt{b^{2}-4ac}}[/tex]

Edited a small mistake
(Usual form:[tex]\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}[/tex])

I think multiply the usual form with
[tex]\frac{b\pm\sqrt{b^{2}-4ac}}{b\pm\sqrt{b^{2}-4ac}}[/tex]
is correct.

Working:
[tex]x=\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}\cdot\frac{b\pm\sqrt{b^{2}-4ac}}{b\pm\sqrt{b^{2}-4ac}}[/tex]
[tex]=\frac{(b^{2}-4ac)-b^2}{2a(b\pm\sqrt{b^{2}-4ac})}[/tex]
[tex]=\frac{-2c}{b\pm\sqrt{b^{2}-4ac}}[/tex]
 
Last edited:
  • #17
Wow. Tons of good information in this thread! Thanks!
 
  • #18
I remember there was one way where if b is divisible by 2, you can use a simpler formula but I forgot what it was...
like when ax2+bx+c=0; b is divisible by 2

I might be wrong though : )
 
Last edited:
  • #19
Also, to get the alternate form, divide ax2+bx+c = 0 by x2 to get a + b(1/x) + c(1/x)2=0. This is just a quadratic in 1/x with a and c switched around. So, you can switch a and c in the standard quadratic formula to solve for (1/x) and then switch numerator and denominator to get the alternate form for x.
 
  • #20
Imparcticle said:
why doesn't the computer run them the same?
Computers typically work in base 2. For the point of illustration, assume you are working with a computer that uses base 10 for floating point arithmetic and assume it only has 5 significant digits. For example, computing 1.0/3.0 and 200.0/3.0 on this computer yields 0.33333 and 66.667, respectively. Now suppose you need to find the solutions to

[tex]x^2-315x+1=0[/tex]

You apply the simple version of the quadratic formula:

[tex]x=\frac{315\pm\sqrt{315^2-4}}2 = \frac{315\pm\sqrt{99221}}2[/tex]

On this computer, [itex]\surd 99221 = 314.99[/tex] (the correct answer: [itex]314.993651\cdots[/itex]. The two solutions as calculated on this computer are

[tex]\aligned
x_1 &= \frac{315-314.99}2 = 0.005 \\
x_2 &= \frac{315+314.99}2 = 315.00
\aligned[/tex]

The correct values are [itex]0.00317463517\cdots[/itex] and [itex]314.996825\cdots[/itex]. The larger of the two values is correct to five decimal places. The smaller of the two has zero significant digits. Now look what happens when you calculate the smaller value using the alternate form:

[tex]x_1 = \frac 2{315+314.99} = 0.0031747[/tex]

which is correct to four significant digits.
 
  • #21
Why does the accuracy become better when we move the arithmethics to the divisor ?
 

1. What is the alternate form of the quadratic formula?

The alternate form of the quadratic formula is x = (-b ± √(b^2 - 4ac)) / 2a.

2. How is the alternate form of the quadratic formula different from the standard form?

The alternate form of the quadratic formula is derived from the standard form, x = (-b ± √(b^2 - 4ac)) / 2a, by simplifying the numerator and denominator.

3. When should the alternate form of the quadratic formula be used?

The alternate form of the quadratic formula should be used when solving quadratic equations that have complex or irrational solutions. It is also useful when graphing quadratic functions.

4. What are the advantages of using the alternate form of the quadratic formula?

One advantage of the alternate form of the quadratic formula is that it is simpler and more compact than the standard form. It also allows for easier calculation of complex solutions.

5. Can the alternate form of the quadratic formula be used for all quadratic equations?

Yes, the alternate form of the quadratic formula can be used for all quadratic equations, as long as the equation is in the form of ax^2 + bx + c = 0.

Similar threads

Replies
8
Views
1K
Replies
2
Views
1K
  • General Math
Replies
16
Views
3K
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
11
Views
504
Replies
7
Views
827
Replies
9
Views
4K
Replies
7
Views
1K
Replies
8
Views
2K
  • STEM Educators and Teaching
2
Replies
36
Views
3K
Back
Top