Post Reply 
Mathematician Finds Easier Way to Solve Quadratic Equations
05-01-2024, 11:08 PM (This post was last modified: 05-01-2024 11:09 PM by Gerson W. Barbosa.)
Post: #26
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(05-01-2024 06:51 PM)Albert Chan Wrote:  
(05-01-2024 04:57 PM)Gerson W. Barbosa Wrote:  Given the second degree equation

\(x^2+px+q=0\)

... Then

\(x_{1}=\sqrt{q}\times e^{\cosh^{-1}{(-\frac{p}{2\sqrt{q}}})}\)

The second root can be computed as

\(x_{1} x_{2}= q\)

\(x_{2}=\frac{q}{x_{1}}\)

Nice! And, we can make formula more compact, 2 roots with ±

Yes,

\(x_{1,2}=\sqrt{q}\times e^{±\cosh^{-1}{(-\frac{p}{2\sqrt{q}}})}\)

but I am mainly interested in program optimization. Anyway we can save one step with it, but at the cost of an extra couple of bytes:


Code:

00 { 28-Byte Prgm }
01▸LBL "Q"
02 RCL÷ ST Z
03 SQRT
04 X<> ST Z
05 +/-
06 STO+ ST X
07 ÷
08 RCL÷ ST Y
09 ACOSH
10 E↑X
11 RCL× ST Y
12 X<>Y
13 RCL÷ ST L
14 END

MEM says I have 1647 bytes left on the HP-42S and 433569792 on Free42. I don’t think memory should be a concern.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Mathematician Finds Easier Way to Solve Quadratic Equations - Gerson W. Barbosa - 05-01-2024 11:08 PM



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