next up previous
Next: About this document ... Up: Fortran Implementation Previous: Convergence

Program Design

Let the user enter the value of x and and print the result on the screen. Compare the answer to what Mathematica gives.You will find information on how to write algebraic expressions in Fortran in section 1.4. Sections 1.3 and 2.2.1 on variables are essential to understand as well since everything in Fortran is about variables. You will also need to understand in detail DO and IF constructs, described in sections 1.7.1, 1.7.2 and 2.5.2. The function ABS gives the absolute value (modulus) of a number.

Also, look in section 2.2.2 to see how you can easily and efficiently declare the precision--single (4 bytes, 7 digits) or double precision (8 bytes, 15 digits) for your REAL or COMPLEX variables using parametrized kind values. We expect to see a KIND=wp attribute in all declarations of floating-point numbers. Then it is very easy to change the precision of the program variables by simply changing the value of the kind integer wp. Fortran works with complex numbers in the exact same way as with real numbers, so you shouldn't need to change anything in your program but switch REAL to COMPLEX in the declaration part. Save both versions of the program!

In the next worksheet we will significantly improve the design of this program by packaging and structuring the program and we will also use the program to actually plot the error function.


next up previous
Next: About this document ... Up: Fortran Implementation Previous: Convergence
Phil Duxbury
2000-09-11