Class: Math::Function
- Inherits:
-
Object
- Object
- Math::Function
- Defined in:
- lib/mext/math/function.rb
Instance Attribute Summary collapse
-
#x_end ⇒ Object
readonly
Returns the value of attribute x_end.
-
#x_start ⇒ Object
readonly
Returns the value of attribute x_start.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Function
constructor
Math::Function.new:. -
#label ⇒ Object
:doc:.
-
#xy(s) ⇒ Object
:doc:.
-
#y(x) ⇒ Object
:doc:.
Constructor Details
#initialize ⇒ Function
Math::Function.new:
abstract base class function
:nodoc:
12 13 14 |
# File 'lib/mext/math/function.rb', line 12 def initialize setup end |
Instance Attribute Details
#x_end ⇒ Object (readonly)
Returns the value of attribute x_end.
5 6 7 |
# File 'lib/mext/math/function.rb', line 5 def x_end @x_end end |
#x_start ⇒ Object (readonly)
Returns the value of attribute x_start.
5 6 7 |
# File 'lib/mext/math/function.rb', line 5 def x_start @x_start end |
Class Method Details
.from_yaml(yh) ⇒ Object
60 61 62 |
# File 'lib/mext/math/function.rb', line 60 def from_yaml(yh) new end |
Instance Method Details
#label ⇒ Object
:doc:
label
Returns a label which can be used in plots
54 55 56 |
# File 'lib/mext/math/function.rb', line 54 def label '' end |
#xy(s) ⇒ Object
:doc:
xy(step)
Returns a full deployment of the function evaluated with a step of step. It is returned in two arrays - one for the x values and the other for the y values.
This method is mainly for testing purposes with the dataxy method of gruff
:nodoc:
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mext/math/function.rb', line 37 def xy(s) resx = [] resy = [] self.x_start.step(x_end, s) do |x| resx << x resy << self.y(x) end [resx, resy] end |
#y(x) ⇒ Object
:doc:
y(x):
Returns a real value given x
:nodoc:
23 24 |
# File 'lib/mext/math/function.rb', line 23 def y(x) end |