Tcl Library Source Code

View Ticket
Login
Ticket UUID: 5af6381a8be0d5a87505d7e28203fe69fa2b3019
Title: Quadratic Equation Solution, 2 reals from Muller's method
Type: Patch Version: 8.6
Submitter: anonymous Created on: 2021-07-03 19:38:28
Subsystem: math Assigned To: arjenmarkus
Priority: 5 Medium Severity: Cosmetic
Status: Open Last Modified: 2021-09-18 08:30:05
Resolution: None Closed By: nobody
    Closed on:
Description:
Subject. Quadratic Equation Solution, 2 reals from Muller's method
 Request real solutions from 2nd order quadratic equation in TCLLIB. Proc should return  the real solution 1 or real solutions 1&2 from quadratic coefficients. Looking for real roots only here, discriminant => 0. Boiled down from evaluating discriminant, there are three possible real outcomes from 2nd order quadratic equation as follows: 1) discriminant $discriminant_2 > 0 has two real roots. 2) discriminant $discriminant_2 == 0 has one real root. 3) discriminant $discriminant_2 < 0 has two complex non-real roots. There are some 2nd order solutions that have no real solutions. Note that Muller's method or rearranged 2C formula avoids significant figure problem (somewhat). TCL may use math ops to eval rational fractions as inputs to subroutine for more significant figures. First argument is 3 execution options. option == 1 , return positive solution, option == 2 , return negative and positive solutions , option == 3 , return negative and positive solutions with diagnostics. 

Possible sources of error in numerical analysis. References reported potential error in significant figures from subtracting nearly equal quantities in formula. Also, when the two real roots are very close, cancellation may occur between the terms b2 and 4ac of the discriminant. Possibly diagnostics in subroutine should flag when these conditions are approached? 

If we put code for the real solutions for the 2nd order quadratic equations in the TCLLIB library. Maybe somebody will donate the code for the possible complex solutions, cubic solutions, quartic solutions, and diagnostics.  Thank you.

References.
********
https://wiki.tcl-lang.org/page/Ask%2C+and+it+shall+be+given+%23+13
Quadratic equations using TCLLIB
*******
But I am looking at the files in TCLLIB math and don't recognize the quadratic solution proc section. Thank you.
****** 
(AM) There is none, if you mean to solve a second-degree equation. The references to "quadratic" in the math module are all for very different entities.
*****
 7/2/2012. I'll write a small proc to solve reals in quadratic equations and put a ticket in the TCLLIB que. There was an interesting note on the quadratic equation in Wikipaedia. Thank you.
https://wiki.tcl-lang.org/page/Math+proc+templates+for+Prime+Number+generation+and+TCL+demo+example%2C+numerical+analysis?V=167
http://www.tcl-lang.org/community/tcl2015/assets/talk9/xra-slides.pdf
https://rosettacode.org/wiki/Roots_of_a_quadratic_function
https://wiki.tcl-lang.org/page/Seaching+for+Babylonian+Triplets+Slot+Calculator+Example
https://en.wikipedia.org/wiki/Quadratic_equation
https://en.wikipedia.org/wiki/Quadratic_function
https://en.wikipedia.org/wiki/Polynomial
https://en.wikipedia.org/wiki/Cubic_equation
https://en.wikipedia.org/wiki/Quartic_equation
Since the 16th century, similar formulas (using cube roots in addition to square roots), but much more complicated are known for equations of degree three and four (see cubic equation and quartic equation)

Attachments: