- #1
- 69
- 1
Homework Statement
A program finds the area under the Gaussian Distribution Curve between ±σ using Simpsons Rule.
Modify the program to investigate the effect of the number of strips.
Do this by using a DO loop in the main program for the
following sequence of number of strips (n); n-2, n-4, n-6, n-8, n-12,n-16,n-24,n-32,n-48,n-64,n-96
Homework Equations
The Attempt at a Solution
My program DOES work fine, but it has a long line of DO loops for bits of the sequence. I want to know if there is a way to massively shorten this part down.
(n) starts at 100 and there is first a print of that before implementing the sequence and printing on each iteration;
CALL evalArea((-1)*sigma,sigma,area,n) !n = 100
PRINT*, 'n=',n, 'area=',area
DO k = 1,4 !n = 98, 96, 94, 92
CALL evalArea((-1)*sigma,sigma,area,n)
n = n-2
PRINT*, 'n=',n, 'area=',area
END DO
DO k = 1,2 !n = 88,84
n = n-4
CALL evalArea((-1)*sigma,sigma,area,n)
PRINT*, 'n=',n, 'area=',area
END DO
DO k = 1,2 !n = 76,68
n = n-8
CALL evalArea((-1)*sigma,sigma,area,n)
PRINT*, 'n=',n, 'area=',area
END DO
DO k = 1,2 ! n = 52, 36
n = n-16
CALL evalArea((-1)*sigma,sigma,area,n)
PRINT*, 'n=',n, 'area=',area
END DO
n = n-32 ! n = 4
CALL evalArea((-1)*sigma,sigma,area,n)
PRINT*, 'n=',n, 'area=',area
All help appreciated.