int1d_chebp.C

00001 /*
00002  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char int1d_chebp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_chebp.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $" ;
00024 
00025 /*
00026  *  Calcul de l'integrale
00027  * 
00028  *      int_0^1 f(x) dx                     (1)
00029  *
00030  *  pour une fonction f(x) paire donnee par ses coefficients de Tchebyshev
00031  *
00032  *      f(x) = som_{i=0}^{nr-1} c_i T_{2i}(x)           (2)
00033  *
00034  * Entree:
00035  * ------
00036  *  int nr  :           Nombre de coefficients de Tchebyshev dans le 
00037  *              developpement (2)
00038  *  const double* cf    :   Tableau des nr coefficients c_i de la fonction
00039  *              definis par (2). Le stokage doit etre le suivant
00040  *              cf[i] = c_i   0 <= i <= nr - 1
00041  *              L'espace memoire correspondant au pointeur cf doit
00042  *              etre de taille au moins nr et doit avoir ete 
00043  *              alloue avant l'appel a la routine
00044  *
00045  * Sortie (valeur de retour) :
00046  * ------
00047  *  double int1d_chebp  :   Valeur de l'integrale (1) 
00048  *
00049  */
00050 
00051 /*
00052  * $Id: int1d_chebp.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $
00053  * $Log: int1d_chebp.C,v $
00054  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00055  * LORENE
00056  *
00057  * Revision 2.0  1999/02/22  15:37:46  hyc
00058  * *** empty log message ***
00059  *
00060  *
00061  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_chebp.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $
00062  *
00063  */
00064 
00065 
00066 //*****************************************************************************
00067 
00068 double int1d_chebp(int nr, const double* cf){
00069     
00070     double som = - cf[0] ;
00071     const double* cc = cf + 1 ;
00072     
00073     for (int i=1; i<nr ; i++) {
00074     som += *cc / (4*i*i - 1) ; 
00075     cc++ ;
00076     }
00077     
00078     return -som ; 
00079     
00080 }

Generated on Tue Feb 7 01:35:17 2012 for LORENE by  doxygen 1.4.6