Opened 3 years ago

Closed 17 months ago

#29043 closed defect (duplicate)

Doctest integrating (I*a*tan(d*x + c) + a)*sec(d*x + c)^10 via FriCAS

Reported by: Nasser Owned by: Nasser
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: interfaces Keywords: integrate symbolic, FriCAS
Cc: Martin Rubey Merged in:
Authors: Nasser Abbasi Reviewers: Martin Rubey
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: u/mantepse/notimplementederror__the_translation_of_the_fricas_object_sage2_to_sage_is_not_yet_implemented (Commits, GitHub, GitLab) Commit: fac7faea7ae0c32cbedae596d5dfe41e30a17b4b
Dependencies: Stopgaps:

Status badges

Description (last modified by Samuel Lelièvre)

Using SageMath 8.9 with FriCAS 1.3.5, in one test file I have, I see many integrals fail with same error

sage: integrate((I*a*tan(d*x + c) + a)*sec(d*x + c)^10,x, algorithm="fricas")
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-7-586bc09b0cfc> in <module>()
----> 1 integrate((I*a*tan(d*x + c) + a)*sec(d*x + c)**Integer(10),x, algorithm="fricas")

/usr/lib/python2.7/site-packages/sage/misc/functional.pyc in integral(x, *args, **kwds)
    751     """
    752     if hasattr(x, 'integral'):
--> 753         return x.integral(*args, **kwds)
    754     else:
    755         from sage.symbolic.ring import SR

/usr/lib/python2.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.integral (build/cythonized/sage/symbolic/expression.cpp:64032)()
  12360                     R = ring.SR
  12361             return R(integral(f, v, a, b, **kwds))
> 12362         return integral(self, *args, **kwds)
  12363 
  12364     integrate = integral

/usr/lib/python2.7/site-packages/sage/symbolic/integration/integral.pyc in integrate(expression, v, a, b, algorithm, hold)
    910         if not integrator:
    911             raise ValueError("Unknown algorithm: %s" % algorithm)
--> 912         return integrator(expression, v, a, b)
    913     if a is None:
    914         return indefinite_integral(expression, v, hold=hold)

/usr/lib/python2.7/site-packages/sage/symbolic/integration/external.pyc in fricas_integrator(expression, v, a, b, noPole)
    393             result = ex.integrate(seg)
    394 
--> 395     result = result.sage()
    396 
    397     if result == "failed":

/usr/lib/python2.7/site-packages/sage/interfaces/interface.pyc in sage(self, *args, **kwds)
   1079             [0 0]
   1080         """
-> 1081         return self._sage_(*args, **kwds)
   1082 
   1083     def __repr__(self):

/usr/lib/python2.7/site-packages/sage/interfaces/fricas.pyc in _sage_(self)
   1909             return R(unparsed_InputForm)
   1910 
-> 1911         raise NotImplementedError("the translation of the FriCAS object %s to sage is not yet implemented" % (unparsed_InputForm))
   1912 
   1913 

NotImplementedError: the translation of the FriCAS object sage2 to sage is not yet implemented

Here are more examples:

integrate((I*a*tan(d*x + c) + a)*sec(d*x + c)^10, x, algorithm="fricas")

integrate((I*a*tan(d*x + c) + a)*sec(d*x + c)^8, x, algorithm="fricas")

There are 10's or 100's of similar integrals, all fail with same error. But they work in FriCAS:

(6) -> ii:=integrate(cos(d*x+c)/(a+I*a*tan(d*x+c))^2,x);  

                                         Type: Union(Expression(Integer),...)
(7) -> unparse(ii::InputForm)                             

   (7)
  "((3*I^3*sin(d*x+c)+3*I^2*cos(d*x+c))*log((((-2)*I*cos(d*x+c)*sin(d*x+c)+((I^
  2+(-1))*cos(d*x+c)^2+(I^2+2)))*(I^2+1)^(1/2)+((2*I^2+2)*sin(d*x+c)+((-2)*I^3+
  (-2)*I)*cos(d*x+c)))/(2*I*cos(d*x+c)*sin(d*x+c)+(((-1)*I^2+1)*cos(d*x+c)^2+I^
  2)))+((2*I^2+2)*cos(d*x+c)*sin(d*x+c)+((2*I^3+2*I)*cos(d*x+c)^2+((-4)*I^3+2*I
  )))*(I^2+1)^(1/2))/(((2*I^5+4*I^3+2*I)*a^2*d*sin(d*x+c)+(2*I^4+4*I^2+2)*a^2*d
  *cos(d*x+c))*(I^2+1)^(1/2))"

More such examples at this integrals page.

Looking at the table above, under FriCAS, each entry which says F(-2), means it failed due to this error.

This ended up coming from a bug in FriCAS rather than in translating results from FriCAS.

Fixed in FriCAS 1.3.6, to which we upgraded in #27309. This ticket adds a doctest.

Change History (18)

comment:1 Changed 3 years ago by Martin Rubey

Cc: Martin Rubey added
Keywords: FriCAS added

Please always use the "FriCAS" keyword for tickets on this topic, otherwise I might not see it.

comment:2 Changed 3 years ago by Nasser

Owner: set to Nasser

comment:3 Changed 3 years ago by Nasser

this was a bug in Fricas. not sagemath need to close

comment:4 Changed 3 years ago by Martin Rubey

Report Upstream: N/AFixed upstream, but not in a stable release.
Reviewers: Martin Rubey
Status: newneeds_review

comment:5 Changed 3 years ago by Martin Rubey

Authors: Nasser Abbasi
Status: needs_reviewpositive_review

comment:6 Changed 3 years ago by Frédéric Chapoton

Status: positive_reviewneeds_work

this would need a doctest, once in a stable release

comment:7 Changed 3 years ago by Matthias Köppe

Milestone: sage-9.1sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:8 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:9 Changed 22 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:10 Changed 19 months ago by Martin Rubey

Branch: u/mantepse/notimplementederror__the_translation_of_the_fricas_object_sage2_to_sage_is_not_yet_implemented

comment:11 Changed 19 months ago by Martin Rubey

Commit: f18b8218f1e95348fb78aaeebc4b857c9a06fd9b
Status: needs_workneeds_review

New commits:

f18b821add doctest

comment:12 Changed 19 months ago by Martin Rubey

Status: needs_reviewpositive_review

comment:13 Changed 19 months ago by Samuel Lelièvre

Description: modified (diff)
Report Upstream: Fixed upstream, but not in a stable release.Fixed upstream, in a later stable release.
Summary: NotImplementedError: the translation of the FriCAS object sage2 to sage is not yet implementedDoctest integrating (I*a*tan(d*x + c) + a)*sec(d*x + c)^10 via FriCAS

comment:14 Changed 18 months ago by git

Commit: f18b8218f1e95348fb78aaeebc4b857c9a06fd9bb6724769ff4f335504333d8775e3f5645718cb46
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

e780764Merge branch 'develop' of git://trac.sagemath.org/sage into t/29043/notimplementederror__the_translation_of_the_fricas_object_sage2_to_sage_is_not_yet_implemented
b672476fix ticket number

comment:15 Changed 18 months ago by git

Commit: b6724769ff4f335504333d8775e3f5645718cb46fac7faea7ae0c32cbedae596d5dfe41e30a17b4b

Branch pushed to git repo; I updated commit sha1. New commits:

fac7faefix doctest, expressions are equal

comment:16 Changed 17 months ago by Martin Rubey

Milestone: sage-9.4sage-duplicate/invalid/wontfix

The doctest is added by #28630.

comment:17 Changed 17 months ago by Martin Rubey

Status: needs_reviewpositive_review

comment:18 Changed 17 months ago by Frédéric Chapoton

Resolution: duplicate
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.