Post Reply 
Mathematician Finds Easier Way to Solve Quadratic Equations
Yesterday, 01:18 PM
Post: #41
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 06:31 AM)carey Wrote:  
(Yesterday 02:24 AM)Namir Wrote:  Wat's next? Solving systems of linear equations using Cramer's rule???

Namir

And what’s wrong with using Cramer’s rule for linear systems? Smile

In the late 80s I attended a programmers' conference in Boston. A speaker mentioned that he encountered a math application that was running WAY TOO SLOW! When he checked the source code, he found that the code author was using Cranmer's method to solve linear equations. You should have heard the attendees reaction .. a resounding ouuuuuuuh!!!

Just sharing!
Find all posts by this user
Quote this message in a reply
Yesterday, 01:23 PM
Post: #42
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 11:07 AM)Thomas Klemm Wrote:  
(Yesterday 02:24 AM)Namir Wrote:  Wat's next? Solving systems of linear equations using Cramer's rule???

How about using the HP-67 to evaluate the determinant of a square matrix by repeated applications of the process of pivotal condensation?

I don't see Cranmer's rule mentioned much in Numerical Analysis books when they discuss the topic of solving linear equations.`I guess these authors maintain a reasonable bar for algorithms used to solve linear equations.

Namir
Find all posts by this user
Quote this message in a reply
Yesterday, 02:47 PM
Post: #43
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 02:24 AM)Namir Wrote:  Let's keep in mind the KISS principle (keep it simple stupid), or what Einstein said, "Make it simple, but no simpler". Using fancy functions like cosh, exp, sin, and so on is fancy, but introduces a bit of complicatrion in my very humble opinion.
I strongly believe KISS doesn’t apply when you are just having fun…
Find all posts by this user
Quote this message in a reply
Yesterday, 05:45 PM (This post was last modified: Yesterday 05:47 PM by carey.)
Post: #44
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 01:18 PM)Namir Wrote:  
(Yesterday 06:31 AM)carey Wrote:  And what’s wrong with using Cramer’s rule for linear systems? Smile

In the late 80s I attended a programmers' conference in Boston. A speaker mentioned that he encountered a math application that was running WAY TOO SLOW! When he checked the source code, he found that the code author was using Cranmer's method to solve linear equations. You should have heard the attendees reaction .. a resounding ouuuuuuuh!!!

Just sharing!

Yes, Cramer's rule is awful as a numerical method, but, using symbolic determinants, as the IEEE article linked in my previous tongue-in-cheek reply shows, offers unique advantages for obtaining symbolic results, e.g., transfer functions at any point in a linear system. The classic books Network Analysis and Feedback Amplifier Design by Hendrik Bode and Control-System Dynamics by Walter Evans (originator of the root-locus method), make good use of Cramer's rule to derive symbolic results.
Find all posts by this user
Quote this message in a reply
Yesterday, 06:13 PM (This post was last modified: Yesterday 06:23 PM by Gerson W. Barbosa.)
Post: #45
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 02:24 AM)Namir Wrote:  Let's keep in mind the KISS principle (keep it simple stupid), or what Einstein said, "Make it simple, but no simpler". Using fancy functions like cosh, exp, sin, and so on is fancy, but introduces a bit of complicatrion in my very humble opinion.

I fear you have completely missed the point. We could, for instance, apply the identity \(\arcsin{z}=\arccos{\sqrt{1-z^2}}\) to

\[x_{1}=\left({\cos\left({\arcsin{\frac{\sqrt{q}}{-\frac{p}{2}}}}\right)+1}\right)\times-\frac{p}{2}\]
and easily take the trigonometric functions out of the formula. But then we would get back to the original pq formula, which as we know cannot handle, on a 12-digit calculator, the first example in Palmer’s article, a=1E-13, b=-2 and c=1, whose roots at that precision are 2E13 and 0.5, not 2E13 and zero. Of course that is not a concern on Free42 if we are interested solely in 12-digit answers.

Sure these have some shortcomings, like b or c having to be different from zero, depending on the formula we choose, or real results being shown with null imaginary parts in certain cases, for example when a=1, b=-1 and c=-2.

The use of transcendental functions are just trade-offs for a little more accuracy while keeping compactness. In a failed attempt (complex number is an invalid type for the LN1+X function), in order to keep the stack register T intact I would use – horror of horrors! – four transcendental functions in a row.

Regards,

Gerson.


———————-


Code:

00 { 26-Byte Prgm }
01▸LBL "Z"
02 X<> ST Z
03 STO÷ ST Z
04 STO+ ST X
05 +/-
06 ÷
07 RCL ST Y
08 SQRT
09 RCL÷ ST Y
10 ASIN
11 COS
12 LN1+X
13 E↑X
14 ×
15 STO÷ ST Y
16 END
Find all posts by this user
Quote this message in a reply
Yesterday, 06:41 PM
Post: #46
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 12:48 PM)Maximilian Hohmann Wrote:  But apart from that I keep wondering why the quadratic equation and it's memorized solution is attributed such a high significance by schools. I have never since finishing school come across a quadratic equation in real life. Things are mostly simple and can be handled with linear calculations ("if my plane needs 1400 pounds of fuel in one hour, how much must I take along for a 2:25h flight?") or they are really complicated and require higher order polynomials, transcendental funcions or numeric solutions. But a quadratic equation? Never ever.

Regards
Max

Hmm...there are a lot of equations in nature that involve squares (e.g., inverse square laws for electrostatics, gravity, light and sound intensity, quadratic dependence of power on current, quadratic dependence of air drag on velocity, etc.) that, in all but the simplest examples that only require taking a square root, lead to quadratic equations.

Paraphrasing Abraham Maslow, "if all you have is y=mx+b, the whole world looks like a line."
Find all posts by this user
Quote this message in a reply
Yesterday, 07:37 PM
Post: #47
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 12:48 PM)Maximilian Hohmann Wrote:  Things are mostly simple and can be handled with linear calculations
("if my plane needs 1400 pounds of fuel in one hour, how much must I take along for a 2:25h flight?")

Extra weight of fuel will require some fuel to transport.
Effect may be small, but this is not a linear calculation!
Find all posts by this user
Quote this message in a reply
Yesterday, 07:41 PM
Post: #48
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Yesterday 06:13 PM)Gerson W. Barbosa Wrote:  complex number is an invalid type for the LN1+X function

Free42/Plus42 now has C.LN1+X to handle complex input.
https://github.com/thomasokken/free42/issues/55

To make this work, LN accuracy has improved as well.
https://github.com/thomasokken/free42/issues/62
Find all posts by this user
Quote this message in a reply
Yesterday, 09:18 PM
Post: #49
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
Hello,

(Yesterday 07:37 PM)Albert Chan Wrote:  Effect may be small, but this is not a linear calculation!

Yes, but for daily work this is done using tables (until 20 years ago) or rather software on a computer (since 20 years) or an iPad App (since 10 years).

My question really remains: Who has ever, in professional or private life, used his memorised "midnight formula" (no idea if it is called that in English, in German we call it "Mitternachtsformel" because you can wake up any schoolchild at midnight and she or he will be able to recite that equation) for a real calculation? And if not, why on earth did they waste our time with this nonsense at school instead of teaching us something useful?

Regards
Max
Find all posts by this user
Quote this message in a reply
Today, 12:23 AM
Post: #50
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
Perhaps I should invoke the KISS rule to myself. The accuracy of the second root can be improved simply by calculating it as x₂ = q/x₁, x₁≠ 0, assuming of course that the first root is accurate enough. If the first root is zero the program stops and a “Divide by 0” message is shown, but then again in this case a quadratic solver is not needed.

The program has been relabeled as “Y” (why hadn’t I done it this way yet?). Only 22 bytes and 13 steps, including LBL and END.

Code:

00 { 22-Byte Prgm }
01▸LBL "Y"
02 X<> ST Z
03 STO÷ ST Z
04 STO+ ST X
05 ÷
06 ENTER
07 X↑2
08 RCL- ST Z
09 SQRT
10 X<>Y
11 -
12 STO÷ ST Y
13 END


Example:

\(10^{-13}x^2-2x+1=0\)

E +/- 13 ENTER 2 +/- ENTER 1 XEQ Q ->

HP-42S:

T: previous X
Z: previous X
Y: 0.5
X: 2.E13


Free42:

T: previous X
Z: previous X
Y: 0.500000000000012500000000000625
X: 19,999,999,999,999.4999999999999875
Find all posts by this user
Quote this message in a reply
Today, 02:32 AM
Post: #51
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Today 12:23 AM)Gerson W. Barbosa Wrote:  The accuracy of the second root can be improved simply by calculating it as x₂ = q/x₁

x1 = -p/2 + √Δ
x2 = q/x1

Not an improvement.
Depends on sign(Re(p)), we have 50:50 chance is getting both good roots, or both bad!
Find all posts by this user
Quote this message in a reply
Today, 03:11 AM
Post: #52
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(Today 02:32 AM)Albert Chan Wrote:  
(Today 12:23 AM)Gerson W. Barbosa Wrote:  The accuracy of the second root can be improved simply by calculating it as x₂ = q/x₁

x1 = -p/2 + √Δ
x2 = q/x1

Not an improvement.
Depends on sign(Re(p)), we have 50:50 chance is getting both good roots, or both bad!

I was aware of that. That’s why I added “assuming of course that the first root is accurate enough”. No problem with the few examples I tried, though. Perhaps I need a more comprehensive list of examples to check. Considering the possibilities you mention, I think it’s better to compute the second root as x₂ = -(b + x₁). At least divisions by zero are completely avoided.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)