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

KroneckerDelta(p, 0) raises IndexError #9283

Closed
leosartaj opened this Issue Apr 12, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@leosartaj
Copy link
Member

leosartaj commented Apr 12, 2015

To reproduce

>>> p = Symbol('p', prime=True)
>>> KroneckerDelta(p, 0)
IndexError                                Traceback (most recent call last)
<ipython-input-2-7104d3bd4b37> in <module>()
----> 1 KroneckerDelta(p, 0)

/home/leosartaj/projects/sympy/sympy/core/cache.pyc in wrapper(*args, **kwargs)
     89             def wrapper(*args, **kwargs):
     90                 try:
---> 91                     retval = cfunc(*args, **kwargs)
     92                 except TypeError:
     93                     retval = func(*args, **kwargs)

/home/leosartaj/projects/sympy/sympy/core/compatibility.pyc in wrapper(*args, **kwds)
    878                         stats[HITS] += 1
    879                         return result
--> 880                 result = user_function(*args, **kwds)
    881                 with lock:
    882                     root, = nonlocal_root

/home/leosartaj/projects/sympy/sympy/core/function.pyc in __new__(cls, *args, **options)
    374 
    375         evaluate = options.get('evaluate', global_evaluate[0])
--> 376         result = super(Function, cls).__new__(cls, *args, **options)
    377         if not evaluate or not isinstance(result, cls):
    378             return result

/home/leosartaj/projects/sympy/sympy/core/cache.pyc in wrapper(*args, **kwargs)
     89             def wrapper(*args, **kwargs):
     90                 try:
---> 91                     retval = cfunc(*args, **kwargs)
     92                 except TypeError:
     93                     retval = func(*args, **kwargs)

/home/leosartaj/projects/sympy/sympy/core/compatibility.pyc in wrapper(*args, **kwds)
    878                         stats[HITS] += 1
    879                         return result
--> 880                 result = user_function(*args, **kwds)
    881                 with lock:
    882                     root, = nonlocal_root

/home/leosartaj/projects/sympy/sympy/core/function.pyc in __new__(cls, *args, **options)
    198 
    199         if evaluate:
--> 200             evaluated = cls.eval(*args)
    201             if evaluated is not None:
    202                 return evaluated

/home/leosartaj/projects/sympy/sympy/functions/special/tensor_functions.py in eval(cls, i, j)
    165             return S.Zero
    166         elif i != 0 and diff.is_nonzero:
--> 167             return cls(0, diff.args[0])
    168 
    169         if i.assumptions0.get("below_fermi") and \

IndexError: tuple index out of range

This is because in this case args is an empty Tuple, hence the IndexError. I will send a PR to fix the issue.

leosartaj added a commit to leosartaj/sympy that referenced this issue Apr 16, 2015

@jksuom jksuom closed this in #9306 Apr 17, 2015

jksuom added a commit that referenced this issue Apr 17, 2015

Merge pull request #9306 from leosartaj/issue-9283
fixes #9283: KroneckerDelta(p, 0) raises IndexError

mcho421 added a commit to mcho421/sympy that referenced this issue May 4, 2015

skirpichev added a commit to diofant/diofant that referenced this issue Jul 1, 2015

skirpichev added a commit to diofant/diofant that referenced this issue Jul 3, 2015

skirpichev added a commit to diofant/diofant that referenced this issue Jul 3, 2015

jksuom added a commit to jksuom/sympy that referenced this issue Aug 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment