Post Reply 
Mathematician Finds Easier Way to Solve Quadratic Equations
05-02-2024, 02:00 PM (This post was last modified: 05-05-2024 09:21 PM by Albert Chan.)
Post: #27
RE: Mathematician Finds Easier Way to Solve Quadratic Equations
(05-01-2024 11:08 PM)Gerson W. Barbosa Wrote:  \(x_{1,2}=\sqrt{q}\times e^{±\cosh^{-1}{(-\frac{p}{2\sqrt{q}}})}\)

exp/cosh quadratic formula avoided subtraction canellation, but introduced another.
Exponential function slope is also an exponential function!

e^(x*(1-ε)) ≈ e^x - (x*e^x)*ε

RelErr(x) = ε      ⇒ RelErr(e^x) = (exact - approx) / exact ≈ (x*e^x)*ε / e^x = x*ε

Fortunately, acosh is similar to log, keeping size of x in check.
Still, Trig (tan/asin) quadratic version is perhaps more accurate.

Code:
00 { 24-Byte Prgm }
01▸LBL "T"          ; c     b   a
02 RCL÷ ST Z        ; q     b   a
03 SQRT             
04 X<> ST Z         ; a     b   √q
05 +/-              
06 ENTER            
07 +                ; -2a   b   √q   √q
08 ÷                
09 ÷                ; -2√q/p    √q   √q
10 ASIN
11 2
12 ÷
13 TAN
14 STO× ST Z
15 ÷
16 END

1E-13 Enter -2 Enter 1 XEQ "Q"
Y : 19,999,999,999,999.49999999999998749992      // error = 8 ULP
X : 5.000000000000125000000000006250021e-1     // error = -21 ULP

1E-13 Enter -2 Enter 1 XEQ "T"
Y: 5.000000000000125000000000006250001e-1       // error = -1 ULP
X: 19,999,999,999,999.4999999999999875              // error = 0 ULP

There is another issue. acosh(x) has real domain x≥1
Trig quadratic version does not have this problem. (tan/asin both odd functions)

1E-13 Enter 2 Enter 1 XEQ "Q"
Y: -19,999,999,999,999.49999999999998749992-2.31605661201243998216520079425921e-21i
X: -0.500000000000012500000000000625002+5.790141530031389462489503558740034e-35i

1E-13 Enter 2 Enter 1 XEQ "T"
Y: -5.000000000000125000000000006250001e-1
X: -19,999,999,999,999.4999999999999875

Update: here is e^asinh version. Determinant Δ = (p/2)² - q
It has the same RelErr(e^x) issue ... not recommended.

\(
x_{1,2}=
\sqrt{q}× e^{±\sinh^{-1} \sqrt{\frac{Δ}{q}} }
\)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Mathematician Finds Easier Way to Solve Quadratic Equations - Albert Chan - 05-02-2024 02:00 PM



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