Sha256: e1111729d9dc15aaab70b7694bb0df617db7941375171c766ce07b06c6cc1f0a

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

module Dydx
  module Algebra
    module Operator
      module Parts
        module Inverse
          %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)
                x + self
              elsif operator.eql?(:**) && self.operator.eql?(:*)
                inverse(self.x ** x, :*)
              else
                super(x)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dydx-0.2.7000001 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.2.7000000 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.41421 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.412 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.4 lib/dydx/algebra/operator/parts/inverse.rb