Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifications in Dirac Delta function #12257

Closed
mohit3011 opened this issue Mar 6, 2017 · 9 comments
Closed

Simplifications in Dirac Delta function #12257

mohit3011 opened this issue Mar 6, 2017 · 9 comments

Comments

@mohit3011
Copy link
Contributor

mohit3011 commented Mar 6, 2017

It seems that the Dirac Delta function might be more useful if certain simplifications can be done.
For Example:

  • For using the symmetry property of the dirac delta function i.e DiracDelta(x)==DiracDelta(-x) . The existing provision for this is DiracDelta(-x).expand(diracdelta=True, wrt=x) . As of now we have this
>>> DiracDelta(-x)
DiracDelta(-x)

What I hope after this issue would be

>>> DiracDelta(-x)
DiracDelta(x)

  • Also we can include the property like DiracDelta(m*x) = DiracDelta(x)/m , where m is an integer . This feature is also presently implemented like DiracDelta(2*x).expand(diracdelta=True, wrt=x)

We can have the existing way when more than one variables are involved . For constants, we can include it in basic cases.

I have read the code regarding this and it would be really nice , if someone could guide me in this.

@mohit3011
Copy link
Contributor Author

@jksuom , @Upabjojr , can I go with this issue ?

@jksuom
Copy link
Member

jksuom commented Mar 6, 2017

It seems that something like this has been implemented in deltaintegrate. Maybe that could be expanded.

@mohit3011
Copy link
Contributor Author

mohit3011 commented Mar 6, 2017

@jksuom , yes you are right, I think we can do something similar here too.


    @deprecated(useinstead="expand(diracdelta=True, wrt=x)", deprecated_since_version="1.0.1")
    def simplify(self, x):
        return self.expand(diracdelta=True, wrt=x)

This is the code in delta_functions.py which canbe used.

@mohit3011
Copy link
Contributor Author

@jksuom , should I proceed with this issue ?

@jksuom
Copy link
Member

jksuom commented Mar 7, 2017

The functionality exists already though it may look a bit clumsy:

>>> DiracDelta(-x).expand(diracdelta=True, wrt=x)
DiracDelta(x)

I'm not sure if the conversion DiracDelta(-x) -> DiracDelta(x) should be made automatic. Maybe someone with more practical experience on these matters could have an opinion.

@mohit3011
Copy link
Contributor Author

mohit3011 commented Mar 7, 2017

@jksuom Yes, that is the whole point of this issue . The existing functionality is clumsy and could be shortened when we arguments of DIrac Delta as like "2*x" , "-x" etc . Here simply we write like (using the property of DIracDelta)

>>> DIracDelta(2*x)
DiracDelta(x)/2

So what do you think ?

@asmeurer
Copy link
Member

asmeurer commented Mar 7, 2017

The trig functions automatically canonicalize negative signs, so there is precedent. We should definitely have a way to do it the only question is if it should be automatic or not. I'm not sure if many practical applications create delta functions that aren't of the form DiracDelta(x - a).

@jksuom
Copy link
Member

jksuom commented Mar 8, 2017

It seems that the principal means of producing Dirac deltas in SymPy is _eval_expand_diracdelta which only creates expressions of the form DiracDelta(x - a).

@mohit3011
Copy link
Contributor Author

mohit3011 commented Mar 18, 2017

@asmeurer , @jksuom , sorry for replying late. I wanted to know whether I should give this issue a try ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants