Class: Complex

Inherits:
Object show all
Defined in:
lib/y_support/abstract_algebra.rb

Overview

Patching Complex with #zero method.

Class Method Summary collapse

Class Method Details

.add(other) ⇒ Object



123
# File 'lib/y_support/abstract_algebra.rb', line 123

def add( other ); self + other end

.additive_identityObject Also known as: zero



121
# File 'lib/y_support/abstract_algebra.rb', line 121

def additive_identity; Complex 0.0, 0.0 end

.additive_inverseObject



124
# File 'lib/y_support/abstract_algebra.rb', line 124

def additive_inverse; -self end

.multiplicative_identityObject Also known as: one



126
# File 'lib/y_support/abstract_algebra.rb', line 126

def multiplicative_identity; Complex 1, 0 end

.multiplicative_inverseObject



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