class ChebyRuby::UnivariateFunction

This is the class for a univariate function.

@attr func [Lambda] the univariate function.

Attributes

func[RW]

Public Class Methods

new(&func) click to toggle source

The constructor for the class UnivariateFunction.

@param [Lambda] func which represents the function.

# File lib/chebyruby/univariate_function.rb, line 10
def initialize(&func)
  @func = func
end

Public Instance Methods

value(x) click to toggle source

This gets the value of the function at a specified value.

@param [Numeric] x the value at which the function is evaluated. @return the value of the function at x.

# File lib/chebyruby/univariate_function.rb, line 18
def value(x)
  func.call(x.to_f)
end