Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> d1 = BaseDyadic(a, b)
- >>> 3 * d1
- 3*(a|b)
- >>> type(_)
- <class '__main__.DyadicMul'>
- >>> d1 + c * BaseDyadic(m, n)
- c*(m|n) + (a|b)
- >>> type(_)
- <class '__main__.DyadicAdd'>
- >>> type(d1 + d1)
- <class '__main__.DyadicMul'>
- >>> d2 = 4 * BaseDyadic(a, b) + 5 * BaseDyadic(m, n)
- >>> d2.expand()
- 4*(a|b) + 5*(m|n)
- >>> type(_)
- <class '__main__.DyadicAdd'>
- >>> d2 * 0
- 0
- >>> type(_)
- <class 'sympy.core.numbers.Zero'>
- >>> 3 * d2
- 12*(a|b) + 15*(m|n)
- >>> d2.factor()
- Traceback (most recent call last):
- File "<pyshell#126>", line 1, in <module>
- d2.factor()
- File "/home/sachin/dyadic.py", line 57, in factor
- raise TypeError("Factoring not supported for dyadics")
- TypeError: Factoring not supported for dyadics
- >>> d2 & V
- 4*(b.V)*a + 5*(n.V)*m
- >>> d2 * d2
- Traceback (most recent call last):
- File "<pyshell#128>", line 1, in <module>
- d2 * d2
- File "/home/sachin/pythlibs/sympy/core/decorators.py", line 115, in binary_op_wrapper
- return func(self, other)
- File "/home/sachin/dyadic.py", line 39, in __mul__
- return DyadicMul(self, other)
- File "/home/sachin/dyadic.py", line 147, in __new__
- raise ValueError("Cannot multiple two dyadics")
- ValueError: Cannot multiple two dyadics
- >>> d2 & d2
- 16*(b.a)*(a|b) + 20*(b.m)*(a|n) + 20*(n.a)*(m|b) + 25*(n.m)*(m|n)
- >>> d3 = 5 * BaseDyadic(a, b)
- >>> d3/5
- (a|b)
- >>> type(_)
- <class '__main__.BaseDyadic'>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement