/*************************************************************************** * Copyright (C) 2009 by Douglas Castro * * douglas@ime.unicamp.br * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "interp_integ.h" double integra(int d, double xmin[], double xmax[], Funcao *f) { int m = 5; //ordem de integracao. // raizes qsi[j] e pesos w[j] da integracao de gauss double qsi[ ] = {-0.906179846, -0.53846931, 0.0, 0.53846931, 0.906179846}; double w[ ] = { 0.236926885, 0.47862867, 0.568888889, 0.47862867, 0.236926885}; // comeca a ingtegracao.. double J = 0.0; double A, B; double h1, h2; int i, j, k; switch(d) { case 1: // dominio de integracao [A,B] A = xmin[0]; B = xmax[0]; // variaveis auxiliares h1 = (B-A)/2.0; h2 = (B+A)/2.0; for(i=0;i