Sha256: 1b9166f44f9c0e1bb9170c660a819f8d1771aef856a0991e943892793805c7a0

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

module Math

  class Function

    attr_reader :x_start, :x_end
    #
    # +Math::Function.new+:
    #
    # abstract base class function
    #
    #:nodoc:
    def initialize
      setup
    end

    #:doc:
    #
    # +y(x)+:
    #
    # Returns a real value given x
    #
    #:nodoc:
    def y(x)
    end

    #: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:
    def xy(s)
      resx = []
      resy = []
      self.x_start.step(x_end, s) do
        |x|
        resx << x
        resy << self.y(x)
      end
      [resx, resy]
    end

    #:doc:
    #
    # +label+
    #
    # Returns a label which can be used in plots
    #
    def label
      ''
    end

    class << self

      def from_yaml(yh)
        new
      end

    end

  private

    def setup
      raise Mext::PureAbstractMethodCalled
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby-mext-0.14.0 lib/mext/math/function.rb
ruby-mext-0.13.1 lib/mext/math/function.rb
ruby-mext-0.13.0 lib/mext/math/function.rb
ruby-mext-0.12.1 lib/mext/math/function.rb
ruby-mext-0.12.0 lib/mext/math/function.rb
ruby-mext-0.11.1 lib/mext/math/function.rb
ruby-mext-0.11.0 lib/mext/math/function.rb
ruby-mext-0.10.1 lib/mext/math/function.rb
ruby-mext-0.10.0 lib/mext/math/function.rb
ruby-mext-0.9.1 lib/mext/math/function.rb
ruby-mext-0.9.0 lib/mext/math/function.rb
ruby-mext-0.8.0 lib/mext/math/function.rb
ruby-mext-0.7.0 lib/mext/math/function.rb
ruby-mext-0.6.0 lib/mext/math/function.rb
ruby-mext-0.5.0 lib/mext/math/function.rb