Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ ¹ ² ³ °
 

You are not logged in. #1 20110507 16:19:41
Quadratic Equation SolverI have updated the Quadratic Equation Solver "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #2 20110507 18:05:09
Re: Quadratic Equation SolverHi MathsIsFun; The solver gets ( 0.0000017547864, 712345.12) the actual answer is: (0.00000175476742..., 712345.119998245...) The answer given by the solver implies an error of ± 5 * 10^14, the true error is closer to 10^10 for the smaller root. When I say smaller I mean in magnitude. By producing other quadratics with the property that: It is possible to lose more digits, thus drowning out the solution. This is not due to any error on your part. The high condition number of this polynomial is causing subtractive cancellation in the quadratic formula ( or whatever other method the solver is using ). It is for this not well known reason that the quadratic formula is not used in numerical analysis! In short it may be taught everywhere but it is not reliable. If you are passed the debugging stage and want to add more bells and whistles to this solver, then I could show you a simple modification that will increase the accuracy of the smaller root. A way that makes the quadratic formula somewhat stable. In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #3 20110507 20:04:19
Re: Quadratic Equation SolverThank you very much for the testing.
Yes, please! "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #4 20110507 21:31:48
Re: Quadratic Equation SolverHi MathsIsFun, Character is who you are when no one is looking. #5 20110507 23:21:57
Re: Quadratic Equation SolverHi;
Yoda? Me that be. Or more clearly when b is much larger than 4ac then it is much more numerically stable to get the smaller root by dividing c by the larger root. Provided the larger root > c. When I say larger I mean the absolute value of the two roots. In the previous example the solvers answer of 712345.12 is used to get the smaller root to high precision: Notice it agrees with the high precision answer of 0.00000175476742795... much better than before. In order to understand why this works you only need the knowledge that any time you have a floating point number in a computer that number n is actually represented as: Where epsilon represents the error in the representation. Any time you divide a smaller number by a larger one the error portion of the numerator is divided, made smaller. So division is an error minimizer while multiplication is an error magnifier. Dividing by 712345 picks up 2 or 3 correct digits for us. There is a general rule that covers all the real roots:
He means in the quadratic formula and a monic polynomial. This also saves some time because you only need to use the formula once, instead of twice. In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #6 20110508 14:26:37
Re: Quadratic Equation SolverExcellent. Now I just need to translate that to an algorithm. Something like:
Good ideas ... I can show them at the bottom. "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #7 20110508 16:42:49
Re: Quadratic Equation SolverHi MIF; 3) Is b positive then use: 4) Is root1 bigger than c? 5a) Yes: root2 = c / root1 ; goto 6: 5b) No: Get root2 in the ordinary way. By using the other form of the quadratic. 6) Done: Example: b is negative so use: Notice you did not need a compare, this method always produces the largest root first. xlarger is bigger than c so, If xlarger was not greater than c then you would use the other form of the quadratic to get root2. Have I explained it well enough? If not what do you require? In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #8 20110509 09:37:13
Re: Quadratic Equation SolverThanks "Yoda", will get on to it soon. "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #9 20110509 15:40:47
Re: Quadratic Equation SolverHi MIF; In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #10 20110509 22:21:47
Re: Quadratic Equation SolverOh no ... a virus of some sort? "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #11 20110510 04:45:19
Re: Quadratic Equation SolverYes, and back problems resurfacing. Soon they will just put me to sleep and toss me out into the dumpster. In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #12 20110510 07:34:10
Re: Quadratic Equation SolverVirus will clear up. Do exercises for back. "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #13 20110510 09:17:34
Re: Quadratic Equation SolverLuckily, I do not have to shop for food. It frightens the kiddies when I am seen lurching down the street. My only hope is the the townspeople do not mistake me for Frankenstein's monster and put me to the torch. In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #14 20110510 13:52:34
Re: Quadratic Equation SolverSo, does someone else shop for you, or do you run on nuclear energy? "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #15 20110510 17:32:15
Re: Quadratic Equation SolverHi MIF;
No, I just have a big supply of food in the house. When I was a kid my grandfather used to say that I ran on atomic energy. In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #16 20111019 18:32:47
Re: Quadratic Equation SolverQuadratic Equation Solver : #17 20111019 20:50:33
Re: Quadratic Equation SolverHi; In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. #18 20111020 14:34:18
Re: Quadratic Equation SolverAlso, amit28it, your formula is not quite right. The discriminant does not include the square root, it is simply b^24ac "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman #19 20111020 20:34:32
Re: Quadratic Equation SolverHi; In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. 