Post Reply 
HP Prime bug for approximate(erfc(z)), z as (0+b*i), or erf(b*i)
04-07-2024, 12:06 PM (This post was last modified: 04-10-2024 03:04 PM by Albert Chan.)
Post: #13
RE: HP Prime bug for approximate(erfc(z)), z as (0+b*i), or erf(b*i)
(11-15-2023 08:23 PM)parisse Wrote:  There is a warning of low accuracy if re(z) is small : I must indeed stop the fraction expansion and
since we do not have multiprecision floats there are some wrong digits.

Throwing more precisions may not help.
Problem is more to do with how deep "fraction expansion" default we pick.

Let n = "last" numerator --> erfc(z, n=1) = exp(-z*z)/√(pi) / (z + (1/2)/(z + 1/z))

Let z = 3.16845945394*I, precisions = 1000 digits, results rounded to integer.

erfc(z, n=0.5) = -4292 I
erfc(z, n=1.0) = -4317 I
erfc(z, n=1.5) = -4323 I
erfc(z, n=2.0) = -4324 I
erfc(z, n=2.5) = -4325 I
erfc(z, n=3.0) = -4325 I
erfc(z, n=3.5) = -4326 I
erfc(z, n=4.0) = -4311 I
erfc(z, n=4.5) = -4324 I
erfc(z, n=5.0) = -4325 I
...
erfc(z, n=19.0) = -4324 I
erfc(z, n=19.5) = -4326 I
erfc(z, n=20.0) = 58957691655 I
erfc(z, n=20.5) = -4325 I
erfc(z, n=21.0) = -4326 I
...

For z=3.16845945394*I, n=20 is really bad.
But changing n will not help. It would just shift problematic z somewhere else.

---

More precisions can't help because CF formula denominator is close to 0
But, erfc(z) is continuous ... something is going to break.

1 / ±0 = ±∞

Cas> erfc(3.16845945394*i)      → +58608047158.3*i
Cas> erfc(3.16845945395*i)      → −14620291004.7*i

CF Denomaintor = x * p(x²)/q(x²), rational polynomial with all positive terms
--> erfc CF formula for non-zero real argument will not get divide-by-0 issue.

(04-06-2024 11:04 PM)Albert Chan Wrote:  denominator may get to 0 only if re(z)=0
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP Prime bug for approximate(erfc(z)), z as (0+b*i), or erf(b*i) - Albert Chan - 04-07-2024 12:06 PM



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