Class: Linear1::System
- Inherits:
-
Object
- Object
- Linear1::System
- Defined in:
- lib/linear1/system.rb
Instance Attribute Summary collapse
-
#e1 ⇒ Object
readonly
Returns the value of attribute e1.
-
#e2 ⇒ Object
readonly
Returns the value of attribute e2.
Instance Method Summary collapse
- #execute(x) ⇒ Object
-
#initialize(equation1, equation2) ⇒ System
constructor
A new instance of System.
Constructor Details
#initialize(equation1, equation2) ⇒ System
Returns a new instance of System.
4 5 6 |
# File 'lib/linear1/system.rb', line 4 def initialize equation1, equation2 @e1, @e2 = equation1, equation2 end |
Instance Attribute Details
#e1 ⇒ Object (readonly)
Returns the value of attribute e1.
3 4 5 |
# File 'lib/linear1/system.rb', line 3 def e1 @e1 end |
#e2 ⇒ Object (readonly)
Returns the value of attribute e2.
3 4 5 |
# File 'lib/linear1/system.rb', line 3 def e2 @e2 end |
Instance Method Details
#execute(x) ⇒ Object
7 8 9 10 11 |
# File 'lib/linear1/system.rb', line 7 def execute x final = Array.new @equations.each {|equation| final << equation.execute(x)} final end |