Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
Intro Physics Homework Help
Advanced Physics Homework Help
Precalculus Homework Help
Calculus Homework Help
Bio/Chem Homework Help
Engineering Homework Help
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
Intro Physics Homework Help
Advanced Physics Homework Help
Precalculus Homework Help
Calculus Homework Help
Bio/Chem Homework Help
Engineering Homework Help
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Homework Help
Engineering and Comp Sci Homework Help
Fortran90: DO loop for sequence of numbers
Reply to thread
Message
[QUOTE="SalfordPhysics, post: 4939391, member: 507082"] [h2]Homework Statement [/h2] 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 [h2]Homework Equations[/h2] [h2]The Attempt at a Solution[/h2] 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; [B]CALL [/B]evalArea((-1)*sigma,sigma,area,n) !n = 100 [B]PRINT*, [/B]'n=',n, 'area=',area [B]DO[/B] k = 1,4 !n = 98, 96, 94, 92 [B]CALL [/B]evalArea((-1)*sigma,sigma,area,n) n = n-2 [B] PRINT*, [/B]'n=',n, 'area=',area [B]END DO DO [/B]k = 1,2 !n = 88,84 n = n-4 [B]CALL [/B]evalArea((-1)*sigma,sigma,area,n) [B]PRINT*, [/B]'n=',n, 'area=',area [B]END DO DO[/B] k = 1,2 !n = 76,68 n = n-8 [B] CALL [/B]evalArea((-1)*sigma,sigma,area,n) [B]PRINT*, [/B]'n=',n, 'area=',area [B]END DO [B]DO[/B] [/B]k = 1,2 ! n = 52, 36 n = n-16 [B][B] CALL [/B][/B]evalArea((-1)*sigma,sigma,area,n) [B]PRINT*, [/B]'n=',n, 'area=',area [B][B]END DO[/B][/B] n = n-32 ! n = 4 [B]CALL[/B] evalArea((-1)*sigma,sigma,area,n) [B]PRINT*, [/B]'n=',n, 'area=',areaAll help appreciated. [/QUOTE]
Insert quotes…
Post reply
Forums
Homework Help
Engineering and Comp Sci Homework Help
Fortran90: DO loop for sequence of numbers
Back
Top