Find the poission
distribution with function subprogram for the values of x which is given below
X
0
1
2
3
4
5
6
7
8
9
10
Solution:
Function fact(N)
INTEGER FACT
FACT=1
IF(N.EQ.0) RETURN
DO I=1,N
FACT=FACT*I
ENDDO
RETURN
END
INTEGER FACT
REAL K1,K2,K3
SUM=0.
WRITE(*,*) 'ENTER THE VALUE OF X'
READ(*,*) N
WRITE(*,*)'ENTER THE VALUE OF LAMDA'
READ(*,*) U
DO J=0,N
K1=EXP(-U)
K2=U**J
K3=FACT(J)
PO=SUM+(K1*K2/K3)
ENDDO
WRITE(*,*) PO
STOP
END
Hints:
Here we put N = 11 because we see in the
total number of observation of x is 11.
No comments:
Post a Comment