7.71 bug in int and signum in Maple V.4 and Maple V.5 (4.9.97)

7.71.1 Andreas Jung

There is a bug in the integration of expressions involving the signum function (Release 4, Solaris):

> int(signum(x-s)*cos(s), s=0..Pi); 
                                  0
 

The result is only correct for x<=0 or x>=Pi. For 0<x<Pi, it should be 2*sin(x). Converting all signums to Heaviside gives the correct result:

> int(convert(signum(x-s)*cos(s), Heaviside), s=0..Pi); 
 
        (signum(-x + Pi) + 1) sin(x) + (signum(x) - 1) sin(x)
 

So always converting to Heaviside before integrating is a possible workaround. However, it’s ugly, and the results given by int contain signum rather than Heaviside.

Is there a patch available for this integration bug?

It is corrected with Maple 6. (U. Klein)

7.71.2 Douglas B. Meade (8.9.97)

The piecewise package in Release 4 has had a number of problems. Some of the problems have been fixed in the patches, but there are still problems at patchlevel 2 (the current patch).

As examples, check out the examples in the online help for dsolve,piecewise. Compare the displayed output with the output obtained by executing the same command under the current patchlevel. I’d love to see how many of my ODE students would see that the solution in the online help CANNOT be the solution to this ODE.

The second example is more relevant to Andreas’ posting. Conversion to/from abs, signum, piecewise, and Heaviside is not perfect.

> f := abs(x); 
 
                              f := | x | 
 
> df := diff( f, x ); 
 
                           df := abs(1, x) 
 
> convert( df, piecewise ); 
 
                                  1 
 
> convert( df, Heaviside ); 
 
                                  1
 

Note that abs(1,x) is another name for signum(x). The problem here is that `piecewise/abs` effectively simplifies all two argument calls to abs to 1 (via the mapping f -> Heaviside(-f) + Heaviside(f)). The fix is obvious: replace this mapping with f -> -1 + 2*Heaviside(f). This bug (together with the fix) were reported to Maple’s Tech Support in November 1996.

While this does not fix Andreas’ problem, I expect it sheds some light on a probably source of the problem.

7.71.3 Preben Alsholm (15.9.97)

I tried Douglas Meade’s examples of problems with the piecewise package. If you differentiate one more time than he did, then you find

f:=abs(x): 
 
df2:=diff(f,x,x); 
                                df2:=signum(1,x) 
 
convert(df2,piecewise); # OK 
 
              PIECEWISE([undefined, x = 0],[0,otherwise]) 
 
convert(df2,Heaviside); # NOT OK 
                                         1
 

How is that explained?

7.71.4 Douglas B. Meade (21.9.97)

A quick glance at `Heaviside/signum` shows that it is written to expect only one argument ( f -> -1 + 2*Heaviside(f) ). Thus, (essentially) all calls to `Heaviside/signum` with two arguments return the value 1.

This oversight should account for the behavior you report.