Page 124 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 124

Computer Applications   109

                                              Problem Solving
                      The initial outline of  a  solution to  a problem  is  the  algorithm,  i.e.,  a  list  of
                    English-language instructions with  the  following properties:

                      1. The execution  of the proposed algorithm must be completed after a finite
                        number  of  operations, the  number  depending  on  the  complexity  of  the
                        problem and  the degree of  detail  of  the algorithm.
                      2.  The  representation  of  the  solution  must  have  a  unique  interpretation,
                        computers  having  less  tolerance  for  ambiguity  than  humans,  so  when
                        executing the steps with the same input data, the same outputs are obtained.
                      3.  The algorithm must  present the computer with  sufficient  information and
                        instructions to  carry out the  solution.
                      4.  The scope of the algorithm may be predefined by  the range of  the inputs.

                                          Programming Languages
                      A wide variety  of programming languages  are available ranging from machine
                    code,  composed of  sequences of  0’s and  1’s representing either data or instruc-
                    tions, which  is  completely  processor  dependent  and  not  transferable, through
                    assembly  languages  consisting  of  mnemonics  for  instructions  and  usually  hexa-
                    decimal  representation  of  storage location  addresses  and  of  data  to  high-level
                    programming  languages  such as BASIC and FORTRAN. High-level languages  may
                    be  divided into procedure-oriented languages and problem-oriented languages.
                      The  term  problem-oriented languages  should  be  read  as  “special-purpose
                    languages,” or “applications-oriented languages,” since in a more general context
                    all high-level languages may be used  to solve problems.  Some of  these languages
                    have  been  designed for  special  applications such  as  electronic circuit  analysis,
                    while others are more general purpose, such as those written for  simulation  or
                    statistical  packages.
                      Procedure-oriented languages, so called  because  they  allow the  programmer
                    to  concentrate on the process  rather than on the machine architecture, include
                    familiar languages, such as FORTRAN, as well  as many more recently developed
                    ones. Three of  the  high-level languages of  common  interest  to  engineers are:
                      1.  BASIC:  Beginners All  Purpose  Symbolic Instruction  Code, most  often  an
                        interpreted (i.e., each line is translated into (object) machine code immediately
                        before  execution  and  no  object  code  is  retained  for  future  executions),
                        highly interactive  language, with a minimum of imposed structure and the
                        ability to allow the user to access the memory and input/output  hardware
                        of  the  machine.  Its  disadvantages  are  slow  execution  speed  (although
                        compiled BASICs are frequently faster) and the great degree of programming
                        freedom, allowing  users  to  create  terrible messes  if  they  so desire, with
                        little  chance of  error  detection. Because  of  the great degree of  variation
                        in BASIC  implementations on different systems, it is necessary  to refer  to
                        a specific system manual for its BASIC syntax, as well as for the DOS (Disk
                        Operating System) instructions for  that  system,  or to  the  BASIC  texts  in
                        the  reference section for  some general forms of  the language.
                      2.  FORTRAN:  Formula  Translating Language,  the  original,  still  most  com-
                        monly  used  language  for  engineering  computations.  It  is  a  compiled
                        language  (the entire program is translated to object code and saved before
                        execution) that  links  to  many  libraries  of  subroutines and  has  a  number
                        of  special purpose extensions.  FORTRAN has been much improved by  the
   119   120   121   122   123   124   125   126   127   128   129