DiracDelta



"I'm a little bit confused. Why are you using approximants to delta at
all? I haven't looked at your pw.mac code, but presumably you have some
rule that transforms
  integrate(delta(x)*phi(x), x, a, b)
to something like
  if is (a < 0 and b > 0) then <some expression with limits> else 0"

No, the situation is more complicated than that, it basically does 
substitution

expr : subst(1, delta(x), expr)

and then if expr is free of delta() you get

z : expr * (signum(x) + 1) / 2.

Then

answer : at(z, [x=b])-at(z, [x=a]).

The purpose is to use the approximates to verify that I am using the right 
formulas, once the right formulas are found and other conditions are 
satisfied then I can use the formula.  I could assume phi(x) can be any 
function but by way of approximates it is possible to show my answer is 
wrong for phi(x) = unit_step(x).

"As far as I understand it, the whole point of these "idealised functions" 
(ie distributions) is to avoid the icky business of computing with the 
approximants in the first place."

I agree, but I got it wrong, I was assuming integrate(pwdelta(x) * 
f(x),x,minf, inf) = f(0) which is not true for phi(x) = unit_step(x).  I now 
need to test each case for continuity at 0.  Hence, I think I have to use 
continuousp() for each case.

"Yes, definitely. For example, take the approximants

dd (x, t, a) =     { a*t        when x ? [-1/t, 0]
                         { (1-a)*t    when x ? [0, 1/t]
                         { 0          otherwise"

This is a good approximate, it is not an even function.

(%i30) display2d:false;
(out30) false
(%i31) if x >= -1/t and x < 0 then a*t else (if x >= 0 and x < 1/t then 
(1-a)*t else 0);

(out31) if x >= -1/t and x < 0 then a*t else (if x >= 0 and x < 1/t then 
(1-a)*t else 0)
(%i32) ddelta(x,t,a):=''(ifthen2sum(%));

(out32) 
ddelta(x,t,a):=a*t*between(x,-1/t,0,lclosed)+(1-a)*t*between(x,0,1/t,lclosed)*(1-between(x,-1/t,0,lclosed))
(%i33) pwlimit(pwint(ddelta(x,t,a),x,minf,inf),t,inf);

(out33) 1
(%i34) pwlimit(pwint(ddelta(x,t,a)*unit_step(x),x,minf,inf),t,inf);

(out34) 1-a
(%i35) pwlimit(pwint(ddelta(x,t,a)*signum(x),x,minf,inf),t,inf);

(out35) 1-2*a

If I tested signum(x) and unit_step(x) for continuity an 0 then I would know 
to just return the noun form of pwint.  Instead I get an incorrect result.

Remember the purpose of this exercise for me is to get the right conditions 
under which my formulas work and then just apply them when applicable. 
pw.mac does not attempt to compute a limit as of this writing.

Richard