Module: Kernel

Defined in:
lib/arithmetic.rb

Instance Method Summary collapse

Instance Method Details

#(values) ⇒ Object



13
14
15
# File 'lib/arithmetic.rb', line 13

def (values)
  values.inject(:*)
end

#∏x(expression, variable, values) ⇒ Object



17
18
19
# File 'lib/arithmetic.rb', line 17

def ∏x(expression, variable, values)
    (values.map {|value| eval(expression.gsub(variable, value.to_s))})
end

#(values) ⇒ Object



5
6
7
# File 'lib/arithmetic.rb', line 5

def (values)
  values.inject(&:+)
end

#∑x(expression, variable, values) ⇒ Object



21
22
23
# File 'lib/arithmetic.rb', line 21

def ∑x(expression, variable, values)
    (values.map {|value| eval(expression.gsub(variable, value.to_s))})
end

#(root) ⇒ Object



9
10
11
# File 'lib/arithmetic.rb', line 9

def (root)
   Math.sqrt(root)
end