lib/dydx/algebra/operator/parts/inverse.rb in dydx-0.1.4 vs lib/dydx/algebra/operator/parts/inverse.rb in dydx-0.1.25
- 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 operator.eql?(:+) && !x.is_a?(Inverse)
+ elsif !x.is_a?(Inverse) && operator == :+
x + self
- elsif operator.eql?(:**) && self.operator.eql?(:*)
- inverse(self.x ** x, :*)
+ elsif self.operator == :* && operator == :^
+ inverse(self.x ^ x, :*)
else
super(x)
end
end
end