@@ -30,12 +30,71 @@ class Symbol(SymbolBase):
3030
3131 def __add__ (self , other ):
3232 if isinstance (other , Symbol ):
33- return _internal .__add__symbol__ (self , other )
33+ return _internal .__add_symbol__ (self , other )
3434 elif isinstance (other , _Number ):
35- return _internal .__add__scalar__ (self , scalar = other )
35+ return _internal .__add_scalar__ (self , scalar = other )
3636 else :
3737 raise TypeError ("type %s not supported" % str (type (other )))
3838
39+ def __radd__ (self , other ):
40+ return self .__add__ (other )
41+
42+ def __sub__ (self , other ):
43+ if isinstance (other , Symbol ):
44+ return _internal .__sub_symbol__ (self , other )
45+ if isinstance (other , Number ):
46+ return _internal .__sub_scalar__ (self , scalar = other )
47+ else :
48+ raise TypeError ('type %s not supported' % str (type (other )))
49+
50+ def __rsub__ (self , other ):
51+ if isinstance (other , Number ):
52+ return _internal .__rsub_scalar__ (self , scalar = other )
53+ else :
54+ raise TypeError ('type %s not supported' % str (type (other )))
55+
56+ def __mul__ (self , other ):
57+ if isinstance (other , Symbol ):
58+ return _internal .__mul_symbol__ (self , other )
59+ if isinstance (other , Number ):
60+ return _internal .__mul_scalar__ (self , scalar = other )
61+ else :
62+ raise TypeError ('type %s not supported' % str (type (other )))
63+
64+ def __rmul__ (self , other ):
65+ return self .__mul__ (other )
66+
67+ def __div__ (self , other ):
68+ if isinstance (other , Symbol ):
69+ return _internal .__div_symbol__ (self , other )
70+ if isinstance (other , Number ):
71+ return _internal .__div_scalar__ (self , scalar = other )
72+ else :
73+ raise TypeError ('type %s not supported' % str (type (other )))
74+
75+ def __rdiv__ (self , other ):
76+ if isinstance (other , Number ):
77+ return _internal .__rdiv_scalar__ (self , scalar = other )
78+ else :
79+ raise TypeError ('type %s not supported' % str (type (other )))
80+
81+ def __truediv__ (self , other ):
82+ return self .__div__ (other )
83+
84+ def __rtruediv__ (self , other ):
85+ return self .__rdiv__ (other )
86+
87+ def __pow__ (self , other ):
88+ if isinstance (other , Symbol ):
89+ return _internal .__pow_symbol__ (self , other )
90+ if isinstance (other , Number ):
91+ return _internal .__pow_scalar__ (self , scalar = other )
92+ else :
93+ raise TypeError ('type %s not supported' % str (type (other )))
94+
95+ def __neg__ (self ):
96+ return self .__mul__ (- 1.0 )
97+
3998 def __copy__ (self ):
4099 return self .__deepcopy__ ()
41100
0 commit comments