Module: Kernel
- Defined in:
- lib/notation.rb
Overview
Extend the core Kernel module
Constant Summary collapse
- NOTATION_VERSION =
Version of the notation library
'0.3.0'
Instance Method Summary collapse
-
#°(degrees) ⇒ Object
Degrees to radians.
-
#±(value, delta) ⇒ Object
Plus or minus (returns array with both values).
-
#Δ(a, b) ⇒ Object
Delta (difference between two values).
-
#∏(*args) ⇒ Object
Pi product, i.e.
-
#∑(*args) ⇒ Object
Sigma, i.e.
-
#√(value) ⇒ Object
Square root.
-
#∛(value) ⇒ Object
Cube root.
-
#∜(value) ⇒ Object
Fourth root.
-
#∞ ⇒ Object
Infinity constant.
-
#≈(a, b, epsilon = 1e-10) ⇒ Object
Approximately equal (within epsilon).
-
#≠(a, b) ⇒ Object
Not equal.
-
#≤(a, b) ⇒ Object
Less than or equal.
-
#≥(a, b) ⇒ Object
Greater than or equal.
-
#!(n) ⇒ Object
Factorial.
-
#%(value) ⇒ Object
Percentage (divide by 100).
-
#|(value) ⇒ Object
Absolute value.
Instance Method Details
#°(degrees) ⇒ Object
Degrees to radians
Example:
154 155 156 |
# File 'lib/notation.rb', line 154 def |
#±(value, delta) ⇒ Object
Plus or minus (returns array with both values)
Example:
145 146 147 |
# File 'lib/notation.rb', line 145 def |
#Δ(a, b) ⇒ Object
Delta (difference between two values)
Example:
100 101 102 |
# File 'lib/notation.rb', line 100 def |
#∏(*args) ⇒ Object
Pi product, i.e. the product of all elements. Improved to handle arrays and individual arguments
Examples:
34 35 36 37 |
# File 'lib/notation.rb', line 34 def |
#∑(*args) ⇒ Object
Sigma, i.e. the sum of all elements. Improved to handle arrays and individual arguments
Examples:
22 23 24 25 |
# File 'lib/notation.rb', line 22 def |
#√(value) ⇒ Object
Square root
Example:
44 45 46 |
# File 'lib/notation.rb', line 44 def |
#∛(value) ⇒ Object
Cube root
Example:
53 54 55 |
# File 'lib/notation.rb', line 53 def |
#∜(value) ⇒ Object
Fourth root
Example:
62 63 64 |
# File 'lib/notation.rb', line 62 def |
#∞ ⇒ Object
Infinity constant
Example:
80 81 82 |
# File 'lib/notation.rb', line 80 def |
#≈(a, b, epsilon = 1e-10) ⇒ Object
Approximately equal (within epsilon)
Example:
109 110 111 |
# File 'lib/notation.rb', line 109 def |
#≠(a, b) ⇒ Object
Not equal
Example:
118 119 120 |
# File 'lib/notation.rb', line 118 def |
#≤(a, b) ⇒ Object
Less than or equal
Example:
127 128 129 |
# File 'lib/notation.rb', line 127 def |
#≥(a, b) ⇒ Object
Greater than or equal
Example:
136 137 138 |
# File 'lib/notation.rb', line 136 def |
#!(n) ⇒ Object
Factorial
Example:
89 90 91 92 93 |
# File 'lib/notation.rb', line 89 def |
#%(value) ⇒ Object
Percentage (divide by 100)
Example:
163 164 165 |
# File 'lib/notation.rb', line 163 def |
#|(value) ⇒ Object
Absolute value
Example:
71 72 73 |
# File 'lib/notation.rb', line 71 def |