(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

The power series

1 + x + (X^2)/2! + (x^3)/3! +....(to infinity)= (x^k)/k!

converges to e^x for all values of x. Write a function subprogram that uses this series to calculate values for e^x to five-decimal-place accuracy (i.e. using terms up to the first one that is less than 10^-5 in absolute value) and that uses a function subprogram to calculate factorials. Use these subprograms in a main program to calculate and print a table of values for the function

cosh(x) = (e^x + e^-x)/2

and also the corresponding values of the library function COSH for x = -1 to 1 in increments of .1

3. The attempt at a solution

c Print the table heading

100 FORMAT(3X, A7, 5X, A16, 2X)

PRINT 100, 'COSH(X)', 'LIBRARY COSH(X)'

PRINT *, '==============================='

c ===========================================================

REAL FUNCTION COSH (G)

REAL G

DO 80 G = -1., 1., .1

COSH = COSH (G)

80 CONTINUE

END

c =============================================================

REAL FUNCTION HCOSN (POWER)

REAL POWER

HCOSN = (POWER + (1/POWER))/2

END

c ==============================================================

REAL FUNCTION POWER (X,I)

INTEGER FACTOR, I

REAL X

DO 20 X= -1., 1., .1

POWER = (X**I)/FACTOR

20 CONTINUE

END

c ===============================================

INTEGER FUNCTION FACTOR(N)

INTEGER N, I

FACTOR = 1

DO 10 I = 2, N

FACTOR = FACTOR * I

10 CONTINUE

END

c ==============================================================

130 FORMAT (3X, F5.5, 7X, F5.5)

PRINT 130, HCOSN, COSH

PAUSE

END

I keep getting a ton of errors. Am I setting up the structure of the DO X=-1, 1, .1 with the functions right?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Power series with subprograms Fortran 77 HELP

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**