gsl_interpolation

gsl_interpolation - Last revised: 2006-Feb-06 Using GSL...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Last revised: 2006-Feb-06 Using GSL Interpolation Functions This is a guide to using the Gnu Scientific Library (GSL) routines to do interpolation. In the following we’ll assume we have a function defined by npts pairs of numbers, ( x, y ), stored in two arrays, x_array and y_array . We want to evaluate that function for any x using interpolation. 1. Include the gsl_errno.h and gsl_spline.h header files: #include <gsl/gsl_errno.h> #include <gsl/gsl_spline.h> 2. Allocate an interpolation accelerator and a gsl_spline object (these could be split into separate lines): gsl_interp_accel *my_accel_ptr = gsl_interp_accel_alloc (); gsl_spline *my_spline_ptr = gsl_spline_alloc (gsl_interp_cspline, npts); Some of the choices for the interpolation function (used as the first argument to gsl_spline_alloc ) are: gsl_interp_linear — Linear interpolation. Probably only useful to check the other interpolation functions. gsl_interp_polynomial
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/30/2011 for the course PHYSICS 780 taught by Professor Furnstahl during the Winter '11 term at Ohio State.

Page1 / 2

gsl_interpolation - Last revised: 2006-Feb-06 Using GSL...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online