=begin
= Chebyshev Approximations
A Chebyshev series is stored using the GSL::Cheb class.

== Class methods

--- GSL::Cheb.new(n) 
--- GSL::Cheb.alloc(n) 
    This create an instance of the GSL::Cheb class for a Chebyshev series of order n.

== Methods

--- 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|URL:function.html>)) 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)
    This evaluates the Chebyshev series at a given point ((|x|)).

--- GSL::Cheb#eval_n(n, x)
    This evaluates the Chebyshev series at a given point ((|x|)), to (at most) the given order ((|n|)).

--- GSL::Cheb#calc_deriv()
--- GSL::Cheb#deriv()
    This computes the derivative of the series, and returns a new GSL::Cheb object which contains the computed derivative. The reciever is not changed.

--- GSL::Cheb#calc_integ()
--- GSL::Cheb#integ()
    This computes the integral of the series, and returns a new GSL::Cheb object which contains the computed integral coefficients. The reciever is not changed.

=== Example
   #!/usr/bin/env ruby
   require("gsl")

   f = GSL::Function.new { |x|
     if x < 0.5
       0.25
     else
       0.75
     end
   }

   n = 1000
   order = 40
   cs = GSL::Cheb.new(order)
   cs.init(f, 0, 1)

   x = Vector.linspace(0, 1, n)
   ff = f.eval(x)
   r10 = cs.eval_n(10, x)
   r40 = cs.eval(x)
   GSL::graph(x, ff, r10, r40)


See also the example scripts in (({samples/cheb/})).

((<prev|URL:diff.html>))
((<next|URL:sum.html>))

((<Reference index|URL:ref.html>))
((<top|URL:index.html>))
=end
