#### 7.77 bug in int/defDirac (5.5.96)

##### 7.77.1 Gerhard Hejc

I found the following bug in the code of the procedure "int/defDirac":

        ...
if type(f,*) then
for z in f do
if type(z,function) and op(0,z) = Dirac then
argument := op(1,z);
if nops(z) = 1 and type(argument,linear(x)) then
argument := expand(argument);
c0 := -coeff(argument,x,0)/coeff(argument,x,1);
s1 := signum(c0-a);
s2 := signum(b-c0);
F := subs(z = 1,f);
if b = infinity and a = -infinity or
member(s1,{0,1}) and b = infinity or
member(s2,{0,1}) and a = -infinity or
member(s2,{0,1}) and member(s1,{0,1}) then
ans := traperror(eval(subs(x = c0,F)));
if lasterror = ans then
ans := traperror(limit(F,x = c0));
if lasterror = ans then RETURN('FAIL')
else RETURN(ans/abs(coeff(argument,x,1)))
fi
else RETURN(ans/abs(coeff(argument,x,1)))
fi
elif s1 = -1 and b = infinity or
s2 = -1 and a = -infinity or s2 = -1 or s1 = -1
then
RETURN(0)
else RETURN('FAIL')
fi
elif nops(z) = 2 and type(argument,integer) and
1 <= argument and type(op(2,z),linear(x)) then
argument := expand(op(2,z));
c0 := -coeff(argument,x,0)/coeff(argument,x,1);
s1 := signum(c0-a);
s2 := signum(b-c0);
#
# old code:
# F := (-1)^op(1,z)*diff(subs(z = 1,f),x $op(1,z)); # # new code: # F := (-1/coeff(argument,x,1))^op(1,z)* diff(subs(z = 1,f),x$ op(1,z));
#
if b = infinity and a = -infinity or
member(s1,{0,1}) and b = infinity or
member(s2,{0,1}) and a = -infinity or
member(s2,{0,1}) and member(s1,{0,1}) then
ans := traperror(eval(subs(x = c0,F)));
if lasterror = ans then
ans := traperror(limit(F,x = c0));
if lasterror = ans then RETURN('FAIL')
else RETURN(ans/abs(coeff(argument,x,1)))
fi
else RETURN(ans/abs(coeff(argument,x,1)))
fi
elif s1 = -1 and b = infinity or
s2 = -1 and a = -infinity or s2 = -1 or s1 = -1
then
RETURN(0)
else RETURN('FAIL')
fi
else RETURN('FAIL')
fi
fi
od
...



This bug causes a lot of strange results when integrating over Dirac functions.

The code hasn’t changed up to Maple 7. For you sent no example of the bug, I can’t decide if the bug is still present. (U. Klein)