# Calculation that is possible in Sage 6.3 is not possible in Sage 6.4

This post is a wiki. Anyone with karma >750 is welcome to improve it.

The following code:

var('u')

assume(u>0)

fu=1/8*(I*sqrt(2)*(erf(1/2*sqrt(2)*(I*pi + 2*u + 1)) - erf(1/2*sqrt(2)*(-I*pi + 2*u + 1)))*e^(u + 1/2) + sqrt(2)*(-I*erf(1/2*sqrt(2)*(I*pi - 2*u + 1)) + I*erf(1/2*sqrt(2)*(-I*pi - 2*u + 1)))*e^(u + 1/2) - (sqrt(2)*e^(1/8) - sqrt(2)*e^(2*u + 1/8))*(erf(1/4*sqrt(2)*(2*I*pi + 4*u + 1)) + erf(1/4*sqrt(2)*(-2*I*pi + 4*u + 1))) - (sqrt(2)*e^(1/8) - sqrt(2)*e^(2*u + 1/8))*(erf(1/4*sqrt(2)*(2*I*pi - 4*u + 1)) + erf(1/4*sqrt(2)*(-2*I*pi - 4*u + 1))))*e^(-u)/sqrt(pi)

fu.nintegral(u,0,2)


returns:  (1.4275778409741315, 3.656408002774788e-14, 63, 0)' with Sage 6.3

but returns: TypeError: ECL says: Error executing code in Maxima:' with Sage 6.4

In both cases I am using the notebook interface

edit retag close merge delete

Sort by ยป oldest newest most voted

The issue is likely due to some Maxima update. You can run sage -maxima to work directly with maxima. Using Maxima 5.29.1 from Sage 6.1 I get

Maxima 5.29.1 http://maxima.sourceforge.net
(%i1) fu:1/8*(%i*sqrt(2)*(erf(1/2*sqrt(2)*(%i*%pi + 2*u + 1)) - erf(1/2*sqrt(2)*(-%i*%pi + 2*u + 1)))*%e^(u + 1/2) + sqrt(2)*(-%i*erf(1/2*sqrt(2)*(%i*%pi - 2*u + 1)) + %i*erf(1/2*sqrt(2)*(-%i*%pi - 2*u + 1)))*%e^(u + 1/2) - (sqrt(2)*%e^(1/8) - sqrt(2)*%e^(2*u + 1/8))*(erf(1/4*sqrt(2)*(2*%i*%pi + 4*u + 1)) + erf(1/4*sqrt(2)*(-2*%i*%pi + 4*u + 1))) - (sqrt(2)*%e^(1/8) - sqrt(2)*%e^(2*u + 1/8))*(erf(1/4*sqrt(2)*(2*%i*%pi - 4*u + 1)) + erf(1/4*sqrt(2)*(-2*%i*%pi - 4*u + 1))))*%e^(-u)/sqrt(%pi) \$
(%o2)         [1.4275778409741315, 3.6564080027747881e-14, 63, 0]


Doing the same on Maxima 5.35.1 from the current Sage 6.5.beta5 I get

(%i2) quad_qags(fu,u,0,2,limit=200,epsrel=1e-8) ;

quad_qags: Cannot numerically evaluate errexp1 at 1.0
-- an error. To debug this try: debugmode(true);


The expression errexp1 is equal to fu. I know little Maxima myself, but I can tell that ev(subst(1,u,fu),numer); will return an expression with unevaluated erf calls in both versions of Maxima. In any case, there seems to be some change in Maxima between 5.33.0.p0 from Sage 6.3 and the 5.34.1.p0 used in Sage 6.4. Bisecting the Maxima revision history for this, I traced this problem down to Maxima commit 07a0200. That removes some special handling for erf, claiming that it should no longer be required. This assumption appears to be incorrect, judging from your experience.

I took the liberty of reporting this as Maxima bug 2881. If there is urgent need for this, and Maxima fails to react in a timely manner, you could probably also open a Sage ticket asking for this commit to be patched out of the Maxima version used by Sage. But in the long run, the best solution is when Maxima developers deal with this.

more

Wow, great sleuthing!

( 2015-01-09 14:10:10 -0500 )edit

Update: https://sourceforge.net/p/maxima/bugs... says this has been fixed!

( 2015-03-02 20:17:15 -0500 )edit