On Wed, Mar 20, 2019 at 05:36:59AM -0700, mmarco wrote: > I am trying to pinpoint the following bug: > > sage: integral(sqrt(1+cos(x)^2),x) > -1/24*sin(3*x) + 1/8*sin(x) > > > which is incorrect. One would think that maxima is returning a wrong > answer, but if we ask directly to maxima, it leaves the integral as it is: indeed, it is an elliptic integral, cannot be done in elementary functions.
The problem comes from src/sage/interfaces/maxima_lib.py loading abs_integrate: sage --maxima ;;; Loading #P"/mnt/opt/Sage/sage-dev/local/lib/ecl/sb-bsd-sockets.fas" ;;; Loading #P"/mnt/opt/Sage/sage-dev/local/lib/ecl/sockets.fas" ;;; Loading #P"/mnt/opt/Sage/sage-dev/local/lib/ecl/defsystem.fas" ;;; Loading #P"/mnt/opt/Sage/sage-dev/local/lib/ecl/cmp.fas" Maxima 5.41.0 http://maxima.sourceforge.net using Lisp ECL 16.1.2 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(abs_integrate); ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2 (%o1) /mnt/opt/Sage/sage-dev/local/share/maxima/5.41.0/share/contrib/integrati\ on/abs_integrate.mac (%i3) display2d : false; (%o3) false (%i4) integrate(sqrt(1+cos(x)^2),x); (%o4) ((2*sin(3*x)+6*sin(x))*false-sin(3*x)+3*sin(x))/24 Which does not make much sense, and apparently Sage gets the bit of it after "false"... Dima > > sage: f = sqrt(1+cos(x)^2) > sage: maxima.integrate(f._maxima_(),x) > 'integrate(sqrt(cos(_SAGE_VAR_x)^2+1),_SAGE_VAR_x) > > which is the same result we get with sympy and fricas, and even by maxima > itself: > > Maxima 5.41.0 http://maxima.sourceforge.net > using Lisp ECL 16.1.2 > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) integrate(sqrt(1+cos(x)^2),x); > / > [ 2 > (%o1) I sqrt(cos (x) + 1) dx > ] > / > > So something strange is going on when we call maxima internally to compute > that integral. I have tried to trace it, but I got lost in the > intrincancies of the maxima interface. > > Does somebody know what exactly is causing this discrepancy? > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.