GSL_Function class

Class Methods

GSL_Function.new
GSL_Function.alloc

This creates a GSL_Function object with a procedure block. For example, an object corresponding to the function sin(x) is given by

require 'gsl'
f = GSL_Function.new { |x| sin(x) }

One can compute sin(x) with the object f and the method eval, as

p f.eval(x)

Methods

GSL_Function#eval(x)
GSL_Function#call(x)
GSL_Function#[x]

These methods return a value of the function at x.

p f.eval(2.5)
p f.call(2.5)
p f[2.5]
GSL_Function#set { |x| ... }

This method sets the procedure of the GSL_Function object, as

f = GSL_Function.new { |x| sin(x) }
p f.eval(1.0)               <- sin(1.0)
f.set { |x| cos(x) }
p f.eval(1.0)               <- cos(1.0)