Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fall 2017 Fortran Project The Fortran project for this term will consist of the

ID: 3871666 • Letter: F

Question

Fall 2017 Fortran Project The Fortran project for this term will consist of the following two separate parts. 1. Create a Table of Trigonometric Values Write a program called trigtable.f95 that creates (prints to the console) a nice table of the values of sine, cosine, tangent, secant, cosecant, and cotangent at all even degree multiples of 10 and 15 between 0 and 360, (The mod function may be useful here.) You may do this using arrays or without, depending on your preference. The table should have a header row and a separator row. The angle should be shown as an integer in a width 4 field and each trigonometric value in the table should have width 8 with 4 digits to the right of the decimal place. Some functions will give infinite results for certain angles, so check and print INF for those results. Below is the output for the first 90e t sin(t) cos(t) tan { t) sec (t} c (t cot(t) INE INF LO 0.1736 0.9848 0.1763 1.0154 5.7588 5.6713 15 0.2588 0.9659 0.2679 1.0353 3.8637 3.7321 20 0.3420 0.9397 0.3640 1.0642 2.9238 2.7475 0.5000 0.8660 0.5774 1.1547 2.0000 1.7321 40 0.6428 0.7660 0.8391 1.3054 1.5557 1.1918 45 0.7071 .7071 1.0000 1.4142 1.4142 1.0000 50 0.76600.6428 1.1918 1.5557 1.3054 0.8391 0.8660 0.5000 1.7321 2.0000 1.1547 0.5774 70 0.9397 0.3420 2.7475 2.9238 1.0642 0.3640 75 0.9659 0.2588 3.7321 3.8637 1.0353 0.2679 80 0.9848 0.1736 5.6713 5.7588 1.0154 0.1763 INF 1.0000 0.0000 0 0,0000 1.0000 .0000 1.0000 30 60 90 1.0000 0.0000 INE 2. Determine Trajectory Information by Simple Numerical Integration Background A ball thrown or shot from the ground at an initial speed and at a given angle above horizontal will travel a certain distance, while it's vertical position first increases and then decreases until it hits the ground. For higher velocities, the drag (wind resistance) on the ball can be a significant factor Simple trigonometry shows that, for an overall initial speed So and angle , the initial x and y components of velocity will be x(0) Scos , and y(0) So sin 0. Further, basic fluid mechanics says that the drag force on a sphere is given by F: ½ c, A v2 where Cd is the coefficient of drag (about 0.47 for a sphere is the density of the fluid (1.225 kg/ma for air at sea level) A is the frontal area of the sphere (nr) v is the velocity Completing a free-body diagram of the ball and doing a little algebra, we can determine the acceleration in the x and y directions to be

Explanation / Answer

1. The code is as follows:

program trig
implicit none
REAL, PARAMETER :: PI = 3.1415926
REAL, PARAMETER :: Degree180 = 180.0
REAL, PARAMETER :: D_to_R = PI/Degree180
  
REAL :: Begin = 10.0 ! initial value
REAL :: Final = 360.0 ! final value
REAL :: Step = 5.0 ! step size
REAL :: x
  
integer :: i,j

print*,"t sin(t) cos(t) tant(t) sec(t) csc(t) cot(t)"
print*,"- ------ ------ ------- ------ ------ ------"
  
WRITE(*,44) '0.0000 sin(0.0000) cos(0.0000) tan(0.0000) sec(0.0000) csc(0.0000) cot(0.0000)'

x = Begin   
DO
IF (x > Final) EXIT   
WRITE(*,44) 'x SIN(x) COS(x) TAN(x) 1/cos(x) 1/sin(x) 1/tan(x)'
x = x + Step   
END DO

  
44 FORMAT(F4.4)
  
end program trig