PROGRAM Gaussian ! ------------------------------------------------------------------------------ ! ! Copyright 2007 Matthew Norton ! ! ------------------------------------------------------------------------------ ! 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ! ! NOTE: This is in FORTRAN 90 and you will need a FORTRAN 90 complier to run ! this code ! ------------------------------------------------------------------------------ ! ! This program uses gaussian integration to approximate the area of a ! gaussian shaped bag traveling over a bridge ! ! ------------------------------------------------------------------------------ IMPLICIT NONE REAL*8 :: Roe1, Roe2, Roe3, Roe4, Mass, PI, X, U, T, Node1, Node2, Weight1, Weight2 INTEGER :: I REAL*8, PARAMETER :: V = 1 PI = ACOS(-1.) PRINT *, Pi OPEN(UNIT = 10, FILE = "Gauss.txt") Node1 = .339981043584856 Node2 = .861136311594053 Weight1 = 0.652145154862546 Weight2 = 0.347854845137454 X = -5. DO I = 0, 1000 T = REAL(I)* .01 U = -Node1 + 5 - T Roe1 = (10. / SQRT(PI)) * 1. / (EXP((U * U) )) U = -Node2 + 5 - T Roe2 = (10. / SQRT(PI)) * 1. / (EXP((U * U) )) U = Node1 + 5 - T Roe3 = (10. / SQRT(PI)) * 1. / (EXP((U * U) )) U = Node2 + 5 - T Roe4 = (10. / SQRT(PI)) * 1. / (EXP((U * U) )) Mass = Weight1 * Roe1 + Weight2 * Roe2 + Weight1 * Roe3 + Weight2 * Roe4 !WRITE(10, '(1X, f10.7, 1X, F12.9)') T, Mass !WRITE(6, '(1X, f10.7, 1X, F12.9)') T, Mass WRITE(10, *) T, Mass WRITE(6, *) T, Mass END DO END PROGRAM