Class: ChebyRuby::UnivariateFunction
- Inherits:
-
Object
- Object
- ChebyRuby::UnivariateFunction
- Defined in:
- lib/chebyruby/univariate_function.rb
Overview
This is the class for a univariate function.
Instance Attribute Summary collapse
-
#func ⇒ Lambda
the univariate function.
Instance Method Summary collapse
-
#initialize(&func) ⇒ UnivariateFunction
constructor
The constructor for the class UnivariateFunction.
-
#value(x) ⇒ Object
This gets the value of the function at a specified value.
Constructor Details
#initialize(&func) ⇒ UnivariateFunction
The constructor for the class UnivariateFunction.
10 11 12 |
# File 'lib/chebyruby/univariate_function.rb', line 10 def initialize(&func) @func = func end |
Instance Attribute Details
#func ⇒ Lambda
the univariate function.
4 5 6 |
# File 'lib/chebyruby/univariate_function.rb', line 4 def func @func end |
Instance Method Details
#value(x) ⇒ Object
This gets the value of the function at a specified value.
18 19 20 |
# File 'lib/chebyruby/univariate_function.rb', line 18 def value(x) func.call(x.to_f) end |