An improvement to tantrick:
I met one example in mapleok.input that
a = 1/expa , b = expb
resulting atan(1/(expa*expb)).
This patch is to handle that kind of case.
Also see my comment in the patch, I didn't test sign of c and d.
The chance that sign(a) and sign(b) is "failed" while sign(c) or
sign(d) is not "failed" is slim, but not zero. Should we do it?
diff --git a/src/algebra/irexpand.spad b/src/algebra/irexpand.spad
index be530014..5479138c 100644
--- a/src/algebra/irexpand.spad
+++ b/src/algebra/irexpand.spad
@@ -104,12 +104,18 @@
-- they differ by a constant so it's ok to do it from an IR
tantrick(a, b) ==
retractIfCan(a)@Union(Q, "failed") case Q => 2 * atan(-b/a)
+ ab := a/b
+ c := numer(ab)::F
+ d := denom(ab)::F
+ retractIfCan(c)@Union(Q, "failed") case Q => 2 * atan(-d/c)
+ retractIfCan(d)@Union(Q, "failed") case Q => 2 * atan(ab)
sb := sign b
- if sb case Z then return 2 * atan(a/b)
+ if sb case Z then return 2 * atan(ab)
sa := sign a
- if sa case Z then return 2 * atan(-b/a)
+ if sa case Z then return 2 * atan(-d/c)
+ -- currently not testing the sign of c and d
-- print("potentially noncontinuous"::OutputForm)
- 2 * atan(a/b)
+ 2 * atan(ab)
-- transforms i log((a + i b) / (a - i b)) into a sum of real
-- arc-tangents using Rioboo's algorithm
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.