Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numerical integration (rectangle method)

Status
Not open for further replies.

scarlleette

Technical User
May 12, 2013
1
SK
Hi. I need a help, i am beginner. My problem: Numerical integration of function F(x)= x**2.00, x=<5,8> , number of subintervals: 3000.
my program:
program num_int
!a,b=limits of integration
implicit none
real(kind=8),allocatable :: D:),:), E:),:) , X:))
real :: F,a,b,h
integer :: i,N

read*,N
allocate (D(N,1), E(N,1), X(N))

read*,(D(i,1),i=1,N)
read*,(E(i,1),i=1,N)

print*,"Limits of integration"
read*,a,b
print*,"Number of subintervals"
read*,N

call quad(a,b,h,N)
--------------------------------
subroutine quad(a,b,h,N)
implicit none
real :: h
integer :: N,a,b
h=(b-a)/N

end
-------------------------------


D(i,1)=a
X(i)=0.0d0

do i=0,N-1
X(i)=X(i)+(D(i,1)*E(i,1))**2.00
i am angry and lost. Thank you for everything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top