(11C) Quadratic Equation

03212018, 06:50 AM
(This post was last modified: 03232018 05:51 AM by Gamo.)
Post: #1




(11C) Quadratic Equation
The program calculates the real or complex solutions of a quadratic equation.
aX^2 + bX + c = 0 c [ENTER] > b [ENTER] > a > [LBL A] briefly shown [+] or [] solution. If Positive (+) then two real solutions with R/S for second answer. If Negative () then two complex solutions with X<>Y for complex of +, Program: Code:
Example: 1) 2x^2 + 5x + 3 = 0 3 ENTER 5 ENTER 2 [A] > 0.0625 (Show briefly with positive) so the solutions are real: Answer: 1.5 > [R/S] > 1 X={1.5, 1} 2) 2x^2 + 3x + 4 = 0 4 ENTER 3 ENTER 2 [A] > 1.4375 (Show briefly with negative) so the solutions are complex: Answer: 0.75 > [X<>Y] > 1.1990 round to 1.2 x1 = 0.75 + 1.2i x2 = 0.75  1.2i 3) Here are examples of quadratic equations lacking the linear coefficient or the “bX”: 6x² + 144 = 0 144 ENTER 0 ENTER 6 [A] > 24 (Briefly show negative) solution are complex: Answer: 0 > [X<>Y] > 4.8990 x1 = 4.8990i x2 = 4.8990i x² – 16 = 0 16 CHS ENTER 0 ENTER 1 [A] > (Briefly show positive) solution are real. Answer: 4 > [R/S] > 4 x={4, 4} 4) Here are examples of quadratic equations lacking the constant term or “c”: 2x² + 8x = 0 0 ENTER 8 ENTER 2 [A] > (Briefly show positive) real solution. Answer: 4 [R/S] > 0 x={0, 4} Gamo 

03222018, 10:18 AM
(This post was last modified: 03222018 11:58 AM by Dieter.)
Post: #2




RE: (11C) Quadratic Equation
(03212018 06:50 AM)Gamo Wrote: The program calculates the real or complex solutions of a quadratic equation. One of my first books on RPN and HP calculators also had a program for quadratic equations. To distinguish real and complex solutions it displayed "1111111111" for the latter case. In the calculator display this looks like a line of "i"s that indicate a solution with an imaginary part. ;) I like this idea, so here is an adapted version. It differs from yours in three points:  The coefficients are entered a [ENTER] b [ENTER] c  Two real solutions are directly returned in X and Y  An imaginary solution is indicated by a line of 1s, then real and imaginary part are returned in X and Y again. Edit: The program now also handles a=0, i.e. a simple linear equation. The previous versions returned an error in this case. Code: LBL A Examples: 2x² + 5x + 3 = 0 2 [ENTER] 5 [ENTER] 3 [A] => –1,0000 [X↔Y] –1,5000 Two real solutions: –1 and –1,5. 2x² + 3x + 4 = 0 2 [ENTER] 3 [ENTER] 4 [A] => "1111111111" –0,7500 [X↔Y] 1,1990 Two conjugate complex solutions: –0,75 ± 1,199 i BTW, for those who want to try more sophisticated quadratic equation solvers: take a look at the HP15C Advanced Functions Handbook (appendix, "Example 6 continued"). It includes a special version of such a program that shows how the limitations of the standard methods can be overcome. However, note that this solves ax²–2bx+c=0. Dieter 

08112018, 10:34 AM
Post: #3




RE: (11C) Quadratic Equation
(03222018 10:18 AM)Dieter Wrote: BTW, for those who want to try more sophisticated quadratic equation solvers: take a look at the HP15C Advanced Functions Handbook (appendix, "Example 6 continued"). It includes a special version of such a program that shows how the limitations of the standard methods can be overcome. However, note that this solves ax²–2bx+c=0. Cf. Solve the real quadratic equation \(c2bz+az^2=0\) for real or complex roots. 

08112018, 04:39 PM
(This post was last modified: 09062018 11:49 AM by Albert Chan.)
Post: #4




RE: (11C) Quadratic Equation
(03222018 10:18 AM)Dieter Wrote: One of my first books on RPN and HP calculators also had a program for quadratic equations. I did a Quadratic Solver for Casio FX3650P: Instead of using a special number for signaling complex roots. I CRASH the program, on purpose, by taking square root of negative discriminant. (complex roots = X +/ Y * I, stored in memory X, Y) If user is still not warned about roots being complex, I don't know what will :) Edit: I had revised the solver, allowed for adjustable discriminant (if more precise available). Since discriminant is shown, it's sign signaled real or complex roots. 

« Next Oldest  Next Newest »

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