# [Maxima] posible bug - clashing variable names in integrals

Barton Willis willisb at unk.edu
Sun Oct 4 09:49:03 CDT 2009

```Maybe somewhat less broken:

(%i1) safe_op(e) := block([inflag :true], if not mapatom(e) then op(e)
else false)\$

(%i2) myfreeof(x,e) := block([partswitch : true],
freeof(x,e) or (safe_op(e) = 'iint and third(e) # 'end and fourth(e) #
'end and freeof(x,third(e)) and freeof(x,fourth(e))))\$

(%i3) iint(e,x,a,b) := block([listarith : true],
if safe_op(e) = "*" then (
e : map(lambda([s], if myfreeof(x,s) then  [s,1] else [1,s]), e),
first(e) * funmake('iint,[second(e),x,a,b]))
else funmake('iint,[e,x,a,b]))\$

(%i4) int_outative(e) := block([partswitch : true],
e : subst(nounify(integrate) = lambda([[s]], if is(length(s) = 4) then
apply('iint,s) else funmake('integrate,s)), e),
subst('iint = 'integrate,e))\$

OK:

(%i5) int_outative(integrate(integrate(f(x),x,p,q)*g(x),x,c,d));
(%o5) integrate(f(x),x,p,q)*integrate(g(x),x,c,d)

OK:

(%i6) int_outative(integrate(integrate(f(x),x,p,x)*g(x),x,c,d));
(%o6) integrate(g(x)*integrate(f(x),x,p,x),x,c,d)

(%i7) op(%);
(%o7) integrate

Barton

```