lib/dydx/algebra/formula.rb in dydx-0.1.25 vs lib/dydx/algebra/formula.rb in dydx-0.1.28
- old
+ new
@@ -3,9 +3,10 @@
class Formula
include Helper
attr_accessor :f, :operator, :g
def initialize(f, g, operator)
+ g, f = f, g if g.is_num? && operator.commutative?
@f, @g, @operator = f, g, operator
end
def differentiate(sym=:x)
case @operator