Professional Documents
Culture Documents
cpp
//
// This program determines points and weights for Gaussian quadrature
//
// Programmer: Dick Furnstahl furnstahl.1@osu.edu
//
// Revision history:
// 04-Jan-2004 original version, for 780.20 Computational Physics
//
// Notes:
// * compile with: "g++ -Wall -c gauss.cpp"
// * adapted from: "Projects in Computational Physics" by Landau and Paez
// copyrighted by John Wiley and Sons, New York
// code copyrighted by RH Landau
// * Needs more careful treatment of integers <--> doubles
//
//************************************************************************
// include files
#include <cmath>
#include "integ_routines.h"
//************************************************************************
void
gauss (int npts, int job, double a, double b, double xpts[], double weights[])
{
// npts number of points
// job = 0 rescaling uniformly between (a,b)
// 1 for integral (0,b) with 50% points inside (0, ab/(a+b))
// 2 for integral (a,inf) with 50% inside (a,b+2a)
// xpts, weights output grid points and weights.