Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Matrices WrongResult

New issue 4114 by randy.he...@clockworklab.net: ImmutableMatrix.is_zero is always False
http://code.google.com/p/sympy/issues/detail?id=4114

In [1]: ImmutableMatrix([0,0]).is_zero
Out[1]: False

In [2]: ImmutableMatrix.is_zero
Out[2]: False

As best I can tell, ImmutableMatrix.is_zero should be a @property, inherited from MatrixBase, that actually considers the content of the matrix in determining is_zero. But no matter what I change in the class definitions of ImmutableMatrix or MatrixExpr, ImmutableMatrix.is_zero always returns False. The sole exception is if I try to directly set is_zero=True in the ImmutableMatrix class definition: that results in a big stack trace on import:

import sympy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./sympy/__init__.py", line 35, in <module>
    from .polys import *
  File "./sympy/polys/__init__.py", line 57, in <module>
    from . import partfrac
  File "./sympy/polys/partfrac.py", line 17, in <module>
    def apart(f, x=None, full=False, **options):
  File "./sympy/utilities/decorator.py", line 77, in xthreaded
    return threaded_factory(func, False)
  File "./sympy/utilities/decorator.py", line 15, in threaded_factory
    from sympy.matrices import Matrix
  File "./sympy/matrices/__init__.py", line 21, in <module>
    from .immutable import ImmutableMatrix, ImmutableSparseMatrix
  File "./sympy/matrices/immutable.py", line 16, in <module>
    class ImmutableMatrix(MatrixExpr, DenseMatrix):
  File "./sympy/core/assumptions.py", line 231, in __init__
    cls.default_assumptions = StdFactKB(defs)
  File "./sympy/core/assumptions.py", line 124, in __init__
    self.deduce_all_facts(facts)
  File "./sympy/core/facts.py", line 501, in deduce_all_facts
    if not self._tell(k, v) or v is None:
  File "./sympy/core/facts.py", line 472, in _tell
    raise InconsistentAssumptions(self, k, v)
sympy.core.facts.InconsistentAssumptions: {'negative': False, 'complex': False, 'rational': False, 'positive': False, 'imaginary': False, 'integer': False, 'odd': False, 'real': False, 'zero': False, 'nonnegative': False, 'noninteger': False, 'prime': False, 'nonpositive': False, 'composite': False, 'commutative': False, 'nonzero': True, 'irrational': False, 'even': False}, zero=True

What dark magic is going on and how do I fix it?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to