Ask Your Question
0

limit of function with dirac delta

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

maaaaaaartin gravatar image

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

Comments

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

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

1 Answer

Sort by ยป oldest newest most voted
4

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

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

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.

edit flag offensive delete link more

Comments

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

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

Stats

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

Seen: 471 times

Last updated: Mar 09 '17