asmeurer/sympy — pull request #60 by smichr (2014-10-01 06:22:16+00:00)
Title: keep minimal definitions of number attributes

Using code to test what is implied by the assumptions -- acquired through the assumptions engine or set by attributes in numbers.py...

```
for n in (S.Catalan, S.EulerGamma, S.Exp1, S.GoldenRatio,
S.ImaginaryUnit, oo, -oo, zoo, S.Pi, S.One, S.Half, S.Zero, S.NegativeOne):
print n, minimal_assumptions(dict(n._assumptions))
```

gives this in this PR

```
Catalan (['complex', 'positive'], [])
EulerGamma (['complex', 'positive'], [])
E (['nonnegative', 'transcendental'], [])
GoldenRatio (['algebraic', 'irrational', 'nonnegative'], [])
I (['imaginary'], [])
oo (['infinite', 'nonnegative'], [])
-oo (['infinite', 'nonnegative'], [])
zoo (['infinite'], [])
pi (['nonnegative', 'transcendental'], [])
1 (['integer'], [])
1/2 (['noninteger', 'nonnegative', 'rational'], [])
0 (['zero'], [])
-1 (['integer', 'nonzero'], [])
```

but this in your PR -- note the None which means that there is no simple way to reconstruct the assumptions other than as they are. I think that means you have left them "over defined" in terms of attributes.

```
>>> Dummy(complex=1, positive=1).assumptions0 ==\
... Dummy(real=1, positive=1).assumptions0
True
```

```
Catalan None
EulerGamma None
E (['nonnegative', 'transcendental'], [])
GoldenRatio (['algebraic', 'irrational', 'nonnegative'], [])
I None
oo (['infinite', 'nonnegative'], [])
-oo (['infinite', 'nonnegative'], [])
zoo (['infinite'], [])
pi (['nonnegative', 'transcendental'], [])
1 (['integer'], [])
1/2 (['noninteger', 'nonnegative', 'rational'], [])
0 (['zero'], [])
-1 (['integer', 'nonzero'], [])
```

Note that 'complex, positive' for Catalan in this PR is just another way to say 'real, positive' -- either way the assumptions dictionary comes out the same. I don't think this is what you want (and that has nothing to do with the changes I made, it is a consequence of the assumptions/facts).

Note also the docstring of is_comparable (which is not part of the assumptions system). The function is trying to figure out if foo is something that can be computed to a Number with precision.

```
"""Return True if self can be computed to a real number
with precision, else False.
```