(35S) Smart quadratic equation solver with complex roots
|
05-06-2017, 10:36 AM
(This post was last modified: 06-15-2017 01:15 PM by Gene.)
Post: #1
|
|||
|
|||
(35S) Smart quadratic equation solver with complex roots
Yet another quadratic solver, but I love mine because:
- it preserves all the variables of the calculator - it uses only the stack (input and output) - it computes real or complex roots - it displays a text notifying if there are 1 or 2 real roots, or 2 complex roots Equation is of the form: a.x² + b.x + c = 0 Determinant is: delta = b² - 4.a.c Stack before the program: Z: a Y: b X: c Run the program: XEQ Q It first shortly displays one of the following messages:
2 REAL ROOTS 2 CPLX ROOTS Stack after: T: b Z: delta (determinant) Y: x1 (first root) X: x2 (second root) Code of the solver: Code:
To check the code: 2.x²+3.x+4=0 2 ENTER 3 ENTER 4 XEQ Q ENTER should give: 2 CPLX ROOTS Z: -23.0000 Y: -0.7500 i 1.1990 X: -0.7500 i -1.1990 2.x²+7.x+3=0 2 ENTER 7 ENTER 3 XEQ Q ENTER should give: 2 REAL ROOTS Z: 25.0000 Y: -0.5000 X: -3.0000 2.x²-12.x+18=0 2 ENTER 12 +/- ENTER 18 XEQ Q ENTER should give: SINGLE ROOT Z: 0.0000 Y: 3.0000 X: 3.0000 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)