Module: Dydx

Includes:
Algebra
Defined in:
lib/dydx.rb,
lib/dydx/api.rb,
lib/dydx/delta.rb,
lib/dydx/helper.rb,
lib/dydx/algebra.rb,
lib/dydx/version.rb,
lib/dydx/function.rb,
lib/dydx/integrand.rb,
lib/dydx/algebra/set.rb,
lib/dydx/algebra/formula.rb,
lib/dydx/algebra/inverse.rb,
lib/dydx/algebra/operator/num.rb,
lib/dydx/algebra/operator/formula.rb,
lib/dydx/algebra/operator/general.rb,
lib/dydx/algebra/operator/inverse.rb,
lib/dydx/algebra/operator/parts/num.rb,
lib/dydx/algebra/operator/parts/base.rb,
lib/dydx/algebra/operator/parts/symbol.rb,
lib/dydx/algebra/operator/parts/formula.rb,
lib/dydx/algebra/operator/parts/general.rb,
lib/dydx/algebra/operator/parts/inverse.rb

Defined Under Namespace

Modules: API, Algebra, Helper Classes: Delta, Function, Integrand

Constant Summary collapse

VERSION =
'0.2.7000001'

Instance Method Summary collapse

Methods included from Algebra

#-@, #inverse

Methods included from Algebra::Set

#cos, #e, #e0, #e1, #log, #log10, #log2, #oo, #pi, #sin, #tan

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/dydx.rb', line 54

def method_missing(method, *args, &block)
  method_name = method.to_s
  if method_name =~ /^d.$/
    Delta.new(method_name[1].to_sym, args.first)
  elsif method_name =~ /^[a-z]$/
    method_name.to_sym
  else
    super
  end
end

Instance Method Details

#_(*args) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/dydx.rb', line 43

def _(*args)
  case args.count
  when 1
    num = args.first
    Num.new(num)
  when 3
    ltr, op, rtr = args
    ltr.send(op, rtr)
  end
end

#dObject



35
36
37
# File 'lib/dydx.rb', line 35

def d
  Delta.new
end

#resetObject



39
40
41
# File 'lib/dydx.rb', line 39

def reset
  $f, $g, $h = nil, nil, nil
end

#S(function, delta) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/dydx.rb', line 26

def S(function, delta)
  itgrl_var = delta.var
  unless function.is_a?(Function)
    eval "g(#{itgrl_var}) <= #{function}"
    function = g(x)
  end
  Integrand.new(function, itgrl_var)
end