File: cheb.rdoc [rb-gsl-1.16.0.4 Documentation]

### Home Classes Methods

### Files

- alf.rdoc
- blas.rdoc
- bspline.rdoc
- changes.rdoc
- cheb.rdoc
- cholesky_complex.rdoc
- combi.rdoc
- complex.rdoc
- const.rdoc
- dht.rdoc
- diff.rdoc
- ehandling.rdoc
- eigen.rdoc
- fft.rdoc
- fit.rdoc
- function.rdoc
- graph.rdoc
- hist.rdoc
- hist2d.rdoc
- hist3d.rdoc
- index.rdoc
- integration.rdoc
- interp.rdoc
- intro.rdoc
- linalg.rdoc
- linalg_complex.rdoc
- math.rdoc
- matrix.rdoc
- min.rdoc
- monte.rdoc
- multimin.rdoc
- multiroot.rdoc
- narray.rdoc
- ndlinear.rdoc
- nonlinearfit.rdoc
- ntuple.rdoc
- odeiv.rdoc
- perm.rdoc
- poly.rdoc
- qrng.rdoc
- randist.rdoc
- ref.rdoc
- rng.rdoc
- roots.rdoc
- sf.rdoc
- siman.rdoc
- sort.rdoc
- start.rdoc
- stats.rdoc
- sum.rdoc
- tensor.rdoc
- tut.rdoc
- use.rdoc
- vector.rdoc
- vector_complex.rdoc
- wavelet.rdoc

### Class Index

Quicksearch

- OOL
- OOL::Conmin
- OOL::Conmin::Gencan_parameters
- OOL::Conmin::Minimizer
- OOL::Conmin::Minimizer::Gencan
- OOL::Conmin::Minimizer::Gencan::Parameters
- OOL::Conmin::Minimizer::Pgrad
- OOL::Conmin::Minimizer::Pgrad::Parameters
- OOL::Conmin::Minimizer::Spg
- OOL::Conmin::Minimizer::Spg::Parameters
- OOL::Conmin::Pgrad_parameters
- OOL::Conmin::Spg_parameters
- GSL
- GSL::Oper
- Array

No matching classes.

# Chebyshev Approximations

This chapter describes routines for computing Chebyshev approximations to univariate functions. A Chebyshev approximation is a truncation of the series f(x) = sum c_n T_n(x), where the Chebyshev polynomials T_n(x) = cos(n arccos x) provide an orthogonal basis of polynomials on the interval [-1,1] with the weight function 1 / sqrt{1-x^2}. The first few Chebyshev polynomials are, T_0(x) = 1, T_1(x) = x, T_2(x) = 2 x^2 - 1. For further information see Abramowitz & Stegun, Chapter 22.

1. GSL::Cheb class

2. Chebyshev Series Evaluation

3. Derivatives and Integrals

4. Examples

## `Cheb` class

- GSL::Cheb.alloc(n)

  This create an instance of the GSL::Cheb class for a Chebyshev series of order 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.alloc { |x|
          if x < 0.5
            0.25
          else
            0.75
          end
        }

        cs = GSL::Cheb.alloc(40)
        cs.init(f, 0, 1)

## Chebyshev Series Evaluation

- 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`.

## Derivatives and Integrals

- 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.alloc { |x|
      if x < 0.5
        0.25
      else
        0.75
      end
    }

    n = 1000
    order = 40
    cs = GSL::Cheb.alloc(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 `examples/cheb/`.

prev next

Reference index top

[Validate]

Generated with the Darkfish Rdoc Generator 2.