Thanks! It is clear that it is a bug provided by Maxima. I have checked already in the developer track the already known Maxima bugs in integrals and I have not found similar errors, so I have opened a ticket.
Juan Luis El jueves, 16 de diciembre de 2021 a las 19:21:03 UTC+1, Emmanuel Charpentier escribió: > A nice one, indeed. Here, Sage seems to use Maxima’s integrator : > > sage: table([[u,(f(x)-g(x)).integrate(x,algorithm=u)] for u in ["maxima", > "sympy", "giac", "fricas", "mathematica_free"]], header_row=["Algorithm", > "Indefinite integral"]) > Algorithm Indefinite integral > +------------------+--------------------------------------------------------------------------------------------------------------------------------------+ > maxima -1/9*(-3*I*x - 1)*cos(3*x) - 1/9*(3*I*x + 1)*e^(-3*I*x) > + 1/9*(3*x - I)*sin(3*x) - 1/12*cos(6*x) + 1/12*e^(-6*I*x) + 1/12*I*sin(6*x) > sympy 0 > giac 0 > fricas 0 > mathematica_free 0 > > Note that : > > sage: (f(x)-g(x)).integrate(x).simplify() > -1/9*(-3*I*x - 1)*cos(3*x) - 1/9*(3*I*x + 1)*e^(-3*I*x) + 1/9*(3*x - > I)*sin(3*x) - 1/12*cos(6*x) + 1/12*e^(-6*I*x) + 1/12*I*sin(6*x) > > but : > > sage: (f(x)-g(x)).integrate(x).simplify_full() > 0 > > and : > > sage: (f(x)-g(x)).expand() > 0 > > There are already some reports of incorrect/surprising Maxima definite and > indefinite integral errors, often related to choice of branchs or branch > cuts not accounted for. Would you care to check them and file a ticket if > yours isn’t already known? > > Le mercredi 15 décembre 2021 à 20:43:07 UTC+1, juanlui...@gmail.com a > écrit : > >> See this example: >> >> f(x)=(x+sin(3*x))*exp(-3*x*I) >> g(x)=f(x).expand() >> integral(f(x)-g(x),(x,0,2*pi)) >> >> The answer is I*pi, but it should be 0. >> >> Many other examples (related to Fourier coefficients) give similar >> errors. For instance: >> >> f(x)=(x+cos(x))*exp(-x*I) >> g(x)=f(x).expand() >> integral(f(x)-g(x),(x,0,2*pi)) >> >> The answer is -pi, and it should be 0. >> >> It can be easily with sagemath 9.4 in https://sagecell.sagemath.org >> >> Thanks in advance, >> >> Yours, >> >> Juan Luis Varona >> >> >> >> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/106c04cb-9e26-4aa3-a842-5563a05d52ebn%40googlegroups.com.