REM Programa que evalua la integral de la funci¢n fnf en (a,b) REM mediante la f¢rmula de Simpson y compara REM con el resultado exacto CLS PRINT " INTEGRACION NUMERICA MEDIANTE LA REGLA DE SIMPSON" DEF fnf (x) = EXP(x) a = 0: b = 4 exacto = EXP(b) - EXP(a) REM 10 INPUT "Entrar N (par>=2) "; n REM IF n < 2 THEN STOP FOR m = 2 TO 20 '******************************* N = 2 ^ m h = (b - a) / N suma = fnf(a) factor = 2 FOR i = 1 TO N - 1 IF factor = 2 THEN factor = 4 ELSE factor = 2 x = a + i * h suma = suma + fnf(x) * factor NEXT i suma = suma + fnf(b) integral = h * suma / 3 diferencia = exacto - integral PRINT USING "N=######## Error=##.######"; N; diferencia REM GOTO 10 NEXT m '****************************************