Post Reply 
A little help understanding math....
08-15-2021, 03:48 AM
Post: #5
RE: A little help understanding math....
(12-16-2013 11:56 PM)Thomas Klemm Wrote:  Let's assume \(w=u+iv\). Then
\[ \begin{align}
z&=&x+iy=cos(w)=cos(u+iv) \\
&=&cos(u)cos(iv)-sin(u)sin(iv) \\
&=&cos(u)cosh(v)-i sin(u)sinh(v) \\
\end{align} \]...
Code:
    u = acos(x/W)
    v = acosh(W)
    return u - 1j*v

There is a flaw with the code, arc function only give principle branch.
We have to match sign of imaginery part.

From above code, 0 ≤ u ≤ pi, v ≥ 0, sign(-sin(u) * sinh(v)) = negative
If y is also negative, no correction needed, else we flip sign.

This is the patch:

< return u - 1j*v
> return complex(u, v if y<0 else -v)
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 - 08-15-2021 03:48 AM



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