This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: MSC321 Homework 3 MSC321 February 10, 2011 1 Reviews 1. What are the differences between functions and subroutines? 2. How are arguments passed to procedures in FORTRAN? 3. What does the term “dummy argument” refer to and contrast it to an “actual argument” 4. Explain why dummy and actual arguments have to agree on position and data type 5. Explain what an interface block is and why it is useful in programming. 6. What are the differences between an internal procedure and an external procedure? 2 Coordinate transformation The transformations between cartesian coordinates ( x,y ) and polar coordinates ( r,θ ) are ( r = √ x 2 + y 2 θ = tan 1 y x and its inverse ( x = r cos θ y = r sin θ (1) Write a module with subroutines cart2pol(r,t,x,y) and pol2cart(x,y,r,t) that transform cartesian coordinates x , y into polar coordinates ( r,θ ) and vice versa. Test these subroutines on the 4 points ( ± 1 , ± 1) / √ 2, use the inverse transformation to recover the original points. Use the intrinsic function atan2 to find the angle which should be reported in degrees. 3 Function and derivative evaluation Write a module with a subroutine disp(f,df,x) that calculates the function f ( x ) = x tanh x 1 / 4 and its derivative f ( x ) = tanh x + x (1 tanh 2 x ) given x . Use this subroutine to calculate these....
View
Full
Document
This note was uploaded on 01/08/2012 for the course MSC 321 taught by Professor Staff during the Fall '08 term at University of Miami.
 Fall '08
 Staff

Click to edit the document details