HP Forums

Full Version: new way to make quadratic equations easy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

Simpler? I watched the video. I am not convinced. And what if the coefficients are not integers?

Regards
Max
(07-30-2021 11:42 AM)Maximilian Hohmann Wrote: [ -> ]Hello!

Simpler? I watched the video. I am not convinced. And what if the coefficients are not integers?

Regards
Max

If they are not integers,
I give up!
(I was/am not good at quadratics, it is sort of the reason I hang around this forum like a rock star groupie, I am so awed by people able to find i or some other negative number as the root!)
Seems to work with non-integers. I wrote an HP-41CX program that takes the roots, forms the coefficients B and C of the quadratic equation, and then solves it. Input and output values match!
Here is an HP41/42 Implementation using only the stack. The stack starts with C in register Y and B in register X: The two roots will be in registers X and Y.

Code:

LBL A
STO Z
2
/
X^2
-
CHS
SQRT 
STO Z
X<>Y
2
/
CHS
STO T
X<>Y
-
X<>Y
RCL T
+
RTN
(07-31-2021 04:22 AM)Namir Wrote: [ -> ]Seems to work with non-integers.

It also works for complex roots or complex coefficients, here is an illustration for a complex capable HP-15C:

Code:
IN :   Y:  c     X:  b       from reduced quadratic equation x²+b.x+c = 0  (EQ.1)

001-       2     2                                           009-43,30, 2   g x<0 ?    (Test 2)
002-      16     CHS                                         010-43, 4, 8   g SF 8     Automaticaly set complex mode in case of complex root(s)
003-      10     ÷        Compute m = (z1+z2)/2 = -b/2       011-      11     √x       Compute u=±√(m² - z1.z2) =±√(b²/4 - c)
004-      36     ENTER                                       012-      30     -        Compute z2=m-u
005-      36     ENTER                                       013-  43  33   g R↑     
006-  43  11   g x²                                          014-  43  36   g LSTx
007-  43  33   g R↑                                          015-      40     +        Compute z1=m+u
008-      30     -                    
                                                             OUT :   y: z2=m-u   X: z1=m+u  both solutions of (EQ.1)


Usage : Enter real or complex reduced coefficients c and b in stack at respectively level Y: and X: and run the code.
HP-15C 's complex mode automatically engage at complex value entries or when any of the two roots is complex.

This code, despite using a different method is really close to the one I post yesterday using old-school method.

Usage Example : \( (3-i).z^2+(-49+33i).z+120-90i = 0 \)

Enter c coefficient : [ 1 ][ 2 ][ 0 ][ENTER] [ 9 ][ 0 ][CHS] f[ I ] (note that the 'c' annunciators lit on)
Reduce c by a : [ 3 ][ENTER] [ 1 ][CHS] f[ I ] [ ÷ ] display reduced c : " 45.00000 c " Press f[(i)] to see imaginary part "-15.00000 c"
Enter b: [ 4 ][ 9 ][CHS][ENTER] [ 3 ][ 3 ] f[ I ]
Reduce b by a : g[LSTx] [ [ ÷ ] display reduced b : "-18.00000 c " Press f[(i)] to see imaginary part " 5.0000"

The reduced quadratic equation is now : \( z^2+(-18+5i).z+(45-15i)=0 \)

Press [R/S] to run code.
Real part of first root is " 15.00000 "
Press and hold f[(i)] key to see imaginary part of first root: "-5.00000 "
Press [X↔Y] to display the second root real part : " 3.00000 "
Press and hold f[(i)] to display the second root’s imaginary part: " 0.00000 "

The quadratic equation \( (3-i).z^2+(-49+33i).z+120-90i = 0 \) have one complex root \(z_1=15-5i\) and one real root \(x_2=3 \)
Updated version (using stack only) to handle real and complex solutions for real values of B and C.

Code:
LBL A
CF 00
STO Z
2
/
X^2
-
CHS
X<0?
GTO 00
SQRT 
STO Z
X<>Y
2
/
CHS
STO T
X<>Y
-
X<>Y
RCL T
+
RTN
LBL 00
CHS
SQRT 
X<>Y
-2
/
SF 00
RTN

If flag 00 remains clear at the end of the calculations you have two real roots in the X and Y registers. If flag 00 is set at the end of the calculations thenn you have the solutions:

x1 = regX + i regY
x2 = regX - i regY

Namir
(07-31-2021 10:19 AM)C.Ret Wrote: [ -> ]... The reduced quadratic equation is now : \( z^2+(-18+5i).z+(45-15i)=0 \)

We can also solve quadratics with half-angle formula, see (HP-67) Barkers's Equation

Let c = cot(θ/2)       → cot(θ) = (c²-1) / (2c)       → c² - 2*cot(θ)*c - 1 = 0

x² - 2*cot(θ)*x - 1 = (x - c)*(x + 1/c)

Let x = z/n, to scale constant term to -n², instead of -1.
In other words, solve for z² - 2*m*z - n² = 0

XCas> m,n := (-18.+5i)/-2, sqrt(-(45.-15i))
XCas> proot([1, -2m, -n*n])                                    → [3.0, 15.0-5.0*i]
XCas> -n*tan(atan(n/m)/2), n/tan(atan(n/m)/2)       → [3.0, 15.0-5.0*i]

Or, with "built-in" quadratic solver, asinh:

sinh(x) = (e^x - e^-x)/2       → (e^x)² - 2*sinh(x)*e^x - 1 = 0

XCas> -n/exp(asinh(m/n)), n*exp(asinh(m/n))         → [3.0, 15.0-5.0*i]

Since asinh(x) is odd function, z = ±n*exp(asinh(m/±n))

---

We can also solve for z² - 2*m*z + n² = 0

XCas> m,n := (-18+5i)/-2., sqrt(45.-15i)
XCas> proot([1, -2m, n*n])                                    → [3.0, 15.0-5.0*i]
XCas> n*tan(asin(n/m)/2), n/tan(asin(n/m)/2)        → [3.0, 15.0-5.0*i]
XCas> n/exp(acosh(m/n)), n*exp(acosh(m/n))        → [3.0, 15.0-5.0*i]

Again, combine both roots, z = n*exp(±acosh(m/n))
I was surprised to learn that roots for quadratic equations could be solved using a slide rule, described in the manual for the Post Versalog:

Quote:If any quadratic equation is transformed into the form x^2 + Ax + B = 0, the roots or values of the unknown x may be determined by a simple method, using the slide rule scales. We let the correct roots be -x_1 and -x_2. By factoring, (x + x_1)(x + x_2) = 0. The terms -x_1 and -x_2 will be the correct values of x providing the sum x_1 + x_2 = A and the product of x_1 * x_2 = B. An index of the CI scale may be set opposite the number B on the D scale. With the slide in this position, no matter where the hairline is set, the product of simultaneous CI and D scale readings or of simultaneous CIF and DF scale readings is equal to B. Therefore it is only necessary to move the hairline to a position such that the sum of the simultaneous CI and D scale readings, or the sum of the simultaneous CIF and DF scale readings, is equal to the number A.

As an example, the equation x^2 + 10x + 15 = 0 will be used. We set the left index of CI opposite the number 15 on the D scale. We then move the hairline until the sum of CI and D scale readings, at the hairline, is equal to 10. This occurs when the hairline is set at 1.84 on D, the simultaneous reading on CI being 8.15. The sum x_1 + x_2 = 1.84 + 8.15 = 9.99, sufficiently close to 10 for slide rule accuracy. Roots or values of x are therefore -x_1 = -1.84 and -x_2 = -8.15. Obviously the values of x solving the equation x^2 – 10x + 15 = 0 will be +1.84 and +8.15 since in this case A is negative, equal to -10.

As a second example the equation x^2 – 12.2x - 17.2 = 0 will be used. The left index of CI is set on 17.2 on the D scale. Since this number is actually negative, -17.2, and since it is the product of x_1 and x_2, obviously one root must be positive, the other negative. Also the sum of x_1 and x_2 must equal -12.2. We therefore move the hairline until the sum of simultaneous scale readings is equal to -12.2. This occurs when the hairline is set on 13.5 on the DF scale, the simultaneous reading at the hairline on CIF being 1.275. x_1 is therefore -13.5 and x_2 is 1.275, since x_1 + x_2 = -13.5 +1.275 = -12.225, sufficiently close to -12.2 for slide rule accuracy. The values of x solving the equation are therefore -x_1 = 13.5 and -x_2 = -1.275.
Interseting article. I do have a "small" collection of slide rules. I used them in high school and during the first part of my engineering education until I got a Sharp scientific calculator and soon after than an HP-55 (in 1975).

My favorite slide rule is a big Aristo (with a two-piece support stand) that my father bought me from Lausanne, Switzerland, in 1971. I only brought it to final exams. I never brought the HP-55 to college.

I think slide rules are amazing in their own right. But, the HP-35 ushered their demise.

Namir
(08-06-2021 12:40 AM)Namir Wrote: [ -> ]Interseting article. I do have a "small" collection of slide rules. [...]
I think slide rules are amazing in their own right. But, the HP-35 ushered their demise.

Namir

I think my "collection" is <30, it includes a concrete calculator given to customers of a Ready-Mix company, and an Addiator, oh, and a paper flight slide rule (Jeppeson?)

I did buy a non-functioning slide rule tie tack on TAS a while back, so I don't think that counts.
(08-04-2021 04:57 AM)Benjer Wrote: [ -> ]I was surprised to learn that roots for quadratic equations could be solved using a slide rule, described in the manual for the Post Versalog:

I was also really surprise, so I grasp my father's Graphoplex REITZ n°620 and it's very short manual where no mention about how to solve a quadratic equation is present. So I reinserted this manual in the red cardboard box and try the two examples.

Here is a capture for the resolution of the first example : \( x^2+10x+15=0 \) . The trick is to mentally add value form the CI and the D scale. I get a hard time to found at which position I have to start seeking. To help me, I move the hairline (the middle hairline in red) to look for a sum as close as 10 as possible. Finally, the position of the middle hairline indicate the two roots on the CI and D scale respectively.

[attachment=9708]

(Note: the HP-15C armed with quadratic solving code is only showing one root at a time).

For the second example of equation \( x^2–12.2x-17.2=0 \), I check with an HP Prime to have the two roots on the display. I only realize after a few attempts, that since there is no CIF and DF scale on this slide rule I need to use the right index of CI set on 17.2 on the D scale. Then, the procedure is usingthe D and CI scales but the substraction have to match 12.2 as close as possible.

[attachment=9709]


P.S.: Please note that on this slide rule, scale CI and D have respectively black B and red a labels (original Graphoplex: French Règle à Calculs).

EDIT:
Is that a new way to make the quadratic equation solving esay ?
- new ? With a slide rule from 1958 ?
- easy ? scanning for adding or substrating values on D and CI scale ?
Reference URL's