Class: Math::Stepwise
Defined Under Namespace
Classes: Point
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
:values
.
Attributes inherited from Function
Class Method Summary collapse
-
.from_yaml(yh) ⇒ Object
from_yaml(yaml_hash):.
Instance Method Summary collapse
-
#initialize(vs = []) ⇒ Stepwise
constructor
Math::Stepwise.new(values = []).
- #label ⇒ Object
-
#y(x) ⇒ Object
:doc:.
Methods inherited from Function
Methods included from Mext::Utilities
Constructor Details
#initialize(vs = []) ⇒ Stepwise
Math::Stepwise.new(values = [])
stepwise function
Arguments are:
values
: an array of (x
, y
) pairs
:nodoc:
31 32 33 |
# File 'lib/mext/math/stepwise.rb', line 31 def initialize(vs = []) setup(vs) end |
Instance Attribute Details
#values ⇒ Object (readonly)
:values
is an array of pairs (x
, y
)
19 20 21 |
# File 'lib/mext/math/stepwise.rb', line 19 def values @values end |
Class Method Details
.from_yaml(yh) ⇒ Object
from_yaml(yaml_hash):
creates a Math::Stepwise class from a yaml file which must have the relevant fields:
values
: an array of duples [x, y]
60 61 62 |
# File 'lib/mext/math/stepwise.rb', line 60 def from_yaml(yh) new(yh['values']) end |
Instance Method Details
#label ⇒ Object
46 47 48 |
# File 'lib/mext/math/stepwise.rb', line 46 def label 'stepwise function' end |
#y(x) ⇒ Object
:doc:
y(x):
Returns a value for any given x
:nodoc:
42 43 44 |
# File 'lib/mext/math/stepwise.rb', line 42 def y(x) lookup(x) end |