A Chebyshev series is stored using the GSL::Cheb class.
GSL::Cheb.new(n)
GSL::Cheb.alloc(n)
GSL::Cheb#init(f, a, b)
This computes the Chebyshev approximation the function f over the range (a,b) to the previously specified order. Where f is a GSL::Function object. The computation of the Chebyshev approximation is an O(n^2) process, and requires n function evaluations.
ex) Approximate a step function defined in (0, 1) by a Chebyshev series of order 40.
f = GSL::Function.new { |x| if x < 0.5 0.25 else 0.75 end } cs = GSL::Cheb.new(40) cs.init(f, 0, 1)
GSL::Cheb#eval(x)
GSL::Cheb#eval_n(n, x)
GSL::Cheb#calc_deriv()
GSL::Cheb#deriv()
GSL::Cheb#calc_integ()
GSL::Cheb#integ()
See also the example script, samples/cheb.rb.