# integration with 'maxima' gives different result than 'sympy' and 'mathematica_free'

We have

sage: q = -1/17*sqrt(-52/17*I + 47/17)/(2*x - sqrt(4*I + 1) - 1)
....: print( integrate( q, x, 0, 1, algorithm='maxima' ).n() )
....: print( integrate( q, x, 0, 1, algorithm='sympy' ).n() )
....: print( integrate( q, x, 0, 1, algorithm='mathematica_free' ).n() )
0.0400005859357106 - 0.0177639491598775*I
0.0236417600209372 - 0.0546005003074790*I
0.0236418000000000 - 0.0546005000000000*I


Is this expected?

edit retag close merge delete

also

sage: integrate( q, x, 0, 1, algorithm='fricas' ).n()
0.0236417600209373 - 0.0546005003074790*I

( 2024-08-30 16:56:36 +0200 )edit
1

symbolically

sage: integrate( q, x, algorithm='fricas')
-1/34*sqrt(-52/17*I + 47/17)*log(x - 1/2*sqrt(4*I + 1) - 1/2)
sage: integrate( q, x, algorithm='sympy')
-1/578*sqrt(-52*I + 47)*sqrt(17)*log(578*x - 289*sqrt(4*I + 1) - 289)
sage: integrate( q, x, algorithm='maxima')
-1/34*sqrt(-52/17*I + 47/17)*log(2*x - sqrt(4*I + 1) - 1)
sage: integrate( q, x, algorithm='mathematica_free')
-1/34*sqrt(-52/17*I + 47/17)*log(-2*x + sqrt(4*I + 1) + 1)
sage: integrate( q, x, algorithm='giac')
-1/34*sqrt(-52/17*I + 47/17)*log(-1/2*sqrt(2*sqrt(17) + 2)*(4*I/(sqrt(17) + 1) + 1) + 2*x - 1)

( 2024-08-30 17:02:10 +0200 )edit

Indefinite integral looks fine - we have

sage: r = integrate( q, x, algorithm='maxima')
sage: print( (r.subs({x:1}) - r.subs({x:0})).n() )
0.0236417600209373 - 0.0546005003074791*I


So it looks like a bug in definite integral evaluation.

( 2024-08-30 19:42:37 +0200 )edit

This expression has some seemingly questionable symbolic indefinite integrations :

 Ints={v:q.integrate(x, algorithm=v) for v in ("maxima", "giac", "fricas", "sympy", "mathematica_free")}
sage: {v:(Ints[v].diff(x)-q).is_zero() for v in Ints.keys()}
{'maxima': True,
'giac': False,
'fricas': True,
'sympy': False,
'mathematica_free': True}

( 2024-08-31 14:34:42 +0200 )edit

However :

sage: (q.integrate(x, algorithm="giac").diff(x)-q)._mathematica_().FullSimplify()
0
sage: (q.integrate(x, algorithm="sympy").diff(x)-q)._sympy_().simplify()
0

( 2024-08-31 14:49:33 +0200 )edit

Sort by » oldest newest most voted

Apparently the reason is that in the definite integrals maxima evaluates each log(e) as log(abs(e)). I've filed a bugreport at https://github.com/sagemath/sage/issu...

more