Post Reply 
HP Prime complex division problem in CAS
11-27-2020, 11:05 PM
Post: #21
RE: HP Prime complex division problem in CAS
(11-27-2020 08:30 AM)lyuka Wrote:  I found relatively simple workaround for complex division in CAS,
that is to apply scaling process to Smith's method (1962).

Unlike IEEE double, HP Prime does not support gradual underflow.
It does not do flush-to-zero either.

CAS> MINREAL/2             → 2.2250738585e−308
CAS> MINREAL/2^47       → 2.2250738585e−308
CAS> MINREAL/2^48       → 0.

With this underflow behavior, it may be best to scale up, to some safe maximum value.

Smith's method, with u = IM(y)/RE(y), |u| ≤ 1 : x/y = x * (1 - u*i) / (RE(y) + u*IM(y))

As long as x, y parts at or below MAXREAL/2, RHS numerator and denominator will not overflow.

x/y = cdiv_smith(x*s, y*s), where s = (MAXREAL/2) / max(|RE(x)|,|IM(x)|,|RE(y)|,|IM(y)|)

Example, with g = MAXREAL/2:

(2g + 2g*i) / (g + 2g*i)
= (g + g*i) / (0.5*g + g*i)                                        // scaled by s = g / (2g) = 0.5
= conj((g + g*i) / (g + 0.5*g*i))                               // flip to force u=0.5, |u| ≤ 1
= conj((g + g*i) * (1 - 0.5*i)) / (g + 0.5*(0.5*g))      // smith method
= (1.5*g - 0.5*g*i) / (1.25*g)
= 1.2 - 0.4*i
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP Prime complex division problem in CAS - Albert Chan - 11-27-2020 11:05 PM



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