Sha256: cf8ac9ae357fe1420cadb807ca7862ef0bf96368f284b2c531b1058baf045c90
Contents?: true
Size: 599 Bytes
Versions: 2
Compression:
Stored size: 599 Bytes
Contents
require 'dydx/helper' require 'dydx/algebra' module Dydx include Algebra class Delta attr_accessor :var, :function def initialize(var, function) @var = var @function = function end def /(delta) if var eval("$#{var}").differentiate(delta.var) elsif delta.function delta.function.differentiate(delta.var) end end end def method_missing(method, *args, &block) method_name = method.to_s return super unless method_name =~ /^d.?$/ Delta.new(method_name[1] ? method_name[1].to_sym : nil, args.first) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dydx-0.0.8 | lib/dydx.rb |
dydx-0.0.7 | lib/dydx.rb |