00001 /* 00002 * Copyright (c) 2005 Jerome Novak 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_chebi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_chebi.C,v 1.3 2005/11/02 15:08:18 j_novak 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+1}(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_chebi : Valeur de l'integrale (1) 00048 * 00049 */ 00050 00051 /* 00052 * $Id: int1d_chebi.C,v 1.3 2005/11/02 15:08:18 j_novak Exp $ 00053 * $Log: int1d_chebi.C,v $ 00054 * Revision 1.3 2005/11/02 15:08:18 j_novak 00055 * Minor change to prevent warning message. 00056 * 00057 * Revision 1.2 2005/05/13 13:22:33 j_novak 00058 * *** empty log message *** 00059 * 00060 * Revision 1.1 2005/05/13 08:51:02 j_novak 00061 * Added the function int1d_chebi. 00062 * 00063 * 00064 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_chebi.C,v 1.3 2005/11/02 15:08:18 j_novak Exp $ 00065 * 00066 */ 00067 00068 00069 //***************************************************************************** 00070 00071 double int1d_chebi(int nr, const double* cf){ 00072 00073 double som = 0. ; 00074 const double* cc = cf ; 00075 00076 for (int i=0; i<nr-2 ; i+=2) { 00077 som += (cc[0] - cc[1] ) / double(2*i + 2) ; 00078 cc += 2 ; 00079 } 00080 00081 if (nr%2 == 0) som += (*cc) / double(2*nr - 2) ; 00082 00083 return som ; 00084 00085 }
1.4.6