Closed nasser1 closed 3 years ago
It's a mix of two problems:
There is a strange problem in FriCAS:
(1) -> f := (%i*a*tan(d*x + c) + a)^3*tan(d*x + c)
(1)
3 4 3 3 3 2
- %i a tan(d x + c) - 3 a tan(d x + c) + 3 %i a tan(d x + c)
+
3
a tan(d x + c)
Type: Expression(Complex(Integer))
(2) -> integrate(f, x)
>> System error:
arithmetic error DIVISION-BY-ZERO signalled
Operation was (/ -2 0).
and, of course, the error handling of the sage-FriCAS interface is less than perfect.
I'll report the bug on the FriCAS list.
Description changed:
---
+++
@@ -1,3 +1,7 @@
+There seems to be a problem with complex integrands in FriCAS. In any case, it would be good to have at least slightly better error handling.
+
+Old description:
+
I am not sure what is missing translation from FriCAS result to [SageMath](../wiki/SageMath) here, and do not know if this is known of not. Thought to report it just in case but feel free to close if this is known.
Large number of such integrals fail because of this. Here is an example
Upstream: Reported upstream. Developers acknowledge bug.
Description changed:
---
+++
@@ -1,6 +1,30 @@
+FriCAS has a problem with the following integral:
+>
+> ```
+> (1) -> f := (%i*a*tan(d*x + c) + a)^3*tan(d*x + c)
+>
+> (1)
+> 3 4 3 3 3 2
+> - %i a tan(d x + c) - 3 a tan(d x + c) + 3 %i a tan(d x + c)
+> +
+> 3
+> a tan(d x + c)
+> Type: Expression(Complex(Integer))
+> (2) -> integrate(f, x)
+>
+> >> System error:
+> arithmetic error DIVISION-BY-ZERO signalled
+> Operation was (/ -2 0).
+> ```
+>
+
+Replacing the imaginary unit with a parameter makes the problem go away. This bug can only be fixed by the FriCAS team.
+
+Old description:
+
There seems to be a problem with complex integrands in FriCAS. In any case, it would be good to have at least slightly better error handling.
-Old description:
+Very old description:
I am not sure what is missing translation from FriCAS result to [SageMath](../wiki/SageMath) here, and do not know if this is known of not. Thought to report it just in case but feel free to close if this is known.
works now (9.2.b4)
sage: var('a d x c')
(a, d, x, c)
sage: integrate((I*a*tan(d*x + c) + a)^3*tan(d*x + c),x, algorithm="fricas")
-2/3*(24*a^3*e^(4*I*d*x + 4*I*c) + 33*a^3*e^(2*I*d*x + 2*I*c) + 13*a^3 + 6*(a^3*e^(6*I*d*x + 6*I*c) + 3*a^3*e^(4*I*d*x + 4*I*c) + 3*a^3*e^(2*I*d*x + 2*I*c) + a^3)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) + d)
Replying to @fchapoton:
works now (9.2.b4)
sage: var('a d x c') (a, d, x, c) sage: integrate((I*a*tan(d*x + c) + a)^3*tan(d*x + c),x, algorithm="fricas") -2/3*(24*a^3*e^(4*I*d*x + 4*I*c) + 33*a^3*e^(2*I*d*x + 2*I*c) + 13*a^3 + 6*(a^3*e^(6*I*d*x + 6*I*c) + 3*a^3*e^(4*I*d*x + 4*I*c) + 3*a^3*e^(2*I*d*x + 2*I*c) + a^3)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) + d)
Thanks. It is also working on V 9.2 on Linux:
>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24 │
│ Using Python 3.8.6. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: var('a d x c')
(a, d, x, c)
sage: integrate((I*a*tan(d*x + c) + a)^3*tan(d*x + c),x,algorithm="fricas")
-2/3*(24*a^3*e^(4*I*d*x + 4*I*c) + 33*a^3*e^(2*I*d*x + 2*I*c) + 13*a^3 + 6*(a^3*e^(6*I*d*x + 6*I*c) + 3*a^3*e^(4*I*d*x + 4*I*c) + 3*a^3*e^(2*I*d*x + 2*I*c) + a^3)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) + d)
sage:
Changed upstream from Reported upstream. Developers acknowledge bug. to Completely fixed; Fix reported upstream
I don't know in which release of FriCAS this was fixed, though.
this need a doctest
Author: Martin Rubey
I was unable to find a simple way to verify the integral. I did some random checks, though.
New commits:
6a81817 | add doctest |
Reviewer: Frédéric Chapoton
ok, thx
Changed branch from u/mantepse/bug_in_fricas_integration to 6a81817
FriCAS has a problem with the following integral:
Replacing the imaginary unit with a parameter makes the problem go away. This bug can only be fixed by the FriCAS team.
Old description:
There seems to be a problem with complex integrands in FriCAS. In any case, it would be good to have at least slightly better error handling.
Very old description:
I am not sure what is missing translation from FriCAS result to SageMath here, and do not know if this is known of not. Thought to report it just in case but feel free to close if this is known.
Large number of such integrals fail because of this. Here is an example
Which gives
The above works OK in friCAS itself:
Is it the complex number I which is causing the translation back to SageMath?
Upstream: Completely fixed; Fix reported upstream
CC: @mantepse
Component: symbolics
Keywords: fricas, integrate
Author: Martin Rubey
Branch/Commit:
6a81817
Reviewer: Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/25905