100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Exam (elaborations) TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman

Rating
-
Sold
-
Pages
382
Grade
A+
Uploaded on
12-11-2021
Written in
2021/2022

Exam (elaborations) TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman Instructor’s Manual to accompany Chapman Fortran 95/2003 for Scientists and Engineers Third Edition Stephen J. Chapman BAE SYSTEMS Australia iii TABLE OF CONTENTS CHAPTER 1. INTRODUCTION TO COMPUTERS AND THE FORTRAN LANGUAGE 9 CHAPTER 2. BASIC ELEMENTS OF FORTRAN 10 CHAPTER 3. PROGRAM DESIGN AND BRANCHING STRUCTURES 24 CHAPTER 4. LOOPS AND CHARACTER MANIPULATION 33 CHAPTER 5. BASIC I/O CONCEPTS 71 CHAPTER 6. INTRODUCTION TO ARRAYS 113 CHAPTER 7. INTRODUCTION TO PROCEDURES 127 CHAPTER 8. ADDITIONAL FEATURES OF ARRAYS 175 CHAPTER 9. ADDITIONAL FEATURES OF PROCEDURES 193 CHAPTER 10. MORE ABOUT CHARACTER VARIABLES 229 CHAPTER 11. ADDITIONAL INTRINSIC DATA TYPES 252 CHAPTER 12. ADDITIONAL DATA TYPES 267 CHAPTER 13. ADVANCED FEATURES OF PROCEDURES AND MODULES 298 CHAPTER 14. ADVANCED I/O CONCEPTS 315 CHAPTER 15. POINTERS AND DYNAMIC DATA STRUCTURES 330 CHAPTER 16. OBJECT ORIENTED PROGRAMMING IN FORTRAN 356 APPENDIX A. LIBRARY PROCEDURE DESCRIPTIONS 357 9 Chapter 1. Introduction to Computers and the Fortran Language 1-1 (a) 10102 (b) (c) (d) 1-2 (a) 7210 (b) 13710 (b) 25510 (d) 510 1-3 (a) and AEF116 (b) 5128 and 14A16 (c) 1578 and 6F16 (d) 37558 and 7ED16 1-4 (a) and 25510 (b) 2 and 42410 (c) and 7310 (d) 2 and 51110 1-5 A 23-bit mantissa can represent approximately ±222 numbers, or about six significant decimal digits. A 9-bit exponent can represent multipliers between 2-255 and 2255, so the range is from about 10-76 to 1076. 1-6 46-bit integer: From -245 to -245-1, or -35,184,372,088,832 to 35,184,372,088,831. 64-bit integer: From -263 to -263-1, or -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. 1-7 (a) (b) (c) 002 (d) 1-8 The sum of the two’s complement numbers is: = = -77210 = The two answers agree with each other. 1-9 = 12710, and = -12810. These results agree with Equations (1-1) and (1-2). 1-10 A 53-bit mantissa can represent approximately ±252 numbers, or about fifteen significant decimal digits. An 11-bit exponent can represent multipliers between 2-1023 and 21023, so the range of double precision numbers is from about 10-307 to 10307. 10 Chapter 2. Basic Elements of Fortran 2-1 (a) Valid real constant (b) Valid character constant (c) Invalid constant—numbers may not include commas (d) Invalid constant—real numbers must include a decimal point1 (e) Invalid constant—need two apostrophes to represent an apostrophe within a string (f) Invalid character constant—mismatched apostrophe and quotation mark (g) Valid character constant 2-2 (a) Different values—one is real and the other is integer (b) Different values (c) The same value (d) The same value. 2-3 (a) Valid (b) Invalid—name must begin with a letter (c) Invalid—question mark is not a legal character (d) Valid. 2-4 (a) Legal: result = 0. (b) Legal: result = 30 (c) Illegal—cannot have two adjacent operators (d) Legal: result = 0.002 (e) Illegal—division by zero 2-5 (a) Legal: This expression is evaluated entirely with integer arithmetic: 58/4 = 14, and 4/58 = 0, so the result = 0. (b) Legal: The first part of this expression is evaluated with integer arithmetic and the second part of the expression is evaluated with real arithmetic. The final expression is evaluated with real arithmetic: 58/4 = 14, and 4/58. = 0., so the result = 0.. (c) This expression is evaluated entirely with real arithmetic: 58./4 = 14.5, and 4/58. = 0., so the result = 1.. (d) Illegal: parentheses are unbalanced. 2-6 (a) 12 (b) 12 (c) 0 (d) 15.6 (e) 12.0 (f) 12 (g) 18 (h) 18 (i) 12 2-7 (a) 19683 (b) 729 (c) 19683 2-8 i1 = 2, i2 = -4, i3 = -5, i4 = -5, a1 = 2.4, a2 = 5.76 2-9 The program will run, but it will produce wrong answers, because the sine and cosine functions expect their arguments to have units of radians, not degrees. 2-10 The output of the program is: -3. 100. 200. 2-11 The weekly pay program is shown below: PROGRAM get_pay ! ! Purpose: ! To calculate an hourly employee's weekly pay. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/01/2007 S. J. Chapman Original code ! 1 Many compilers will accept this form, even though it does not meet the strict definition of a real constant. 11 IMPLICIT NONE ! List of variables: REAL :: hours ! Number of hours worked in a week. REAL :: pay ! Total weekly pay. REAL :: pay_rate ! Pay rate in dollars per hour. ! Get pay rate WRITE (*,*) 'Enter employees pay rate in dollars per hour: ' READ (*,*) pay_rate ! Get hours worked WRITE (*,*) 'Enter number of hours worked: ' READ (*,*) hours ! Calculate pay and tell user. pay = pay_rate * hours WRITE (*,*) "Employee's pay is $", pay END PROGRAM get_pay The result of executing this program is C:bookf95_2003soln>get_pay Enter employees pay rate in dollars per hour: 7.90 Enter number of hours worked: 42 Employee's pay is $ 331. 2-12 Assume that energy, mass, grav, height, and velocity are all real quantities. Then the total energy of an object in the Earth’s gravitational field is given by the equation energy = mass * grav * height + 0.5 * mass * velocity**2 2-13 Assume that grav, height, and velocity are all real quantities. Then the velocity of a ball when it hits the Earth is given by the equation velocity = SQRT( 2.0 * grav * height ) 2-14 A program to calculate the impact velocity of a ball dropped from a specified height is shown below. PROGRAM calc_vel ! ! Purpose: ! To calculate the velocity of a ball when it hits the ! Earth. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/01/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants 12 REAL,PARAMETER :: G = 9.81 ! Acc due to gravity (m/s**2) ! List of variables: REAL :: height ! Initial height of ball (m) REAL :: vel ! Velocity at impact (m/s) ! Get the height in meters WRITE (*,*) 'Enter height in meters:' READ (*,*) height ! Get velocity vel = SQRT(2 * G * height) ! Write out answer WRITE (*,*) 'The velocity at impact is ', vel, ' m/s.' END PROGRAM calc_vel When this program is executed, the results are: C:bookf95_2003solnex2_14>calc_vel Enter height in meters: 1 The velocity at impact is 4. m/s. C:bookf95_2003solnex2_14>calc_vel Enter height in meters: 10 The velocity at impact is 14.00714 m/s. C:bookf95_2003solnex2_14>calc_vel Enter height in meters: 100 The velocity at impact is 44.29447 m/s. 2-15 To calculate the energy in joules, we must multiply the total time in seconds times the power supplied in watts. Therefore, the program must convert one year into seconds, and multiply it by 500,000,000 W. Then, the mass consumed is 2 E m c = The resulting program is shown below. PROGRAM calc_mass ! ! Purpose: ! To calculate the mass converted to energy by a nuclear ! generating station. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/01/2007 S. J. Chapman Original code ! IMPLICIT NONE 13 ! List of constants REAL,PARAMETER :: C = 2.9979E8 ! Speed of light (m/s) ! List of variables: REAL :: energy ! Energy consumed over the period, in joules. REAL :: mass ! Mass consumed, in kilograms REAL :: power ! Power supplied in watts REAL :: time ! Time that power is supplied, in seconds. ! Get power produced, in watts power = 400.0E6 ! Get time in seconds. This is a year converted to seconds: ! time = (365 days) * (24 hr/day) * (60 min/hr) * ( 60 s/min) time = 365.0 * 24.0 * 60.0 * 60.0 ! Get energy consumed in joules energy = power * time ! Calculate mass mass = energy / C**2 ! Write out answer WRITE (*,*) 'The mass consumed is ', mass, ' kg.' END PROGRAM calc_mass When this program is executed, the results are: C:bookf95_2003soln>calc_mass The mass consumed is 0. kg. 2-16 A modified version of the previous problem that allows the user to specify the output power level in MW and the duration in months is shown below. Note that we have converted months to seconds assuming that there are 30 days in a month. PROGRAM calc_mass ! ! Purpose: ! To calculate the mass converted to energy by a nuclear ! generating station. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/01/2007 S. J. Chapman Original code ! 1. 05/01/2007 S. J. Chapman Modified for user inputs ! IMPLICIT NONE ! List of constants REAL,PARAMETER :: C = 2.9979E8 ! Speed of light (m/s) ! List of variables: REAL :: energy ! Energy consumed over the period, in joules. 14 REAL :: mass ! Mass consumed, in kilograms REAL :: power ! Power supplied in watts REAL :: time ! Time that power is supplied, in seconds. REAL :: time_months ! Time that power is supplied, in months. ! Get power produced, in watts WRITE (*,*) 'Enter the output power of the station, in MW:' READ (*,*) power power = power * 1.0E6 ! Convert to watts ! Get the number of months of operation WRITE (*,*) 'Enter the operating time, in months:' READ (*,*) time_months ! Get time in seconds. This is a month converted to seconds, ! assuming 30 days in a month: ! time = months * (30 days) * (24 hr/day) * (60 min/hr) * (60 s/min) time = time_months * 30.0 * 24.0 * 60.0 * 60.0 ! Get energy consumed in joules energy = power * time ! Calculate mass mass = energy / C**2 ! Write out answer WRITE (*,*) 'The mass consumed is ', mass, ' kg.' END PROGRAM calc_mass 2-17 A program to calculate the period of a pendulum is shown below: PROGRAM pendulum ! ! Purpose: ! To calculate the period of a pendulum in seconds, given ! its length in meters. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants: REAL, PARAMETER :: GRAV = 9.81 ! 9.81 m/sec**2 REAL, PARAMETER :: PI = 3. ! Pi ! List of variables: REAL :: length ! Length of pendulum, in meters REAL :: period ! Period, in seconds ! Get length of pendulum WRITE (*,*) 'Enter the length of the pendulum in meters: ' READ (*,*) length 15 ! Calculate period of the pendulum. period = 2.0 * PI * SQRT ( length / GRAVv ) ! Write out results. WRITE (*,*) 'The period of the pendulum in seconds is: ', period END PROGRAM pendulum 2-18 A program to calculate the hypotenuse of a triangle from the two sides is shown below: PROGRAM calc_hypotenuse ! ! Purpose: ! To calculate the hypotenuse of a right triangle, given ! the lengths of its two sides. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of variables: REAL :: hypotenuse ! Hypotenuse of triangle REAL :: side_1 ! Side 1 of triangle REAL :: side_2 ! Side 2 of triangle ! Get lengths of sides. WRITE (*,*) 'Program to calculate the hypotenuse of a right ' WRITE (*,*) 'triangle, given the lengths of its sides. ' WRITE (*,*) 'Enter the length side 1 of the right triangle: ' READ (*,*) side_1 WRITE (*,*) 'Enter the length side 2 of the right triangle: ' READ (*,*) side_2 ! Calculate length of the hypotenuse. hypotenuse = SQRT ( side_1**2 + side_2**2 ) ! Write out results. WRITE (*,*) 'The length of the hypotenuse is: ', hypotenuse END PROGRAM calc_hypotenuse 2-19 A program to calculate the logarithm of a number to the base b is shown below: PROGRAM calc_log ! ! Purpose: ! To calculate the logarithm of a number to an ! arbitrary base b. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== 16 ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of variables: REAL :: base ! Base of logarithm REAL :: log_res ! Resulting logarithm REAL :: x ! Input value ! Get the number to convert WRITE (*,*) 'Enter the number to take LOG of: ' READ (*,*) x WRITE (*,*) 'Enter the base of the logarithm: ' READ (*,*) base ! Calculate logarithm. log_res = LOG10(x) / LOG10(base) ! Write out results. WRITE (*,*) 'The logarithm is: ', log_res END PROGRAM calc_log To test this program, we will calculate the logarithm of 100 to the base e. Note that the value of e can be found from the function EXP(1.0) — it is 2.. C:bookf95_2003soln>calc_log Enter the number to take LOG of: 100 Enter the base of the logarithm: 2. The logarithm is: 4. Using a calculator or by calling function LOG(100), we can show that this value is correct. 2-20 This solution to this problem is computer and compiler dependent. You instructor will have to provide you with the correct result for your particular combination of computer and compiler. 2-21 A program to calculate the distance between two points on a Cartesian plane is shown below: PROGRAM calc_distance ! ! Purpose: ! To calculate the distance between two points (X1,Y1) ! and (X2,Y2) on a Cartesian coordinate plane. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of variables: REAL :: distance ! Distance between points. 17 REAL :: x1 ! x position of point 1 REAL :: x2 ! x position of point 2 REAL :: y1 ! y position of point 1 REAL :: y2 ! y position of point 2 ! Get positions of points 1 and 2. WRITE (*,*) 'Program to calculate the distance between two points' WRITE (*,*) '(x1,y1) and (x2,y2) on a Cartesian coordinate plane.' WRITE (*,*) 'Enter the position (x1,y1) of point 1:' READ (*,*) x1, y1 WRITE (*,*) 'Enter the position (x2,y2) of point 2:' READ (*,*) x2, y2 ! Calculate distance between the points. distance = SQRT ( (x1-x2)**2 + (y1-y2)**2 ) ! Write out results. WRITE (*,*) 'The distance between the points is: ', distance END PROGRAM calc_distance When this program is executed, the results are: C:bookf95_2003soln>calc_distance Program to calculate the distance between two points (x1,y1) and (x2,y2) on a Cartesian coordinate plane. Enter the position (x1,y1) of point 1: -1 1 Enter the position (x2,y2) of point 2: 6 2 The distance between the points is: 7. 2-22 One possible program is shown below: PROGRAM calc_db ! ! Purpose: ! To calculate the power of a signal in dB referenced ! to 1 milliwatt. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants: REAL, PARAMETER :: P_REF = 0.001 ! Input power in mW ! List of variables: REAL :: dbmw ! Power in dBmW REAL :: power ! Input power in watts ! Get input power in watts. WRITE (*,*) 'Program to power in dB referenced to 1 mW, given' 18 WRITE (*,*) 'an input power in watts. Enter input power: ' READ (*,*) power ! Calculate distance between the points. dbmw = 10.0 * LOG10 ( power / P_REF ) ! Write out results. WRITE (*,*) 'The power in dB(mW) is: ', dbmw END PROGRAM calc_db 2-23 A program to calculate the hyperbolic cosine is shown below: PROGRAM coshx ! ! Purpose: ! To calculate the hyperbolic cosine of a number. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of variables: REAL :: result ! COSH(x) REAL :: x ! Input value WRITE (*,*) 'Enter number to calculate cosh() of: ' READ (*,*) x result = ( EXP(x) + EXP(-x) ) / 2. WRITE (*,*) 'COSH(X) =', result END PROGRAM coshx When this program is run, the result is: C:bookf95_2003soln>coshx Enter number to calculate cosh() of: 3.0 COSH(X) = 10. The Fortran 95/2005 intrinsic function COSH() produces the same answer. 2-24 A program to calculate the resonant frequency of the radio is shown below: PROGRAM calc_future_value ! ! Purpose: ! To calculate the future value of a sum of money held in ! an account for a specified period of years at a specified ! interest rate. ! 19 ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of variables: REAL :: apr ! Annual percentage rate (%) REAL :: future ! Future value ($) INTEGER :: m ! Number of times compounded per year INTEGER :: n ! Number of years REAL :: principal ! Principal value ($) ! Get input data WRITE (*,*) 'This program calculates the future value of an ' WRITE (*,*) 'account help for a specified number of years at ' WRITE (*,*) 'a specified interest rate. ' WRITE (*,*) 'Enter the initial value of the account: ' READ (*,*) principal WRITE (*,*) 'Enter the annual percentage rate (%): ' READ (*,*) apr WRITE (*,*) 'Enter the number of times per year that the interest ' WRITE (*,*) 'is compounded: ' READ (*,*) m WRITE (*,*) 'Enter the number of years that the account is held: ' READ (*,*) n ! Calculate the future value future = principal * (1 + (apr/(100*m))) ** (m*n) ! Tell the user WRITE (*,*) 'The future value is $', future END PROGRAM calc_future_value When this program is run, the result is: C:bookf95_2003solnex2_24>calc_future_value This program calculates the future value of an account help for a specified number of years at a specified interest rate. Enter the initial value of the account: 1000.00 Enter the annual percentage rate (%): 5 Enter the number of times per year that the interest is compounded: 1 Enter the number of years that the account is held: 1 The future value is $ 1050.000 20 C:bookf95_2003solnex2_24>calc_future_value This program calculates the future value of an account help for a specified number of years at a specified interest rate. Enter the initial value of the account: 1000.00 Enter the annual percentage rate (%): 5 Enter the number of times per year that the interest is compounded: 2 Enter the number of years that the account is held: 1 The future value is $ 1050.625 C:bookf95_2003solnex2_24>calc_future_value This program calculates the future value of an account help for a specified number of years at a specified interest rate. Enter the initial value of the account: 1000.00 Enter the annual percentage rate (%): 5 Enter the number of times per year that the interest is compounded: 12 Enter the number of years that the account is held: 1 The future value is $ 1051.1630 The rate of compounding is not very important over a period of one year, but it makes a significant difference over a period of 10 years. Try the program and see. 2-25 A program to calculate the resonant frequency of the radio is shown below: PROGRAM resonant_freq ! ! Purpose: ! To calculate the resonant frequency of a radio receiver. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants: REAL, PARAMETER :: PI = 3. ! Pi ! List of variables: REAL :: capacitance ! Capacitance (farads) REAL :: freq ! frequency (Hz) REAL :: inductance ! Inductance (henrys) 21 ! Get input data WRITE (*,*) 'Enter capacitance of circuit in farads: ' READ (*,*) capacitance WRITE (*,*) 'Enter inductance of circuit in henrys: ' READ (*,*) inductance ! Calculate resonant frequency freq = 1. / ( 2. * PI * SQRT (inductance * capacitance) ) ! Write result WRITE (*,*) 'The resonant frequency is ', freq, ' Hz.' END PROGRAM resonant_freq When this program is run, the result is: C:bookf95_2003soln>resonant_freq Enter capacitance of circuit in farads: 0.25E-9 Enter inductance of circuit in henrys: 0.1E-3 The resonant frequency is . Hz. 2-26 A program to calculate the turning radius of an aircraft, given a velocity specified in mach numbers and a lateral acceleration specified in g’s, is shown below: PROGRAM turning_radius ! ! Purpose: ! To calculate the turning radius of an aircraft with a ! given speed and lateral acceleration. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants: REAL, PARAMETER :: G = 9.81 ! Accel of gravity (m/s**2) REAL, PARAMETER :: MACH1 = 340. ! Mach 1 (m/s) ! List of variables: REAL :: acc ! Lateral acceleration (m/s**2) REAL :: radius ! Turning radius (m) REAL :: vel ! Velocity (mach) ! Get input data WRITE (*,*) 'Enter aircraft speed in Mach numbers: ' READ (*,*) vel WRITE (*,*) 'Enter lateral acceleration (g): ' READ (*,*) acc ! Calculate turning radius radius = (vel * MACH1)**2 / (acc * G) 22 ! Write result WRITE (*,*) 'The turning radius is ', radius, ' m.' END PROGRAM turning_radius We can use this program to answer the questions asked in the problem: C:bookf95_2003solnex2_26>turning_radius Enter aircraft speed in Mach numbers: 0.80 Enter lateral acceleration (g): 2.5 The turning radius is 3016.677 m. C:bookf95_2003solnex2_26>turning_radius Enter aircraft speed in Mach numbers: 1.50 Enter lateral acceleration (g): 2.5 The turning radius is 10605.50 m. C:bookf95_2003solnex2_26>turning_radius Enter aircraft speed in Mach numbers: 1.50 Enter lateral acceleration (g): 7 The turning radius is 3787.680 m. 2-27 A program to calculate the escape velocity from a body with a given mass and radius is shown below. Note: There is an error in the equation on the first printing of the book, which will be corrected in later printings. The correct equation is: esc 2GM v R = PROGRAM escape_velocity ! ! Purpose: ! To calculate the turning escape velocity from a body ! with a given mass and radius. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/02/2007 S. J. Chapman Original code ! IMPLICIT NONE ! List of constants: REAL, PARAMETER :: G = 6.673E-11 ! Gravitational constant ! List of variables: REAL :: mass ! Mass of body (kg) REAL :: radius ! Radius of body (m) 23 REAL :: v_esc ! Escape velocity (m/s) ! Get input data WRITE (*,*) 'Enter the mass of the body in kg: ' READ (*,*) mass WRITE (*,*) 'Enter the radius of the body in meters: ' READ (*,*) radius ! Calculate escape velocity v_esc = SQRT( 2.0 * G * mass / radius ) ! Write result WRITE (*,*) 'The escape velocity ', v_esc, ' m/s.' END PROGRAM escape_velocity When this program is run, the result is: C:bookf95_2003soln>escape_velocity Enter the mass of the body in kg: 6.0e24 Enter the radius of the body in meters: 6.4e6 The escape velocity 11185.65 m/s. C:bookf95_2003soln>escape_velocity Enter the mass of the body in kg: 7.4e22 Enter the radius of the body in meters: 1.7e6 The escape velocity 2410.277 m/s. C:bookf95_2003soln>escape_velocity Enter the mass of the body in kg: 8.7e20 Enter the radius of the body in meters: 4.7e5 The escape velocity 497.0342 m/s. C:book

Show more Read less











Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
November 12, 2021
Number of pages
382
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

, Instructor’s Manual


to accompany


Chapman


Fortran 95/2003 for Scientists and Engineers
Third Edition




Stephen J. Chapman
BAE SYSTEMS Australia




i

, TABLE OF CONTENTS


CHAPTER 1. INTRODUCTION TO COMPUTERS AND THE FORTRAN LANGUAGE 9

CHAPTER 2. BASIC ELEMENTS OF FORTRAN 10

CHAPTER 3. PROGRAM DESIGN AND BRANCHING STRUCTURES 24

CHAPTER 4. LOOPS AND CHARACTER MANIPULATION 33

CHAPTER 5. BASIC I/O CONCEPTS 71

CHAPTER 6. INTRODUCTION TO ARRAYS 113

CHAPTER 7. INTRODUCTION TO PROCEDURES 127

CHAPTER 8. ADDITIONAL FEATURES OF ARRAYS 175

CHAPTER 9. ADDITIONAL FEATURES OF PROCEDURES 193

CHAPTER 10. MORE ABOUT CHARACTER VARIABLES 229

CHAPTER 11. ADDITIONAL INTRINSIC DATA TYPES 252

CHAPTER 12. ADDITIONAL DATA TYPES 267

CHAPTER 13. ADVANCED FEATURES OF PROCEDURES AND MODULES 298

CHAPTER 14. ADVANCED I/O CONCEPTS 315

CHAPTER 15. POINTERS AND DYNAMIC DATA STRUCTURES 330

CHAPTER 16. OBJECT ORIENTED PROGRAMMING IN FORTRAN 356

APPENDIX A. LIBRARY PROCEDURE DESCRIPTIONS 357




iii

, Chapter 1. Introduction to Computers and the Fortran Language


1-1 (a) 10102 (b) 1000002 (c) 10011012 (d) 1111112

1-2 (a) 7210 (b) 13710 (b) 25510 (d) 510

1-3 (a) 1273618 and AEF116 (b) 5128 and 14A16 (c) 1578 and 6F16 (d) 37558 and 7ED16

1-4 (a) 111111112 and 25510 (b) 1101010002 and 42410 (c) 10010012 and 7310 (d) 1111111112 and 51110

1-5 A 23-bit mantissa can represent approximately ±222 numbers, or about six significant decimal digits. A 9-bit
exponent can represent multipliers between 2-255 and 2255, so the range is from about 10-76 to 1076.

1-6 46-bit integer: From -245 to -245-1, or -35,184,372,088,832 to 35,184,372,088,831. 64-bit integer: From -263 to
-263-1, or -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

1-7 (a) 1101112 (b) 11111111111110112 (c) 100000000002 (d) 11111100000000002

1-8 The sum of the two’s complement numbers is:
= 936210
11111100111111002 = -77210
00100001100011102 = 859010
The two answers agree with each other.

1-9 011111112 = 12710, and 100000002 = -12810. These results agree with Equations (1-1) and (1-2).

1-10 A 53-bit mantissa can represent approximately ±252 numbers, or about fifteen significant decimal digits. An 11-bit
exponent can represent multipliers between 2-1023 and 21023, so the range of double precision numbers is from about
10-307 to 10307.




9

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Expert001 Chamberlain School Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
798
Member since
4 year
Number of followers
566
Documents
1190
Last sold
1 day ago
Expert001

High quality, well written Test Banks, Guides, Solution Manuals and Exams to enhance your learning potential and take your grades to new heights. Kindly leave a review and suggestions. We do take pride in our high-quality services and we are always ready to support all clients.

4.2

159 reviews

5
104
4
18
3
14
2
7
1
16

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions