- #1
tactical
- 6
- 0
Hello, for my FORTRAN class it wants me to use the method of Riemann's sums to find the area under the curve for the function f(x) = -(x-3)**2 +9, and stop when successive iterations yield a change of less than 0.0000001. I know I am going to have to used double precision. I am just confused on how to set it up. This is what I am thinking...
Im going to need a loop from 1 to count, then my deltaX will be upperbound-lowerbound/count.
Then Inside that do loop I am going to need another one that does from 1 to 6 by iterations of deltaX. Then I am going to need to compute the Area(where I am stumped). After that I am going to want to say if the area after minus the area before is greater then 0.0000001 then count=count + 1. So far this is what my do loops look like. I am just wondering if i am headed in the correct direction of not? Can anyone help me please??
DO I=1,COUNT,1
deltaX = (upperBOUND-lowerBOUND)/COUNT
DO J = 0,6,deltaX
F_X=-(J-3)**2 + 9
ENDDO
ENDDO
Im going to need a loop from 1 to count, then my deltaX will be upperbound-lowerbound/count.
Then Inside that do loop I am going to need another one that does from 1 to 6 by iterations of deltaX. Then I am going to need to compute the Area(where I am stumped). After that I am going to want to say if the area after minus the area before is greater then 0.0000001 then count=count + 1. So far this is what my do loops look like. I am just wondering if i am headed in the correct direction of not? Can anyone help me please??
DO I=1,COUNT,1
deltaX = (upperBOUND-lowerBOUND)/COUNT
DO J = 0,6,deltaX
F_X=-(J-3)**2 + 9
ENDDO
ENDDO