Post Reply 
A little help understanding math....
06-14-2023, 04:55 PM (This post was last modified: 06-15-2023 01:37 PM by Albert Chan.)
Post: #10
RE: A little help understanding math....
(08-29-2021 12:20 AM)Albert Chan Wrote:  With signed zero, we have atan(±0 + i) = ±pi/4 + Inf*i

Technically, there is no complex number z, such that tan(z) = i
Whatever default we assigned for atan(i) is purely for convenience.
Above quoted default assumed (±0 + i) = limit((±ε + i), ε=0)

We could also start with ±0 = 0, exactly.

atan(z) = ∫(1/(1+t^2), t = 0 .. z) = z - z^3/3 + z^5/5 - z^7/7 + ...
atan(i) = i * (1 + 1/3 + 1/5 + 1/7 + ...) = i * Inf

--> atanh(1) = atan(i)/i = Inf      (*)

IEEE754_2008.pdf (page 45), atan2(±0, +0) = ±0, patched code is also simpler.
Code:
<    double x2 = x*x, ym = 1-y;
<    double u = (1+y)*ym - x2;       // 0 implied z on unit circle
<    x = atan2(2*x + (u==0), u) * 0.5;
<    y = log1p(4*y / (ym*ym + x2)) * 0.25;

>    double x2 = x*x, ym = 1-y;
>    x = atan2(2*x, (1+y)*ym - x2) * 0.5;
>    y = log1p(4*y / (ym*ym + x2)) * 0.25;

(*) atanh(1 ± 0i) = (Inf ± 0i) matched ieee behavior
https://en.cppreference.com/w/cpp/numeric/complex/atanh
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: A little help understanding math.... - Albert Chan - 06-14-2023 04:55 PM



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