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.
14 15 16 17 18 19 20 |
# File 'sample/nlsolve.rb', line 14 def initialize() @zero = BigDecimal("0.0") @one = BigDecimal("1.0") @two = BigDecimal("2.0") @ten = BigDecimal("10.0") @eps = BigDecimal("1.0e-16") end |
Instance Method Details
#eps ⇒ Object
25 |
# File 'sample/nlsolve.rb', line 25 def eps ;@eps ;end |
#one ⇒ Object
22 |
# File 'sample/nlsolve.rb', line 22 def one ;@one ;end |
#ten ⇒ Object
24 |
# File 'sample/nlsolve.rb', line 24 def ten ;@ten ;end |
#two ⇒ Object
23 |
# File 'sample/nlsolve.rb', line 23 def two ;@two ;end |
#values(x) ⇒ Object
<= defines functions solved
26 27 28 29 30 31 32 33 |
# File 'sample/nlsolve.rb', line 26 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
21 |
# File 'sample/nlsolve.rb', line 21 def zero;@zero;end |