Class: Complex
Overview
Patching Complex with #zero method.
Class Method Summary collapse
- .add(other) ⇒ Object
- .additive_identity ⇒ Object (also: zero)
- .additive_inverse ⇒ Object
- .multiplicative_identity ⇒ Object (also: one)
- .multiplicative_inverse ⇒ Object
- .multiply(other) ⇒ Object
Class Method Details
.add(other) ⇒ Object
123 |
# File 'lib/y_support/abstract_algebra.rb', line 123 def add( other ); self + other end |
.additive_identity ⇒ Object Also known as: zero
121 |
# File 'lib/y_support/abstract_algebra.rb', line 121 def additive_identity; Complex 0.0, 0.0 end |
.additive_inverse ⇒ Object
124 |
# File 'lib/y_support/abstract_algebra.rb', line 124 def additive_inverse; -self end |
.multiplicative_identity ⇒ Object Also known as: one
126 |
# File 'lib/y_support/abstract_algebra.rb', line 126 def multiplicative_identity; Complex 1, 0 end |
.multiplicative_inverse ⇒ Object
128 |
# File 'lib/y_support/abstract_algebra.rb', line 128 def multiplicative_inverse; Complex( 1, 0 ) / self end |
.multiply(other) ⇒ Object
125 |
# File 'lib/y_support/abstract_algebra.rb', line 125 def multiply( other ); self * other end |