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



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

def add( other ); self + other end

.additive_identityObject Also known as: zero



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

def additive_identity; Complex 0.0, 0.0 end

.additive_inverseObject



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

def additive_inverse; -self end

.multiplicative_identityObject Also known as: one



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

def multiplicative_identity; Complex 1, 0 end

.multiplicative_inverseObject



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

def multiplicative_inverse; Complex( 1, 0 ) / self end

.multiply(other) ⇒ Object



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

def multiply( other ); self * other end