Post Reply 
More special function confusion/annoyance
12-25-2023, 06:19 PM
Post: #4
RE: More special function confusion/annoyance
(12-25-2023 04:00 PM)Albert Chan Wrote:  Complex number support for Si(z), Ci(z) had been in XCas long time ago.
https://github.com/geogebra/giac/blob/ma...p/usual.cc

Even old XCas 1.5.0-37 (win32) had them.

XCas> Si(3+4i)      → 6.7479950814-3.49866372113*i
XCas> Ci(3+4i)      → -3.49575703398-5.17590521518*i

It is just not ported to HP Prime Cas yet.
In the meantime, this is a temporary workaround, based on mpmath expintegrals.py

Code:
#cas
si(z) :=
BEGIN
LOCAL v:=(Ei(i*z)-Ei(-i*z))*-.5i;
RETURN v - sign(im(z)) * pi/2;
END; 

ci(z) := 
BEGIN
LOCAL v:=(Ei(i*z)+Ei(-i*z))*.5;
LOCAL (x:=re(z)),(y:=im(z));
IF x>0 THEN RETURN v END;
y := x ? sign(y+!y) : sign(y)/2;
RETURN v + y*pi*i;
END; 
#end

Cas> si(3+4i)      → 6.7479950814-3.49866372113*i
Cas> ci(3+4i)      → -3.49575703398-5.17590521518*i

Good job, thanks for that. We will get to the mountain top this way.

-drl
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: More special function confusion/annoyance - deSitter - 12-25-2023 06:19 PM



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