lib/dydx/algebra/operator/parts/formula.rb in dydx-0.0.3 vs lib/dydx/algebra/operator/parts/formula.rb in dydx-0.0.4
- old
+ new
@@ -11,17 +11,17 @@
elsif g == x.g
f.send(operator, x.f) * g
else
super(x)
end
- elsif ([self.operator, operator].sort == [:+, :-]) && ( f == x || g == x )
+ elsif ([self.operator, operator].sort == [:+, :-]) && include?(x)
if f == x
g
elsif g == x
f
end
- elsif (self.operator == operator) && ( f == x || g == x )
+ elsif (self.operator == operator) && include?(x)
if f == x
f.send(operator, x).send(operator, g)
elsif g == x
f.send(operator, g.send(:+, x))
end
@@ -39,16 +39,16 @@
elsif g == x.g
f.send(operator, x.f) ^ g
else
super(x)
end
- elsif ([self.operator, operator].sort == [:*, :/]) && ( f == x || g == x )
+ elsif ([self.operator, operator].sort == [:*, :/]) && include?(x)
if f == x
g
elsif g == x
f
end
- elsif (self.operator == operator) && ( f == x || g == x )
+ elsif (self.operator == operator) && include?(x)
if f == x
f.send(operator, x).send(operator, g)
elsif g == x
f.send(operator, g.send(:* , x))
end