lib/dydx/algebra/operator/parts/formula.rb in dydx-0.1.29 vs lib/dydx/algebra/operator/parts/formula.rb in dydx-0.1.31
- old
+ new
@@ -11,51 +11,51 @@
elsif g.combinable?(x, operator)
g.send(operator, x).send(operator, f)
else
super(x)
end
- elsif formula?(sub_ope(operator)) && openable?(operator, x)
- f.send(operator, x).send(sub_ope(operator), g.send(operator, x))
- elsif formula?(super_ope(operator)) && x.formula?(super_ope(operator))
+ elsif formula?(operator.sub) && openable?(operator, x)
+ f.send(operator, x).send(operator.sub, g.send(operator, x))
+ elsif formula?(operator.super) && x.formula?(operator.super)
w1, w2 = common_factors(x)
- return super(x) unless (w1 && w2) && (super_ope(operator).commutative? || w1 == w2)
+ return super(x) unless (w1 && w2) && (operator.super.commutative? || w1 == w2)
case operator
when :+
- send(w1).send(super_ope(operator), send(rest(w1)).send(operator, x.send(rest(w2))))
+ send(w1).send(operator.super, send(rest(w1)).send(operator, x.send(rest(w2))))
when :*
case w1
when :f
- send(w1).send(super_ope(operator), send(rest(w1)).send(sub_ope(operator), x.send(rest(w2))))
+ send(w1).send(operator.super, send(rest(w1)).send(operator.sub, x.send(rest(w2))))
when :g
- send(w1).send(super_ope(operator), send(rest(w1)).send(operator, x.send(rest(w2)))).commutate!
+ send(w1).send(operator.super, send(rest(w1)).send(operator, x.send(rest(w2)))).commutate!
end
end
- elsif formula?(super_ope(operator)) && x.inverse?(operator) && x.x.formula?(super_ope(operator))
+ elsif formula?(operator.super) && x.inverse?(operator) && x.x.formula?(operator.super)
w1, w2 = common_factors(x.x)
- return super(x) unless (w1 && w2) && (super_ope(operator).commutative? || w1 == w2)
+ return super(x) unless (w1 && w2) && (operator.super.commutative? || w1 == w2)
case operator
when :+
- send(w1).send(super_ope(operator), send(rest(w1)).send(inverse_ope(operator), x.x.send(rest(w2))))
+ send(w1).send(operator.super, send(rest(w1)).send(inverse_ope(operator), x.x.send(rest(w2))))
when :*
case w1
when :f
- send(w1).send(super_ope(operator), send(rest(w1)).send(inverse_ope(sub_ope(operator)), x.x.send(rest(w2))))
+ send(w1).send(operator.super, send(rest(w1)).send(inverse_ope(operator.sub), x.x.send(rest(w2))))
when :g
- send(w1).send(super_ope(operator), send(rest(w1)).send(inverse_ope(operator), x.x.send(rest(w2)))).commutate!
+ send(w1).send(operator.super, send(rest(w1)).send(inverse_ope(operator), x.x.send(rest(w2)))).commutate!
end
end
else
super(x)
end
end
end
%w(^).map(&:to_sym).each do |operator|
define_method(operator) do |x|
- if formula?(sub_ope(operator)) && openable?(operator, x)
- f.send(operator, x).send(sub_ope(operator), g.send(operator, x))
+ if formula?(operator.sub) && openable?(operator, x)
+ f.send(operator, x).send(operator.sub, g.send(operator, x))
else
super(x)
end
end
end