Module: Kernel

Defined in:
lib/arithmetic.rb

Instance Method Summary collapse

Instance Method Details

#(values) ⇒ Object



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

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

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



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

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

#(values) ⇒ Object



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

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

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



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

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

#(root) ⇒ Object



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

def (root)
   Math.sqrt(root)
end