Class: Math::Function
- Inherits:
-
Object
- Object
- Math::Function
- Includes:
- Mext::Utilities
- Defined in:
- lib/mext/math/function.rb
Direct Known Subclasses
Expon, Line, Log, Polynomial, Stepwise
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.
Instance Method Summary collapse
-
#initialize ⇒ Function
constructor
Math::Function.new
:. -
#label ⇒ Object
:doc:.
-
#xy(s) ⇒ Object
:doc:.
-
#y(x) ⇒ Object
:doc:.
Methods included from Mext::Utilities
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 |
Instance Method Details
#label ⇒ Object
:doc:
label
Returns a label which can be used in plots
55 56 57 |
# File 'lib/mext/math/function.rb', line 55 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:
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mext/math/function.rb', line 38 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 25 |
# File 'lib/mext/math/function.rb', line 23 def y(x) x end |