! Decay Curve generation for any radioactive isotope
! N(t)=No*exp(-lambda*t)
! lambda = decay constant = ln 2 / T
! T=half-life
! Program saves output to file output1
! This output file can be exported to a plotting routine
! M. Ragheb, Univ. of Illinois
program decay
real x, lambda
! This half life is for the tritium 1T3 nucleus in years
real :: T = 12.33
integer :: steps=50
real ratio(51), xtime(51)
! Calculate decay constant
x = log(2.0)
lambda = x/T
write(*,*) x, lambda
! Open output file for plotting in Excel
open(10,file='output1.xls')
! Calculate ratio N(t)/No
steps = steps + 1
do i = 1, steps
xtime(i) = i - 1
ratio(i) = exp (- lambda*xtime(i))
! Write results on output file
write(10,*) xtime(i), ratio(i)
! Display results on screen
write(*,*) xtime(i), ratio(i)
! pause
end do
end