Project 1: Problem Bonus Problem Solution Bonus Solution

 
 
CSE 1503 Introduction to Computer Programming with FORTRAN

Section 1 & 2 Due Date: February 11, 1999

 

wpe4.jpg (2792 bytes)
PROBLEM

Let a and b be positive real numbers. Define the sequence of positive numbers as follows:

X0 = a
Xj = e/2*(Xj-1 + Sqrt(Xj-1 /log(a)) + cos2 ( b/2)) where j=1,3,5 ..
Xi = e/2*(Xi-1 + Sqrt(Xi-1 /log(a)) + sin2 ( b/2))  where j=2,4,6 ..
Where: 
e = 2.71828 18284 59045 23536 02874 71352 66249 77572 (Note that e is a constant value)

Write a FORTRAN program that reads in the values of a and b interactively and uses the above sequence to compute and print the values of X0, X1 and X2

NOTES

  • When you ask users for input, let them know what correct values they are supposed to enter. 
  • Include the required header comments and indenting. A suggested style for the header comments is:
PROGRAM (name)
!-------------------------------------------------------------------------------------
! Name: (your name)
! Student ID # : (your id)
!
! (description of the program) 
! Input Variables: (variables list)
! Output Variables: (variables list)
!-------------------------------------------------------------------------------------

IMPLICIT NONE
(program statements)
END PROGRAM (name)

  • Hand in a printout of your source code in class
 
wpe6.jpg (2797 bytes)
Allow the user to enter the value of N. Calculate and print the values of X0, X1, X2, ...... ,XN