lib/dydx/algebra/operator/parts/inverse.rb in dydx-0.1.314 vs lib/dydx/algebra/operator/parts/inverse.rb in dydx-0.1.412
- old
+ new
@@ -1,20 +1,20 @@
module Dydx
module Algebra
module Operator
module Parts
module Inverse
- %w(+ * ^).map(&:to_sym).each do |operator|
+ %w(+ * **).map(&:to_sym).each do |operator|
define_method(operator) do |x|
if inverse?(operator, x)
case operator
when :+ then e0
when :* then e1
end
- elsif !x.is_a?(Inverse) && operator == :+
+ elsif operator.eql?(:+) && !x.is_a?(Inverse)
x + self
- elsif self.operator == :* && operator == :^
- inverse(self.x ^ x, :*)
+ elsif operator.eql?(:**) && self.operator.eql?(:*)
+ inverse(self.x ** x, :*)
else
super(x)
end
end
end