Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
| |
|
|
You are not logged in. #1 2011-05-07 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 2011-05-07 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #3 2011-05-07 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 2011-05-07 21:31:48
Re: Quadratic Equation SolverHi MathsIsFun, Character is who you are when no one is looking. #5 2011-05-07 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #6 2011-05-08 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 2011-05-08 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #8 2011-05-09 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 2011-05-09 15:40:47
Re: Quadratic Equation SolverHi MIF; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #10 2011-05-09 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 2011-05-10 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #12 2011-05-10 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 2011-05-10 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #14 2011-05-10 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 2011-05-10 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. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #16 2011-10-19 18:32:47
Re: Quadratic Equation SolverQuadratic Equation Solver : #17 2011-10-19 20:50:33
Re: Quadratic Equation SolverHi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #18 2011-10-20 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^2-4ac "The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman #19 2011-10-20 20:34:32
Re: Quadratic Equation SolverHi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. |