# Simpsons Rule in FORTRAN

• Comp Sci
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.

Related Engineering and Comp Sci Homework Help News on Phys.org
SteamKing
Staff Emeritus
Homework Helper
Well, do you notice any patterns about which y-values take which Simpsons's multipliers?

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.

SteamKing
Staff Emeritus
Homework Helper
Does this pattern suggest how you might go about accumulating products of the y-values and the corresponding Simpson's multipliers?

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 :(

Redbelly98
Staff Emeritus