01-24-2021, 11:55 PM

I know, I know, this is another quadratic equation solver for the 35s. This one, though, is a little different in two ways: a) it operates fully in the stack, modifying no variables, and b) it doesn't use any equations, so while it has more lines, it should theoretically be faster as well.

I also know this isn't one of the awesome high-performance solvers, but figuring out all the stack manipulation was a fun challenge and I'm proud of what I've made. It will find complex roots.

Usage: enter a, b, and c onto the stack, in that order, and XEQ Q (or whatever label you choose). You'll get the roots back, or if there's one root, that root on both the X and Y levels.

The checksum on my machine is 2F04, with a length of 160.

Try it out: say we want to solve 4*x^2 - 8*x + 3 = 0. To do this, you would follow these steps:

The screen should read -0.5 and -1.5.

I also know this isn't one of the awesome high-performance solvers, but figuring out all the stack manipulation was a fun challenge and I'm proud of what I've made. It will find complex roots.

Usage: enter a, b, and c onto the stack, in that order, and XEQ Q (or whatever label you choose). You'll get the roots back, or if there's one root, that root on both the X and Y levels.

The checksum on my machine is 2F04, with a length of 160.

Code:

`Q001 LBL Q`

Q002 Rdown

Q003 x^2

Q004 Rup

Q005 4

Q006 *

Q007 Rup

Q008 *

Q009 ENTER

Q010 Rdown

Q011 Rdown

Q012 rootx

Q013 ENTER

Q014 x^2

Q015 Rup

Q016 -

Q017 x<0?

Q018 GTO A020

Q019 GTO A025

Q020 ABS

Q021 rootx

Q022 i

Q023 *

Q024 GTO A026

Q025 rootx

Q026 ENTER

Q027 Rdown

Q028 Rdown

Q029 +/-

Q030 ENTER

Q031 Rup

Q032 +

Q033 LASTx

Q034 x<>y

Q035 Rdown

Q036 -

Q037 x<>y

Q038 /

Q039 ENTER

Q040 Rdown

Q041 Rdown

Q042 LASTx

Q043 /

Q044 2

Q045 /

Q046 Rdown

Q047 Rdown

Q048 2

Q049 /

Q050 Rup

# swap to make output like the three-var one

Q051 x<>y

Q052 RTN

Try it out: say we want to solve 4*x^2 - 8*x + 3 = 0. To do this, you would follow these steps:

Code:

`4 [ENTER] -8 [ENTER] 3`

XEQ Q

The screen should read -0.5 and -1.5.