Class: Function
- Inherits:
-
Object
- Object
- Function
- Defined in:
- sample/nlsolve.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #eps ⇒ Object
-
#initialize ⇒ Function
constructor
A new instance of Function.
- #one ⇒ Object
- #ten ⇒ Object
- #two ⇒ Object
-
#values(x) ⇒ Object
<= defines functions solved.
- #zero ⇒ Object
Constructor Details
#initialize ⇒ Function
Returns a new instance of Function.
13 14 15 16 17 18 19 |
# File 'sample/nlsolve.rb', line 13 def initialize() @zero = BigDecimal.new("0.0") @one = BigDecimal.new("1.0") @two = BigDecimal.new("2.0") @ten = BigDecimal.new("10.0") @eps = BigDecimal.new("1.0e-16") end |
Instance Method Details
#eps ⇒ Object
24 |
# File 'sample/nlsolve.rb', line 24 def eps ;@eps ;end |
#one ⇒ Object
21 |
# File 'sample/nlsolve.rb', line 21 def one ;@one ;end |
#ten ⇒ Object
23 |
# File 'sample/nlsolve.rb', line 23 def ten ;@ten ;end |
#two ⇒ Object
22 |
# File 'sample/nlsolve.rb', line 22 def two ;@two ;end |
#values(x) ⇒ Object
<= defines functions solved
25 26 27 28 29 30 31 32 |
# File 'sample/nlsolve.rb', line 25 def values(x) # <= defines functions solved f = [] f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0 f2 = x[0] - x[1] # f2 = x - y => 0 f <<= f1 f <<= f2 f end |
#zero ⇒ Object
20 |
# File 'sample/nlsolve.rb', line 20 def zero;@zero;end |