Program FactorHW c This program uses the power series for e^x to compute variables c of a pre-defined set to find cosh(x) and compares them to those of c power series. c ****Nathan Hayes 4/16/08**** real ans, ans2, x print *, ' X Power Series CosH(X)' print *, '====================================' do 30 x = -1.0, 1.1 , 0.1 ans = (fexp(x) + (1./fexp(x)))/2. ans2 = cosh(x) print 20, x, ans, ans2 20 format(1x, f5.1, 2f15.5) 30 continue end c ****Function to caluculate the series**** real function fexp(e) integer k external Factor real e, subexp k = 0 fexp = 0 subexp = 1 do while (abs(subexp) .gt. 1e5) fexp = fexp+subexp k = k + 1 subexp = e**k/factor(k) enddo return end c ****Function to caluclate the factorial*** function Factor(f) integer i, f Factor = 1 do 10 i=1,f factor=factor*i 10 continue return end