Hi Waldek,

Since the method used by "possibleOrder" is random in nature,
so it doesn't harm to try a few times right?

With following patch it gives another try when encountering "division
by zero".  And now the failure rate drops to lower than 10%.  Of course
we can try more times.

- Qian

diff --git a/src/algebra/pfo.spad b/src/algebra/pfo.spad
index 22deba96..ba961c56 100644
--- a/src/algebra/pfo.spad
+++ b/src/algebra/pfo.spad
@@ -376,7 +376,12 @@ PointsOfFiniteOrder(R0, F, UP, UPUP, R) : Exports == Implementation where
     kbad3Num(h, m)   == lcm [kbadBadNum(c, m) for c in coefficients h]

     torsionIfCan d ==
-      zero?(n := possibleOrder(d := reduce d)) => "failed"
+      d := reduce d
+      nu : Union(N, "failed") := trappedSpadEval(possibleOrder(d))$Lisp
+      if nu case "failed" then nu := trappedSpadEval(possibleOrder(d))$Lisp
+      if nu case "failed" then error "tried twice"
+      n := nu::N
+      zero?(n) => "failed"
       (g := generator reduce(n::Z * d)) case "failed" => "failed"
       [n, g@R]



On 1/24/24 22:05, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
FYI,

When first used, Fricas gives division by zero on some integrals. When
called again, the error goes away. This still happens in V 1.3.10. So all
these count as failed since not possible to try again same integral as each
call uses new instance of Fricas process each time.

fricas
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
                        FriCAS Computer Algebra System
                 Version: FriCAS 1.3.10 built with sbcl 2.3.11
                  Timestamp: Wed Jan 10 09:37:52 PM CST 2024

(1) -> setSimplifyDenomsFlag(true)
(2) -> integrate(1/(2^(2/3)-x)/(x^3-1)^(1/2),x)
    >> Error detected within library code:
    catdef: division by zero

(2) -> integrate(1/(2^(2/3)-x)/(x^3-1)^(1/2),x)
    (2)
           +-+
          \|3
etc...

Same for  (with minus sign)

1) -> setSimplifyDenomsFlag(true)
    (1)  false
(2) ->  integrate(1/(2^(2/3)-x)/(-x^3-1)^(1/2),x)
    >> Error detected within library code:
    catdef: division by zero

I noticed some of these go away when not using
setSimplifyDenomsFlag(true). From new session:

1) ->  integrate(1/(2^(2/3)-x)/(-x^3-1)^(1/2),x)

            x
          ++              1
    (1)   |   ------------------------ d%B
         ++                +---------+
               3+-+2       |    3
              (\|2   - %B)\|- %B  - 1

No division by zero.

--Nasser


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/a1b7bac4-e4a6-47a6-a4f5-eb808bc65fba%40gmail.com.

Reply via email to