lib/dydx/helper.rb in dydx-0.0.5 vs lib/dydx/helper.rb in dydx-0.0.6
- old
+ new
@@ -82,9 +82,29 @@
when :*
:^
end
end
+ def sub_ope(operator)
+ case operator
+ when :*
+ :+
+ end
+ end
+
+ def inverse_ope(operator)
+ case operator
+ when :+
+ :-
+ when :*
+ :/
+ end
+ end
+
+ def commutative?(operator)
+ [:+, :*].include?(operator)
+ end
+
def inverse?(x, operator)
if is_a?(Algebra::Inverse)
self.operator == operator && self.x == x
elsif x.is_a?(Algebra::Inverse)
self == x.x
\ No newline at end of file