# limit of function with dirac delta

Consider the following code:

sage.var(x)
f = (1-x) * sage.unit_step(x)
df = f.diff(x)    ->    -unit_step(x) + (1-x)*dirac_delta(x)


Trying to compute df.limit(x=0, dir="right"), which should return -1, but instead returns limit(-unit_step(x) + (1-x)*dirac_delta(x), x, 0, plus).

Even df.limit(x=0.5) return limit(-unit_step(x) + (1-x)*dirac_delta(x), x, 0.5) instead of -1.

Any idea on what might be going on? Thanks!

edit retag close merge delete

My guess is that Maxima doesn't know how to take limits of these functions.

( 2017-03-09 07:50:09 -0600 )edit

Sort by ยป oldest newest most voted

To expand on the comment by @kcrisman, limits are sent to Maxima by default. Maxima can evaluate the limit of the step function: entering

unit_step(x).limit(x=0,dir='right')


returns 1 as expected. Maxima cannot evaluate the limit of the Dirac delta: entering

dirac_delta(x).limit(x=0,dir='right')


returns an unevaluated expression. Since part of your limit cannot be evaluated by Maxima, it all comes back unevaluated.

The other option for limit evaluation is to set algorithm='sympy': entering

dirac_delta(x).limit(x=0,algorithm='sympy')


returns zero as expected. Unfortunately, entering

dirac_delta(x).limit(x=0,dir='right',algorithm='sympy')


gives the message

sympy does not support one-sided limits


Even more problematic, entering

unit_step(x).limit(x=0,algorithm='sympy')


gives the message

SymPy function 'unit_step' doesn't exist


so SymPy won't get the complete job done either.

Not exactly the answer you want, but hopefully it helps you understand what's happening.

more

the existence problem can probably be fixed by setting a custom "conversion" dictionary in src/sage/functions/generalized.py

( 2017-03-10 00:54:15 -0600 )edit

the problem is that there is really no such UnitStep function in SymPy. Here it says that it's possible to define it at $0$ passing a 2nd argument. see also in github. But in my local sage installation, it doesn't work; don't know if it's because of a difference in the SymPy versions..

( 2017-03-10 06:04:50 -0600 )edit