Implementing Simpson's Rule in Fortran for Accurate Numerical Integration

  • Comp Sci
  • Thread starter Daniel1992
  • Start date
  • Tags
    Fortran
In summary, The conversation discusses the process of programming Simpson's Rule in Fortran, with a focus on generating the y-values and using the pattern of multipliers (4 for odd values and 2 for even values) to accumulate products in a do-loop. The individual seeking advice expresses difficulty in implementing this process and asks for assistance.
  • #1
Daniel1992
22
0
I am trying to program Simpson's Rule in Fortran

I=(1/3)*h*(y0 + 4*y1 + 2*y2 + 4*y3 + 2*y4 + ... 2*yn-2 + 4*yn-1 + yn)

n=100 (number of strips)

I have generated the y values but I don't know how to get Fortran to follow the pattern in the brackets after h to add up the y values.

Any help would be appreciated.
 
Physics news on Phys.org
  • #2
Well, do you notice any patterns about which y-values take which Simpsons's multipliers?
 
  • #3
SteamKing said:
Well, do you notice any patterns about which y-values take which Simpsons's multipliers?

A part from the first and last y values the odd ones are multiplied by 4 and the even are multiplied by 2.
 
  • #4
Does this pattern suggest how you might go about accumulating products of the y-values and the corresponding Simpson's multipliers?
 
  • #5
SteamKing said:
Does this pattern suggest how you might go about accumulating products of the y-values and the corresponding Simpson's multipliers?

I can't work it out :(
 
  • #6
When you write a do-loop, you can make the loop variable increase by 2 each time through the loop.
 

What is Simpsons Rule in FORTRAN?

Simpsons Rule is a numerical integration method used in FORTRAN to approximate the area under a curve. It is based on approximating the curve with a series of quadratic polynomials and calculating the area under each section.

How is Simpsons Rule implemented in FORTRAN?

In FORTRAN, Simpsons Rule can be implemented using a loop to calculate the area under each section of the curve. The equation used in the loop involves the function values at three points, and the width of each section.

What are the advantages of using Simpsons Rule in FORTRAN?

Simpsons Rule is considered to be more accurate than other numerical integration methods, such as the trapezoidal rule. It also requires fewer function evaluations, making it more efficient for calculating the area under complex curves.

What are the limitations of Simpsons Rule in FORTRAN?

Simpsons Rule can only be applied to functions that are continuous and have a smooth curve. It may also produce inaccurate results for some complex curves, and the accuracy can decrease if the number of sections is too small.

Can Simpsons Rule be used for multidimensional integration in FORTRAN?

Yes, Simpsons Rule can be extended to multidimensional integration in FORTRAN by using nested loops and calculating the area under each section of the multidimensional curve.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
14
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
876
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Calculus
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
9K
Back
Top