pearu / sympycore

Automatically exported from code.google.com/p/sympycore
Other
11 stars 1 forks source link

Calculus class does not support all applicable operators methods #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Calculus class supports direct manipulation from Python for many
operations:

>>> sympycore.Calculus('x/3')
Calculus('1/3*x')
>>> sympycore.Calculus('x/3') == sympycore.Symbol('x') / 3
True
>>>

However, there are some operations that the Calculus class at least knows
about, but that it does not have operator methods for, e.g.:

>>> sympycore.Calculus('x//3')
Calculus('x//3')
>>> sympycore.Calculus('x//3') == sympycore.Symbol('x') // 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for //: 'Calculus' and 'int'

A list of potentially useful methods can be easily generated:

>>> sorted(x for x in set(dir(0)) - set(dir(sympycore.Calculus('x'))) if
x.startswith('__'))
['__and__', '__cmp__', '__coerce__', '__floordiv__', '__getnewargs__',
'__hex__', '__index__', '__int__', '__invert__', '__long__', '__lshift__',
'__mod__', '__oct__', '__rand__', '__rdivmod__', '__rfloordiv__',
'__rlshift__', '__rmod__', '__ror__', '__rrshift__', '__rshift__',
'__rtruediv__', '__rxor__', '__trunc__', '__xor__']

Original issue reported on code.google.com by pmaupin on 16 Jan 2010 at 7:43