Post Reply 
HP Prime complex division problem in CAS
11-19-2020, 07:56 PM (This post was last modified: 11-19-2020 10:24 PM by Albert Chan.)
Post: #3
RE: HP Prime complex division problem in CAS
XCas> z1 := 1e+154+2e+154*i
XCas> z2 := 2e+154+1e+154*i
XCas> z1 / z2                             → undef-undef*i
XCas> z1 / sign(z2) / abs(z2)       → 0.8+0.6*i

Tried the same way with HP Prime emulator, but failed. Sad

CAS> z1 := 1e+154+2e+154*i
CAS> z2 := 2e+154+1e+154*i
CAS> abs(z2)       → +inf

To work around the bad abs(z), I added cabs(z):
Note: maxnorm(z) = |re(z)| + |im(z)|

CAS> cabs(z) := cabs2(z, maxnorm(z))
CAS> cabs2(z,s) := abs(z/s) * s
CAS> cdiv(x,y) := cdiv2(x, y, 1./maxnorm(y))
CAS> cdiv2(x,y,s) := (x*s) / (y*s)

CAS> cabs(z2)            → 2.2360679775e154
CAS> cdiv(z1, z2)       → 0.8+0.6*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-19-2020 07:56 PM



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