Module: MathSymbols::MathExtensions
Instance Method Summary collapse
- #Γ(value) ⇒ Object
- #δ(value) ⇒ Object
- #π ⇒ Object
- #∏(enumerable) ⇒ Object
- #∑(enumerable) ⇒ Object
- #√(value) ⇒ Object
- #∞ ⇒ Object
Instance Method Details
#Γ(value) ⇒ Object
19 20 21 |
# File 'lib/math_symbols/math_extensions.rb', line 19 def Γ(value) Math.gamma value end |
#δ(value) ⇒ Object
31 32 33 |
# File 'lib/math_symbols/math_extensions.rb', line 31 def δ(value) value.zero? ? ∞ : 0 end |
#∏(enumerable) ⇒ Object
9 10 11 12 13 |
# File 'lib/math_symbols/math_extensions.rb', line 9 def ∏(enumerable) enumerable.inject 1 do |acc, x| acc * yield(x) end end |
#∑(enumerable) ⇒ Object
3 4 5 6 7 |
# File 'lib/math_symbols/math_extensions.rb', line 3 def ∑(enumerable) enumerable.inject 0 do |acc, x| acc + yield(x) end end |