lib/dydx/algebra/inverse.rb in dydx-0.1.28 vs lib/dydx/algebra/inverse.rb in dydx-0.1.29
- old
+ new
@@ -7,16 +7,13 @@
def initialize(x, operator)
@x, @operator = x, operator
end
def to_s
- # sym = {'*'=>'/', '+'=>'-'}[operator.to_s]
case operator
- when :+
- "( - #{x} )"
- when :*
- "( 1 / #{x} )"
+ when :+ then "( - #{x} )"
+ when :* then "( 1 / #{x} )"
end
end
def differentiate(sym=:x)
case operator
@@ -25,12 +22,8 @@
when :*
inverse(x.differentiate(sym) * inverse(x ^ 2, :*), :+)
end
end
alias_method :d, :differentiate
-
- def ==(x)
- to_s == x.to_s
- end
end
end
-end
\ No newline at end of file
+end