The TAs forgot to ask for written 3 minute essays this week. My thanks to those of you who took the time to submit your essay via the Web or E-mail
It tells the compiler to ignore the Fortran "Implicit" assumption that variables beginning with a-h or o-z are REAL and those beginning with I-n are INTEGER. As a result the compiler requires you to explicitly define the type for every variable that you use in your program.
How do you set up a function or more exactly how do you compose it, I don't understand exactly how a function works.
As to how it works, a function is just a way to isolate a group of instructions to the computer, and control the way data is provided to those instructions for processing. Remember that I am isolating a block of calculations to make it easier to read and debug, and because either:
real function ...
implicit function ...
or several other possibilities to cover other possible types for results. Now what about that "...". Either you, or somebody directing you has picked a name for your function, and has determined the number and types of arguments to be passed to the function. For example in Homework 5 I tell you:
The real valued function must be named "dist" and must take two real arguments. The first argument is the angle of inclination of a cannon's barrel from horizontal, in radians. The second argument is the cannon's muzzle velocity in meters per second. The value returned by the function is the range of the cannon shell (in meters)You are free to choose the names you will use for the two arguments (say "a" for angle, and "v" for velocity), but not free to choose the type (real, integer, ...), since I have mandated the types. Part of using any function correctly is to know the type for each argument. In this example, you end up with an opening statement for the function of
function dist ( a, v )Fortran syntax requires that if you need to use a module in a function, the next set of statements must be "USE" statements. However, we won't be doing that here. Usually you will be using FUNCTION subprograms for situations where all incoming information is routed through the argument list. With no modules to worry about, the second statement must be "implicit none" (see discussion above). After shutting off implicit data typing, you must next declare the types for all of your variables and the function itself. Next you include other non-executable statements such as PARAMETER. Then you include the block of code that does the actual work. This must have at least one line that assigns a value to the function. In the homework example, this means that at least one line begins with " dist = ". Once you've provided the function's value, you are usually done. Whenever, you've finished including all the statements that you want in your function, you must end the function with an END statement.
That's about all there is to the basic requirements. Do what Fortran requires to recognize a valid function, then you are free to include any combination of Fortran statements that you need to do the specific task.
I don't understand how to enter Intrinsic functions into a statement properly.
Pretty much the way you would enter a variable. If it helps you, temporarily represent the intrinsic function by a regular variable name (s1 = sin(t)). Write your statement that needs the intrinsic function, say:
volts = 110.0*s1 + biasthen directly substitute "sin(t)" where "s1" appears to get the final form of the statement for your program
volts = 110.0*sin(t) + biasBy the way it would have been perfectly legitimate Fortran to use two lines:
s1 = sin(t) volts = 110.0*s1 + biasWith an optimizing compiler, the resulting machine code would not have been different, unless you used "s1" again later in the program unit.
That isn't simply a practice test, it's an exam from 1995. We explicitly covered some history of computing that year, but that has been eliminated from the regular lectures (and hence exams). You should know the basic Unix commands presented in the Web pages for the 1st and 2nd recitations. You should know the basic components of a computer and how they work. You should have some understanding of the use of bits to represent data, including the concept of a byte, range of integers that can be represented with 32 bits (4 bytes), and the approximate range and precision of real (floating point) numbers that can be represented with 32 and 64 bits.
Is the text book enough to get me acquainted with the software for this course, or should I buy those UNIX and Fortran for dummies books?
The text box is inadequate for Unix, but the class notes plus Web material cover everything that you need. I am only trying to teach you enough Unix to get through the process of writing , executing, and debugging programs. You should consider the Unix for Dummies book if you want to develop more depth in Unix. You should find everything you need for Fortran in a combination of the text and the Web notes.
If we have had previous programming experience in a similar language such as C++ is it really necessary to buy the book? Would it hurt us if we just used the provided lectures on the web page?
Probably not. I look at my own Web examples when designing Homework, and the Web lecture (and recitation) notes when creating tests.
Maintained by John Mahaffy : firstname.lastname@example.org