Ask Your Question

limit of function with dirac delta

asked 2017-03-09 12:15:01 +0200

maaaaaaartin gravatar image

Consider the following code:

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 flag offensive close merge delete


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

kcrisman gravatar imagekcrisman ( 2017-03-09 14:50:09 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-09 22:09:05 +0200

updated 2017-03-09 23:28:59 +0200

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


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


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


returns zero as expected. Unfortunately, entering


gives the message

sympy does not support one-sided limits

Even more problematic, entering


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.

edit flag offensive delete link more


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

mforets gravatar imagemforets ( 2017-03-10 07:54:15 +0200 )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..

mforets gravatar imagemforets ( 2017-03-10 13:04:50 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-03-09 12:15:01 +0200

Seen: 399 times

Last updated: Mar 09 '17