Post Reply 
Mathematician Finds Easier Way to Solve Quadratic Equations
04-24-2024, 04:14 AM (This post was last modified: 04-25-2024 05:17 PM by Gerson W. Barbosa.)
Post: #6
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(04-23-2024 11:19 PM)Gerson W. Barbosa Wrote:  Same usage of this quadratic solve and same number of steps. This first attempt takes up one extra byte, though.

Second attempt. Same size, same number of steps:

Code:

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

P.S.:

Exactly the same program, actually. But I don’t remember I had previously used this method.

P.P.S.:

HP-41 version:

Code:

 01 LBL "Q"
 02 X<> Z
 03 CHS
 04 ST/ Z
 05 ST+ X
 06 /
 07 STO Z
 08 X^2
 09 +
 10 SQRT
 11 ST- Y
 12 ST+ X
 13 RCL Y
 14 +
 15 END

28 bytes

Notice these preserve the original stack register X.
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 - 04-24-2024 04:14 AM



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