Reading: The chapter on functions and subprograms.
Collaborative Problem: Write a FORTRAN program that:
- has a double precision function called "mysine" that uses your series approximation from before to compute the sine of an angle;
- an integer function called "fact" that computes the factorial and is used in the sine series by the sine function;
- prints out the output from your function and compares it with the built-in sin() function for angles of 0.1, 0.2 ... 1.0 (radians);
- has "implicit none" at the top.
Individual Problem: Modify your collaborative problem to try the following:
- have the mysine function call itself from inside and indicate what happens;
- have mysine call fact (which it should already do) and then have fact call mysine and indicate what happens;
- give the nonmodified mysine and integer argument and fact a double precision argument and indicate what happens;
- have a function have itself as its argument, e.g., mysine(mysine(.1)) and indicate what happens.