#### 7.76 BUG in int-sum-dirac in Maple V.4 (15.11.96)

##### 7.76.1 Renato Portugal

It seems to have a bug in Maple integrator with Dirac and probably with Heaviside functions.

> s1 := Sum(Dirac(x-i),i=0..5);

5
-----
\
s1 :=   )   Dirac(x - i)
/
-----
i = 0

> int(s1,x);

/-----  \   /-----  \                      /-----  \
| \     |   | \     |                      | \     |
Heaviside(x - i) |  )   1| + |  )   0| x - Heaviside(x - i) |  )   0|
| /     |   | /     |                      | /     |
\-----  /   \-----  /                      \-----  /



The correct result should be:

> sum(int(Dirac(x-i),x),i=0..5);

Heaviside(x) + Heaviside(x - 1) + Heaviside(x - 2) + Heaviside(x - 3)

+ Heaviside(x - 4) + Heaviside(x - 5)



An active unevaluated sum cause an error in Maple integrator:

> s2 := sum(Dirac(x-i),i=0..N);

N
-----
\
s2 :=   )   Dirac(x - i)
/
-----
i = 0

> eval(int(s2,x));
Error, (in int) expecting two arguments



The bug seems to be in function piecewise/extsimp.

The bug is removed with Maple V Release 5. (U. Klein)

##### 7.76.2 David Holmgren

With regard to Dr. Portugal’s problem concerning Dirac functions, ﬁrst of all I cannot reproduce the problem (using R3 on either a PC or Sun workstation). (You will get the result of Dr. Portugal using Release 4, U. Klein). Also, the problem is very simply ﬁxed if one deﬁnes s1, s2 as functions. Here’s some output:

The original equation...

> s1:=Sum(Dirac(x-i),i=0..5);

5
-----
\
s1 :=   )   Dirac(x - i)
/
-----
i = 0



Try integrating it..

> int(s1,x);

5
/ -----
|   \
|    )   Dirac(x - i) dx
|   /
/   -----
i = 0



Now do it as a function...

> readlib(unassign):
> unassign('s1');
> s1:=x->sum(Dirac(x-i),i=0..5);

5
-----
\
s1 := x ->   )   Dirac(x - i)
/
-----
i = 0

> s1(0);

Dirac(0)

> s1(1);

Dirac(0)



Seems OK. Now integrate...

> int(s1(x),x);

Heaviside(x) + Heaviside(x - 1) + Heaviside(x - 2) + Heaviside(x - 3)

+ Heaviside(x - 4) + Heaviside(x - 5)



...which is the required answer. (The same result with Release 4, U. Klein) Do the same with s2...

> s2:=x->sum(Dirac(x-i),i=0..N);

N
-----
\
s2 := x ->   )   Dirac(x - i)
/
-----
i = 0

> s2(0);

N
-----
\
)   Dirac(- i)
/
-----
i = 0

> s2(1);

N
-----
\
)   Dirac(1 - i)
/
-----
i = 0

> int(s2(x),x);

N
/ -----
|   \
|    )   Dirac(x - i) dx
|   /
/   -----
i = 0



(With Release 4 you will get the error message: Error, (in int) expecting two arguments, U. Klein)

> eval(%);

N
/ -----
|   \
|    )   Dirac(x - i) dx
|   /
/   -----
i = 0



the problem is that N is not deﬁned in any way...

> N:=5;

N := 5

> int(s2(x),x);

Heaviside(x) + Heaviside(x - 1) + Heaviside(x - 2) + Heaviside(x - 3)

+ Heaviside(x - 4) + Heaviside(x - 5)

> N:=10;

N := 10

> int(s2(x),x);

Heaviside(x) + Heaviside(x - 1) + Heaviside(x - 2) + Heaviside(x - 3)

+ Heaviside(x - 4) + Heaviside(x - 5) + Heaviside(x - 6)

+ Heaviside(x - 7) + Heaviside(x - 8) + Heaviside(x - 9)

+ Heaviside(x - 10)



Anyway, this doesn’t appear to be a bug, at least with Maple R3. The problem lies in the deﬁnitions of s1, s2, and the use of the inert summation function.