INSTDE04.txt file



           ========================================================
                IMPLEMENTATION AND USE OF THE FORTRAN CODES FOR
           "L2WPMA: A FORTRAN 77 PACKAGE FOR WEIGHTED LEAST SQUARES
                    PIECEWISE MONOTONIC DATA APPROXIMATION"
                                      by
                         I.C. DEMETRIOU, PhD (Cantab)
            =======================================================

                             University of Athens
                            Department of Economics
                      Unit of Mathematics and Informatics
                  8 Pesmazoglou Street, 105 59 Athens, Greece
                     phone: +30-210 8017732, 210 3689817
                          e-mail: demetri@econ.uoa.gr

                                 December 2004



SUMMARY
This  file  accompanies  the  Fortran 77 software package L2WPMA for weighted 
least  squares  piecewise  monotonic  data  approximation [1]. It consists of 
three  sections,  which  repeat  information  from  [1],  and four appendices 
organized  as  follows.  Section 1 states the problem, Section 2 outlines the 
user  interface  and  Section  3  presents  the  purpose  of each subroutine. 
Appendix  A  presents  and  explains the use of two driver programs and gives 
technical  details  about  installation,  compilation,  linking,  running and 
testing of the Fortran codes. Appendix B presents output of a test example in 
order  to  help  the  use of the package. Appendix C applies L2WPMA to sample 
data  sets  (including also trivial cases), presents output that demonstrates 
the  various  messages  employed  by  L2WPMA  and illustrates some particular 
aspects  of the software like, for example, weighting of the data. Appendix D 
considers some coding details of each subroutine.

The entire code occupies 1455 Fortran 77 lines including comments. Single and 
double  precision  versions  have   been   developed  for  practical use. All 
subroutines  begin with comments that explain the input and output arguments, 
the working space and the method followed.

Details  about the method of calculation, the user interface, the subroutines 
purpose  and  names in the Fortran codes are presented in [1]. The underlying 
method  is  established  by  [2] and [3] except that in [1] we allow the data 
have  positive  weights and at the end of the calculation we provide a spline 
representation of the solution and the corresponding Lagrange multipliers.


REFERENCES
[1]  Demetriou, I.C.,  L2WPMA: A Fortran 77 package for weighted least squares 
piecewise monotonic data approximation. Report 2004.
[2] Demetriou, I.C.,  Discrete piecewise monotonic approximation by a strictly
convex distance function, Math. of Computation, 64(1995), pp. 157-180.
[3] Demetriou, I.C. and M.J.D. Powell,  Least squares smoothing of  univariate 
data to achieve piecewise monotonicity.  IMA J. of Numer. Anal., 11(1991), pp. 
411-432.

          THIS FILE CONTAINS THE FOLLOWING SECTIONS AND APPENDICES:
          ---------------------------------------------------------
1. Problem definition
2. The user interface
3. Directory of the subroutines

Appendix A  Driver programs and installation of the package  ...............
              1. Overview ..................................................
              2. DRIVER1 ...................................................
              3. DRIVER2 ...................................................
              4. Installing the source codes  ..............................
              5. Applying the software package L2WPMA to a data set ........
                 5.1 Implementation with Make files on a PC with windows and
                     the Compaq Visual Fortran 6 ...........................
                 5.2 Implementation on a UNIX system .......................
              6. Generating data sets for testing the software package 
                 L2WPMA ....................................................
                 6.1 Implementation with Make files on a PC with windows and
                     the Compaq Visual Fortran 6 ...........................
                 6.2 Implementation on a UNIX system .......................
Appendix B  An example with output on the use of L2WPMA .......... .........
              1. Overview ..................................................
              2. An example on the use of L2WPMA ...........................
                 2.1 Produce the datafile XFWDAT by DRIVER2 ................
                 2.2 Apply DRIVER1 to datafile XFWDAT ......................
              3. More examples in Appendix C ...............................
Appendix C  Demonstrating L2WPMA on certain data sets ......................
              1. Overview ..................................................
              2. Trivial cases .............................................
              3. An example when the monotonic sections are 0,1,2,...,15 ...
              4. An example when a monotonic section degenerates to a single
                 component .................................................
              5. An example when the first monotonic section is decreasing . 
              6. An example of weighting certain data points ...............
              7. Examples with automatic weighting .........................
                 7.1 Introduction ..........................................
                 7.2 MODEWF=2 ..............................................
                 7.3 MODEWF=3 ..............................................
                 7.4 MODEWF=4 ..............................................
              8. Only the data (F) are provided (MODEWF=5) .................
Appendix D  Remarks on the Fortran listings ................................

          THE ACCOMPANYING ZIP FILE CONTAINS THE FOLLOWING FILES:
          --------------------------------------------------------
      readme.txt       An overview of the zip file
      INSTDE04.txt     This file
      L2WPMA.pdf       The manuscript [1] in pdf format (it may be viewed 
                       with the Acrobat Reader).
      abstract.txt     The abstract of the submission
<SP> directory
Single precision code files and Makefiles
      src.f            It includes the source modules L2WPMA, TRIVIA, 
                       L2WMON, XTREMA and MESSGW that compose the package
      driver1.f        driver program (source module DRIVER1)
      driver2.f        driver program (source module DRIVER2)
      rnd.f            random number generator
      make1            makefile associated with DRIVER1 for Windows Compaq
                       Visual Fortran 
      make2            makefile associated with DRIVER2 for Windows Compaq
                       Visual Fortran
      make1.unix       makefile for Unix systems (associated with DRIVER1)
      make2.unix       makefile for Unix systems (associated with DRIVER2)
            (8 files)
<DP> directory
Double precision code files and Makefiles
      src.f            It includes the source modules L2WPMA, TRIVIA, 
                       L2WMON, XTREMA and MESSGW
      driver1.f        driver program (source module DRIVER1)
      driver2.f        driver program (source module DRIVER2)
      rnd.f            random number generator
      make1            makefile associated with DRIVER1 for Windows Compaq
                       Visual Fortran 
      make2            makefile associated with DRIVER2 for Windows Compaq
                       Visual Fortran
      make1.unix       makefile for Unix system (associated with DRIVER1)
      make2.unix       makefile for Unix system (associated with DRIVER2)
            (8 files)
<DATA> directory
      readme2.txt an overview of this directory (see content below)
Input files: 
      XFWDAT      the data set used in Appendix B
      XFWDAT_appB as XFWDAT
      XFWDAT1     just one data point
      XFWDAT2     monotonic increasing data
      XFWDAT3     monotonic decreasing data
      XFWDAT4     14 data points
      XFWDAT_D    data for the case where a monotonic section degenerates 
                  to a single component
      XFWDAT_C    data for the case where the first monotonic section is 
                  decreasing
      XFWDAT_W    data for the case when the user provides the weights
      XFWDAT_A    data for the case of automatic weighting
      XFWDAT_F    only F is provided for smoothing

Output files and directories
      <1>   directory, includes
            input  file XFWDAT:=XFWDAT1  and the following associated output 
            files (after executing DRIVER1): 
            WIAKN  indices of knots of spline representation of best fit
            WIVAPP indices of integer variables (turning points) of best fit
            WPMAPP abscissae, measurements, best fit, Lagrange multiplies
            R1     output file that presents the screen output of DRIVER1
                   (with  the parameter IFILE=1) when the datafile XFWDAT is 
                   used. 
      <2>   directory, includes
            input  file XFWDAT:=XFWDAT2  and the following associated output 
            file (after executing DRIVER1): 
            WIAKN, WACTLG, WIVAPP, WPMAPP, R2   as explained in <1>
      <3>   As in <2>, except that XFWDAT=XFWDAT3 is used and R3 is produced
      <40>  directory, includes 
            input file XFWDAT:=XFWDAT4 and output file R40 (after executing
            DRIVER1).
      <41>  directory, includes
            input file XFWDAT:=XFWDAT4 and the following associated output
                   files (after executing DRIVER1): 
            WIAKN  indices of knots of spline representation of best fit
            WACTLG indices of active constraints and Lagrange multipliers
                   of best fit
            WIVAPP indices of integer variables (turning points) of best fit
            WPMAPP abscissae, measurements, best fit, Lagrange multiplies
            R41     output file as explained in <1>
      <42>,..., <49>, <415>  directories similar to <41>
      <D>, <C>, <A_W2>, <A_W3>, <A_W4>, <F>, <W>  directories similar to
            <41>,  except that XFWDAT:=XFWDAT*, where *=D, C, F, W, and that 
            the  output  files  RD,  RC,  RA_W2,  RA_W3,  RA_W4,  RF, RW are 
            produced.

      Note  that  all output files r1, r2, r3, r40, r41, r42, r43, r45, r46, 
      r47,  r48,  r49,  r415,  RD,  RC,  RA_W2,  RA_W3, RA_W4, RF and RW are 
      presented  in  Appendix  C  within  the  context  of demonstrating the 
      messages and some particular aspects of the software package.

<Appndx_B> directory, datafiles for the example of Appendix B:
      readmeb.txt  an overview of this directory (see content below)
      XFWDAT       output file from DRIVER2, which is used as an input file 
                   to DRIVER1
      RAPP_B       screen output from DRIVER1 with input data XFWDAT
      WIAKN, WACTLG, WIVAPP, WPMAPP, as explained above

<Section6> directory, data files for the example of Section 6 [1]
      readme6.txt  an overview of this directory (see content below)
      Input files:
        UKD47-96.txt original dataset with monthly data of the rates of UK
                     pound over US dollar from 1947 to 1996
        XFWDAT       as file UKD46-96, but in a form suitable for input to 
                     DRIVER1
      Output files are kept in:
        <k_14> directory, includes
               R14  screen output of DRIVER1 with KSECTN=14
               WIAKN, WACTLG, WIVAPP, WPMAPP  as explained above
        <k_16> directory, includes
               R16, screen output of DRIVER1 with KSECTN=16
               WIAKN, WACTLG, WIVAPP, WPMAPP, as explained above
        <k_18> directory, includes
               R18, screen output of DRIVER1 with KSECTN=18
               WIAKN, WACTLG, WIVAPP, WPMAPP, as explained above

<Tables1_2> directory, includes 
        readme12.txt  an overview of this directory (see content below)
        XFWDAT4       the datafile that was used for producing Tables 1 
                      and 2 of [1]. 


The content of readme2.txt is as follows:
----------------------------------------------------------------------
readme2.txt 

The <DATA> catalogue contains: 

1) datafiles to be used as input for driver1.f. Their names start with 
the characters "XFWDAT". 

2) directories with output files from driver1.f by making use of the 
input files above. The standard output files for each dataset are 
WPMAPP, WIVAPP, WIAKN and WACTLG. Also, due to the parameter IFILE=1 
in DRIVER1.f, one more output file is presented, namely "R*" in 
association with "XFDAT*". All these files are presented in Appendix C 
of file INSTDE04.txt. 
----------------------------------------------------------------------

The content of readmeB.txt is as follows:
----------------------------------------------------------------------
readmeb.txt 

The <Appndx_B> catalogue contains: 

File XFWDAT (a copy of XFWDAT_appB), which is used as input to 
DRIVER1.f. Files RAPP_B, XFWDAT, WPMAPP, WIVAPP, WIAKN and WACTLG,
which are output from DRIVER1. These files contain all the material 
used to produce Appendix B of file INSTDE04.txt. 
----------------------------------------------------------------------

The content of readme6.txt is as follows:
----------------------------------------------------------------------
readme6.txt 

The <Section6> catalogue contains: 

1) the datafiles UKD47-96 and XFWDAT that have been used to produce 
the output files of the example presented in Section 6 [1]. 
Specifically, XFWDAT contains the numbers of UKD47-96 in a form 
suitable to be used as input for DRIVER1.f.  

2) the subdirectories <k_14>, <k_16> and <k_18> contain the files R*, 
where *=14, 16, 18. Each subdirectory contains files of type WPMAPP, 
WIVAPP, WIAKN and WACTLG. The best approximation of each of these 
files is mentioned in Section 6 [1].
---------------------------------------------------------------------

---------------------------------------------------------------------
readme12.txt

The <Tables1_2> catalogue contains:

The datafile XFWDAT4, which was used for producing Tables 1 and 2 
of  [1].  For Table 2 specifically, option WFMODE=2 has been used 
in DRIVER1.f
---------------------------------------------------------------------


1. PROBLEM DEFINITION
---------------------
FORTRAN 77 software is presented for piecewise monotonic data fitting that is 
stated  by  Demetriou and Powell [3] as  follows.  A smooth function  f(x) is 
measured at the abscissae X(I1)<X(I1+1)<...<X(N) and the  measurements (data) 
{F(i):  i=I1,I1+1,...,N}  contain  random errors. Also we let X(i), F(i) have 
positive  weights  W(i), i=I1,I1+1...,N. We assume that  the  number  of sign 
changes  observed  in  the  sequence {F(i+1)-F(i): i=I1,I1+1,...,N-1} is much 
greater   than    that    number    in   the   sequence   {f(X(i+1))-f(X(i)):   
i=I1,I1+1,...,N-1}.  The  sign changes in the first sequence may suggest that 
it  would   be  advantageous to modify the data if the underlying function is  
composed   of  a certain number of monotonic sections. Therefore we  consider  
the   problem   of   calculating  numbers  {Y(i): i=I1,I1+1,,...,N} by making  
least   change  to  the data so that the sequence {Y(i+1)-Y(i): i=I1,...,N-1}  
has   at   most   KSECTN-1  sign  changes,  where  KSECTN is a given positive 
integer. We regard the data and the smoothed values as vectors, F(.) and Y(.) 
say.  The  abscissae are not needed in this calculation, except that they may 
be  used  in  defining  the  weights so as to reflect possible differences in 
their spacing.

In order to define the 'least' change to the data that gives  this criterion, 
the  vector Y(.) is calculated to minimize the weighted sum of squares of the 
residuals

                  N
                  SUM W(i)*(F(i)-Y(i))*(F(i)-Y(i))    (1.1)
                 i=I1

subject to the piecewise monotonicity constraints

             Y(t(j-1)) <= Y(t(j-1)+1) <= ... <= Y(t(j)), if j is odd    (1.2)
             Y(t(j-1)) >= Y(t(j-1)+1) >= ... >= Y(t(j)), if j is even,

where the integers {t(j): j=0,1,...,KSECTN} satisfy the conditions

             I1 = t(0) <= t(1) <= ... <= t(KSECTN) = N.    (1.3)

We should note that t(j), j=1,...,KSECTN-1, are variables of the minimization 
calculation.  The  definition  and the use of the weights is explained in [1] 
and in the source code of the subroutine L2WPMA.

An example in [3] shows that such a large number of local minima can occur in 
this  calculation  that  it  is  impossible  to  test each one separately. In 
addition  a  general  optimization algorithm can stop at a local minimum that 
need  not  be a global one. Further, this example suggests that the amount of 
work  of  finding an optimal combination of integers {t(j): j=1,...,KSECTN-1} 
can  be  of  magnitude  (N/2)^(KSECTN-1)/(KSECTN-1)!,  when  I1=1,  which  is  
prohibitively  expensive even for small values of N and KSECTN. Demetriou and 
Powell [3] developed a dynamic programming algorithm that solves this problem 
in  at most O(KSECTN*N^2) computer operations. This algorithm is based on the 
fundamental  property  that a best piecewise monotonic approximation consists 
of   separate   optimal   monotonic   sections,  alternately  increasing  and  
decreasing,  that  do  not  interact with each other. The algorithm is by far 
more  efficient  in practice than the complexity indicates in theory, because 
the  calculation  restricts  the  search  for  optimal  integers to the local 
extrema  of  the  data,  because  it  takes  advantage  of  some monotonicity 
properties  of  the  rightmost  integer  variable  and  because of the use of 
efficient data structures.

In  [1]  the  calculation  of  an  optimal  approximation  is   performed  by  
software  that  consists  of five Fortran subroutines. The  main  subroutine,  
which   also  names  this  software, is L2WPMA that implements Algorithm 1 of  
[2], except that the data have weights and that at the end of the calculation 
a  spline  representation  of  the  solution  and  the corresponding Lagrange 
multipliers  are  given.  Section  2 specifies the interface of this software 
with  the calling program. Section 3 presents the purpose of each subroutine. 
In  four  appendices  we include driver programs, test examples that help the 
usage  of  the this software, installation guidelines, sample data and coding 
details.

The  entire code presented occupies 1455 Fortran 77 lines including comments. 
Single  and double precision  versions have been developed for practical use.  
In  order  to  make  the  code  readable  and  reasonably self described, all 
subroutines  begin with comments that explain the input and output arguments, 
the  working  space  and  the  method  followed. The software has been tested 
extensively  with  as  many  as  10000  data points on a variety of data sets 
showing an excellent performance [2]. 

The  given  smoothing technique avoids the assumption that f depends on a set 
of  parameters  and  takes  the  view  that  some  useful smoothing should be 
possible if the data fails to satisfy piecewise monotonicity, a property that 
occurs  in  a wide range of underlying functions f(x). Further, the smoothing 
technique  may  be  particularly  useful  in  statistical  data  analysis  by  
estimating  conditional  expectations  subject to piecewise monotonicity (see 
[2]  for  key  references  regarding  the  single  monotonic  data  smoothing  
problem).  For  a discussion on applications, advantages and disadvantages of 
the method see [1].

2. THE USER INTERFACE
---------------------
The main subroutine that provides interface to the user is declared by

    SUBROUTINE L2WPMA(I1,N,X,F,WF,MODEWF,KSECTN,IORDER,Y,WY,NK,IAKN,NACT,
   + IACT,PAR,ITAU,ITHETA,MODE,SS,G,RG,LOWER,IUPPER,INDX,FT,WFT,FTNEG,
   + WY1,Z,WZ,IW,IAKNW)

The  purpose  of  each  argument  is  explained in the source code of L2WPMA. 
Concerning  the  data weights, there are five options depending on the values 
of MODEWF: the weights are supplied by the user, the weights are set to unity 
by  the  program and the weights are defined automatically (3 options) due to 
the  abscissae  spacing.  Also,  the  user  has  to specify whether the first 
monotonic section is increasing or decreasing (IORDER).

Subroutine  L2WPMA  is  a  finite  procedure. Unsuccessful return (MODE=0) is 
caused  only  if KSECTN<1. Otherwise its return is successful, Y(.) satisfies 
the  constraints (1.2), ITHETA(.) satisfies the conditions (1.3), in place of 
t(.),  and  MODE  is  set  to  1 or 2. The termination status is explained by 
certain  messages.  At  the  end  of  the  calculation IAKN(.) keeps the data 
indices  of  the  knots  of  a spline representation of Y(.) and PAR(IACT(.)) 
keeps the Lagrange multipliers associated with Y(.).

3. DIRECTORY OF THE SUBROUTINES
-------------------------------
The  Fortran  software  for the piecewise monotonic approximation calculation 
consists of five subroutines whose purpose is shown in Table 1. Common blocks 
and  private  array  storage  are  completely  avoided.  The working space is 
directed  through the argument list of each subroutine. All variables but the 
temporary ones retain their meaning. We let the data index range be [I1,N].

The numbers of lines of code of each  subroutine  including  comments  are  as
follows:
L2WPMA    740             XTREMA    137            MESSGW    145
L2WMON    250             TRIVIA    183.


                          TABLE 1  DIRECTORY OF SUBROUTINES
=============================================================================
Name of Sbrtn       Purpose of subroutine
-----------------------------------------------------------------------------
L2WPMA              Interface to the user.
                    Minimizes the objective function (1.1) subject to the 
                    constraints (1.2) where the {t(i): i=1,...,KSECTN-1} are 
                    integer variables of the optimization calculation that 
                    satisfy the conditions (1.3). The underlying  method is 
                    described by Demetriou [2] except that it makes use of 
                    data weights. It implements Algorithm 1 [2] except that 
                    at the of the calculation L2WPMA provides the indices of 
                    the knots of a spline representation of the solution and 
                    the corresponding Lagrange multipliers. It calls 
                    subroutines TRIVIA, XTREMA, L2WMON and MESSGW. 

TRIVIA              Examines the following trivial cases of the  calculation:
                    If KSECTN<1 then a MODE=0 return is caused. If KSECTN=1 
                    then on return to subroutine L2WPMA, subroutine L2WMON is 
                    applied. If KSECTN>1 and the data components are either 
                    monotonic increasing or monotonic decreasing or N=I1, 
                    then the data itself is the required approximation and on  
                    return to subroutine L2WPMA, termination occurs. The use 
                    of TRIVIA is demonstrated in Appendix C.

L2WMON              Calculates the best weighted least squares monotonic 
                    increasing approximations to consecutive data. Implements 
                    a modification of Algorithm 1 of Demetriou and Powell [3] 
                    except that at the of the calculation it provides the 
                    knots of a spline representation of the solution and the 
                    corresponding Lagrange multipliers.

XTREMA              Provides the sets that hold  the indices of the local 
                    minima (NL) and the local maxima (NU) of the data 
                    according to the definitions given by Demetriou and 
                    Powell [3].

MESSGW              Contains certain messages associated with the operation 
                    of subroutines L2WPMA and TRIVIA. They are all 
                    demonstrated in Appendix C.
=============================================================================



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

APPENDIX A

DRIVER PROGRAMS AND INSTALLATION OF THE PACKAGE
===============================================

1. OVERVIEW
-----------
This  appendix  gives  technical  details about installation, compilation and 
linking  of  the  Fortran  codes  related  to  this work. Two driver programs 
DRIVER1  and  DRIVER2  together with the associated makefiles MAKE1 and MAKE2 
are provided to assist this process. 

Five subroutines compose the software package, whose purpose is stated in the 
Directory  of  Subroutines  in  this file. The codes have all  been  compiled  
and  executed  successfully  on  the following compilers: Fortran 77 on a VAX 
8810  computer with Unix, Fortran 77 on a Hewllet-Packard HP-UX 11.0 computer 
with  Unix  and  on  a  personal  computer  with an INTEL Pentium III 733 MHz 
processor  operating  in  Microsoft Windows 98 using the following compilers: 
Compaq Visual Fortran 6.1, Absoft Pro 8 and Lahey Fortran 95 Pro v5.5.

In order to implement the package, we recall the names of the Fortran modules 
(subroutines,  drivers  and a random number generator) and the makefiles. All 
modules preserve their names in the single or double precision version. 

Single precision codes and makefiles
  SRC.F (it consists of subroutines L2WPMA, TRIVIA, L2WMON, XTREMA and MESSGW)
  DRIVER1.F (it is program DRIVER1)
  DRIVER2.F (it is program DRIVER2)
  RND.F (the random number generator)
  MAKE1 (makefile associated with DRIVER1 for Windows Compaq Visual Fortran)
  MAKE2 (makefile associated with DRIVER2 for Windows Compaq Visual Fortran)
  MAKE1.unix (makefile for Unix systems associated with DRIVER1)
  MAKE2.unix (makefile for Unix systems associated with DRIVER2)
  (8 files)

Double precision codes and makefiles
  SRC.F (it consists of subroutines L2WPMA, TRIVIA, L2WMON, XTREMA and MESSGW)
  DRIVER1.F (it is program DRIVER1)
  DRIVER2.F (it is program DRIVER2)
  RND.F (the random number generator)
  MAKE1 (makefile associated with DRIVER1 for Windows Compaq Visual Fortran)
  MAKE2 (makefile associated with DRIVER2 for Windows Compaq Visual Fortran)
  MAKE1.unix (makefile for Unix systems associated with DRIVER1)
  MAKE2.unix (makefile for Unix systems associated with DRIVER2)
  (8 files)

2. DRIVER1
----------
DRIVER1 demonstrates the use of L2WPMA when the data is read from file XFWDAT 
and  the  results are directed to the files WPMAPP, WIVAPP, WIAKN and WACTLG. 
Specifically, the driver reads unformatted values for I1 and N according to
            READ (2,*) I1,N
and then it reads unformatted values for N-I1+1 data triads according to

            DO xx I=I1,N
               READ (2,*) X(I),F(I),WF(I)
      xx    CONTINUE

Then  the  best  weighted  least squares piecewise monotonic approximation to 
F(.)  is computed and the following five actions take place. First, I1, N, I, 
X(.), F(.), WF(.), Y(.) and PAR(.) are directed to file WPMAPP according to

            WRITE (3,y) I1,N
      y     FORMAT (2I5)
            WRITE (3,yyy) I1,X(I1),F(I1),WF(I1),Y(I1)
            DO yy I=I1+1,N
               WRITE (3,yyy) I,X(I),F(I),WF(I),Y(I),PAR(I)
      yy    CONTINUE
      yyy   FORMAT (I5,4E20.10)

Second, the indices of the calculated extrema (turning points) are calculated 
and directed to file WIVAPP according to

           DO z I=I1-1,KSECTN
              WRITE (3,zz) I,ITHETA(I)
      z    CONTINUE
      zz   FORMAT (2I5)

Third,  the  indices  of  the  knots  of  the  spline representation of Y and the corresponding components of Y are directed to file WIAKN according to

           DO w I=I1,NK
              WRITE (3,zz) I,IAKN(I), Y(IAKN(I))
      w    CONTINUE

Fourth, the indices of the active constraints and the Lagrange multipliers at 
the end of the calculation are directed to file WACTLG according to

           IF (I1 > NACT) GOTO vvv
           DO v I=I1,NACT
               WRITE (3,vv) I,IACT(I),PAR(IACT(I))
      v    CONTINUE
      vv   FORMAT (2I5,5X,E20.10)
      vvv  CONTINUE

Fifth,  if  (parameter)  IFILE=1  then some screen output shows ITHETA, IAKN, 
IACT,  X,  F,  WF,  Y,  PAR,  and  the  value of the objective function at Y. 
Comments  are  included in the source code DRIVER1.F that explain its use. An 
example on the use of DRIVER1 is presented in Appendix B. 

3. DRIVER2
----------
DRIVER2  generates data with added 'pseudorandom noise' and directs this data 
to  a file, whose default name is XFWDAT. Then this file can be used as input 
to  driver  DRIVER1.  For  our  testing needs the data is generated by adding 
uniformly  distributed random numbers from the interval (-SIZE,SIZE) to given 
function   measurements   {f(X(i)):   i=I1,...,N},   thus   producing  {F(i):  
i=I1,...N}.  Further,  it  sets {WF(i)=1: i=I1,...,N}. The FUNCTION RND(SIZE) 
that generates the random numbers is also included  in the source listings.

The user need only provide DRIVER2 with values for SIZE, I1 and N, as well as 
an  analytic  form  for f(x). Upon its execution, the driver writes to XFWDAT 
the values of I1 and N, and the N-I1+1 data triads (X,F,WF) as follows:

            WRITE (2,x) I1,N
      x     FORMAT (2I5)
            DO xx I=I1,N
               WRITE (2,xxx) X(I),F(I),WF(I)
      xx    CONTINUE 
      xxx   FORMAT (3E20.10)

Comments  are  included  in the source codes DRIVER2.F and RND.F that explain 
the  use  of these two modules. An example on the use of DRIVER2 is presented 
in Appendix B.

4. INSTALLING THE SOURCE CODES
------------------------------
Copy  all single/double precision files, makefiles and the datafile XFWDAT to 
a directory of your computer system.

5. APPLYING THE SOFTWARE PACKAGE L2WPMA TO A DATA SET 
-----------------------------------------------------
5.1 IMPLEMENTATION WITH MAKE FILES ON A PC WITH WINDOWS AND THE COMPAQ VISUAL 
FORTRAN 6
Suppose  that  the  modules mentioned in Section 4 above are held in the same 
directory  with  the  file  XFWDAT (in Section 6 below we show how to produce 
this  specific  file).  Consider the parameter settings of the driver program 
DRIVER1. In order to apply the software package L2WPMA to the data of XFWDAT, 
first produce the executable code DRIVER1.EXE by following the instructions:

      1. Compile the source codes DRIVER1.F and SRC.F.

      2.  Link  the resultant objective codes with the system Fortran library 
      and call the executable code DRIVER1.EXE.

In  the Compaq Visual Fortran 6.1 environment installed on a PC with windows, 
these instructions may be implemented as follows: We choose 
     Programs | Compaq Visual Fortran | Fortran Command Prompt
Then change to the directory specified in Section 4. At  the  command  prompt 
type 
     NMAKE make1 [ENTER]
which creates DRIVER1.EXE automatically.

Having  had DRIVER1.EXE, we execute it and a weighted least squares piecewise 
monotonic fit to the data contained in the file XFWDAT is calculated and held 
in  the  file  WPMAPP.  Also the indices of the extrema of the calculated fit 
(cf.  (1.3))  are  held  in  the file WIVAPP. In addition, the indices of the 
knots  of  a  spline  representation  of Y are held in the file WIAKN and the 
corresponding  Lagrange multipliers are held in WACTLG. The example presented 
in Appendix B gives details of this process.

5.2 IMPLEMENTATION ON A UNIX SYSTEM
As  in Section 5.1, except that we make use of Fortran on Unix systems, where 
Makefile MAKE1.unix is provided.

Alternatively,  one  may  compile the codes at the system command prompt. For 
example,  in  order to use the Fortran 90 compiler of a Hewllet-Packard HP-UX 
11.0  computer  with  Unix,  we  first  changed to the directory specified in 
Section 4 and then at the command prompt we typed 

     f90 driver1.f src.f -o driver1.exe [ENTER]

which created DRIVER1.EXE automatically.

6. GENERATING DATA SETS FOR TESTING THE SOFTWARE PACKAGE L2WPMA
---------------------------------------------------------------
6.1 IMPLEMENTATION WITH A MAKE FILE ON A PC WITH WINDOWS AND THE COMPAQ VISUAL 
FORTRAN 6
Consider  the  parameter  settings of the driver program DRIVER2. In order to 
produce  an executable code that generates a sample data set, as the one used 
in Section 5 above by software package L2WPMA, we follow the instructions:

      1. Compile the source codes DRIVER2.F and RND.F. 

      2.  Link  the resultant objective codes with the system Fortran library 
      and call the executable code DRIVER2.EXE. 

In  the Compaq Visual Fortran 6.1 environment installed on a PC with windows, 
these instructions may be implemented as follows: We choose 
     Programs | Compaq Visual Fortran | Fortran Command Prompt
Then  change  to  the directory specified in Section 4. At the command prompt 
type
     NMAKE make2 [ENTER]
which gives DRIVER2.EXE automatically.

Now  execute DRIVER2.EXE. As a result, a data set is generated, whose default 
name  is  XFWDAT.  The  example presented in Appendix B gives details of this 
process.

6.2 IMPLEMENTATION ON A UNIX SYSTEM
As  in Section 6.1, except that we make use of Fortran on Unix systems, where 
Makefile MAKE2.unix is provided.

Alternatively,  one  may  compile the codes at the system command prompt. For 
example,  in  order to use the Fortran 90 compiler of a Hewllet-Packard HP-UX 
11.0  computer  with  Unix,  we  first  changed to the directory specified in 
Section 4 and then at the command prompt we typed 

     f90 driver2.f rnd.f -o driver2.exe [ENTER]

which created DRIVER2.EXE automatically.


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

APPENDIX B

AN EXAMPLE WITH OUTPUT ON THE USE OF L2WPMA
===========================================

1. OVERVIEW
-----------
This appendix presents an example with output in order to demonstrate the use 
of the Fortran package L2WPMA.

2. AN EXAMPLE ON THE USE OF L2WPMA
----------------------------------
In  this  section,  we  show first how DRIVER2 is applied to produce a set of 
data  (Section  2.1),  and  then how this set is used by DRIVER1 (Section 2.2 
below).  We assume that the associated executable files described in Appendix 
A  (namely  the files DRIVER2 and DRIVER1) have been produced already. We may 
skip  Section  2.1,  if  we decide to use the datafile XFWDAT included in the 
distribution material.

The  user  need not be restricted to the values given below, provided that he 
will  take  sufficient  care  when  assigning values to the parameters NX and 
KSECT  in  the programs DRIVER2 and DRIVER1, as well as when inputting values 
for the variables N and SIZE in DRIVER2, and KSECTN in DRIVER1.

2.1 PRODUCE THE DATAFILE XFWDAT BY DRIVER2
The  function  that  was  used  by  DRIVER2  and provided measurements for our 
example  is  f(x)=sin(pi*x),  x  in [0,4]. We let the parameter settings I1=1, 
NX=2000 in DRIVER2. Then we executed DRIVER2, which displayed the messages

     Data is going to be generated by adding random noise
     to measurements of the function SIN(pi*x), 0.0 <= x <= 4.0
and
     Just below, input number of data points N, where N <=  2000

We responded by typing the number 75, and the following message was displayed

     Just below, input magnitude of noise (eg. 0.25, 0.5, 1.0 etc.)

to  which  we  responded by typing the number 0.5, the number being  assigned  
to the variable SIZE. Then DRIVER2 added uniformly distributed random numbers 
from  [-SIZE,SIZE]  to  a  set  of equally spaced values of f(x) on [0,4] and 
assigned  a  unit  weight to each value. Then I1, N and the arrays X(.), F(.) 
and WF(.), in triads, were directed to the file XFWDAT,

    Datafile XFWDAT
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1   75
    0.0000000000E+00   -0.4999847412E+00    0.1000000000E+01
    0.1698158234E+00    0.2644383311E+00    0.1000000000E+01
    0.3396316469E+00    0.7652677298E+00    0.1000000000E+01
    ...                 ...                 ...
  See the DATA POINTS  See the MEASUREMENTS  See the DATA WEIGHTS
  column in table of   column in table of    column in table of 
  output below.        output below.         output below.
    ...                 ...                 ...
    0.1222674751E+02   -0.2609732747E-01    0.1000000000E+01
    0.1239656353E+02   -0.2904769182E+00    0.1000000000E+01
    0.1256637096E+02   -0.6848976761E-01    0.1000000000E+01
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and the following messages were displayed

     Data has been generated and kept in file "XFWDAT".
Stop - Program terminated.

2.2 APPLY DRIVER1 TO DATAFILE XFWDAT
We assume that the datafile XFWDAT is in the same directory with DRIVER1.EXE. 
Then  DRIVER1  (with parameters IX1=1, NX=2000, NX2=(NX-IX1+1)/2+1, KSECT=20, 
IORDER=0, MODEWF=0, IFILE=1), upon its execution, read values for I1, N, X, F 
and WF, and displayed the messages

     X-F-W data supply for smoothing from datafile "XFWDAT".
and
     Just below, input number of monotonic sections < 21

We responded to this message by typing the number 5 (which is assigned to the 
variable  KSECTN),  and,  L2WPMA  performed  the  smoothing  calculation  and  
terminated with the message

     ----------------------------------------
     RETURN FROM L2WPMA WITH MODE  =     1
     NUMBER OF DATA (F)            =    75
     NUMBER OF MONOTONIC SECTIONS  =     5
     NUMBER OF LOCAL MINIMA IN F   =    24
     NUMBER OF LOCAL MAXIMA IN F   =    24
     ----------------------------------------.

Next,  DRIVER1  directed I1, N and the hexatuple (I, X(I), F(I), WF(I), Y(I), 
PAR(I)), for I=I1,I1+1,...,N to the file WPMAPP,

Output file WPMAPP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1   75
    1  0.00000000  -0.49998474   1.00000000  -0.49998474
    2  0.16981582   0.26443833   1.00000000   0.26443833     0.00000000
    3  0.33963165   0.76526773   1.00000000   0.53056693     0.00000000
    4  0.50944746   0.29586616   1.00000000   0.53056693     0.46940160
       ...
    See in table of results below:
      Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)
       ...
   72 12.05693150  -0.27478614   1.00000000  -0.27478614     0.00000000
   73 12.22674751  -0.02609733   1.00000000  -0.15828712     0.00000000
   74 12.39656353  -0.29047692   1.00000000  -0.15828712     0.26437959
   75 12.56637096  -0.06848977   1.00000000  -0.06848977     0.00000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also, DRIVER1 directed the pairs of values (i, ITHETA(i)), for  i=I1-1,I1, 
...,KSECTN, to the file WIVAPP,

     Output file WIVAPP
     ~~~~~~~~~~~~~~~~~~
     0    1
     1    8
     2   27
     3   46
     4   69
     5   75
     ~~~~~~~~~~~~~~~~~~

Also, DRIVER1 directed the pairs of values (i, IAKN(i)), for  i=I1,...,NK, to 
the file WIAKN,

    Output file WIAKN
    ~~~~~~~~~~~~~~~~~
    1    1
    2    2
    3    3
    4    5
    5    7
    6    8
    7    9
    8   16
    9   17
   10   19
   11   20
   12   21
   13   25
   14   27
   15   28
   16   31
   17   33
   18   36
   19   37
   20   38
   21   39
   22   40
   23   41
   24   45
   25   46
   26   47
   27   48
   28   50
   29   52
   30   55
   31   59
   32   60
   33   61
   34   66
   35   68
   36   69
   37   70
   38   71
   39   72
   40   73
   41   75
   ~~~~~~~~~~~~~~~~~

Finally, DRIVER1 directed the triads of values (i, IACT(i), PAR(IACT(i)), for  
i=1,...,NACT, to the file WACTLG,

    Output file WACTLG
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1    4         0.4694015980E+00
    2    6         0.5050444603E+00
    3   10        -0.2179735899E+00
    4   11        -0.5456721783E-01
    5   12        -0.1980122328E+00
    6   13        -0.2555429935E+00
    7   14        -0.7342071533E+00
    8   15        -0.5451042652E+00
    9   18        -0.4110846519E+00
   10   22        -0.2571147084E+00
   11   23        -0.7316267490E+00
   12   24        -0.5911087394E+00
   13   26        -0.2120552063E+00
   14   29         0.2633345127E-01
   15   30         0.2338600159E+00
   16   32         0.2934423685E+00
   17   34         0.9840857983E-01
   18   35         0.1598882675E+00
   19   42         0.2097403407E+00
   20   43         0.1911538839E+00
   21   44         0.7423514128E-01
   22   49        -0.5188548565E+00
   23   51        -0.2096743584E+00
   24   53        -0.2329782248E+00
   25   54        -0.3145658970E+00
   26   56        -0.5096800625E-01
   27   57        -0.1006740332E+00
   28   58        -0.3853239715E+00
   29   62        -0.3332631588E+00
   30   63        -0.1602528095E+00
   31   64        -0.3799148798E+00
   32   65        -0.2195487022E+00
   33   67        -0.4324551821E+00
   34   74         0.2643795907E+00
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


and displayed the message

     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------

We  responded with a carriage return, due to a 'READ *' statement in DRIVER1, 
and  since  we  had  given the value 1 to the parameter IFILE in DRIVER1, the 
following tables of results were typed (output file RAPP_B)


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                8
                2               27
                3               46
                4               69
                5               75


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                4                  0.4694
                2                6                  0.5050
                3               10                 -0.2180
                4               11                 -0.0546
                5               12                 -0.1980
                6               13                 -0.2555
                7               14                 -0.7342
                8               15                 -0.5451
                9               18                 -0.4111
               10               22                 -0.2571
               11               23                 -0.7316
               12               24                 -0.5911
               13               26                 -0.2121
               14               29                  0.0263
               15               30                  0.2339
               16               32                  0.2934
               17               34                  0.0984
               18               35                  0.1599
               19               42                  0.2097
               20               43                  0.1912
               21               44                  0.0742
               22               49                 -0.5189
               23               51                 -0.2097
               24               53                 -0.2330
               25               54                 -0.3146
               26               56                 -0.0510
               27               57                 -0.1007
               28               58                 -0.3853
               29               62                 -0.3333
               30               63                 -0.1603
               31               64                 -0.3799
               32               65                 -0.2195
               33               67                 -0.4325
               34               74                  0.2644


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                5
                5                7
                6                8
                7                9
                8               16
                9               17
               10               19
               11               20
               12               21
               13               25
               14               27
               15               28
               16               31
               17               33
               18               36
               19               37
               20               38
               21               39
               22               40
               23               41
               24               45
               25               46
               26               47
               27               48
               28               50
               29               52
               30               55
               31               59
               32               60
               33               61
               34               66
               35               68
               36               69
               37               70
               38               71
               39               72
               40               73
               41               75


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  0.00000000  -0.49998474   1.00000000  -0.49998474
    2  0.16981582   0.26443833   1.00000000   0.26443833     0.00000000
    3  0.33963165   0.76526773   1.00000000   0.53056693     0.00000000
    4  0.50944746   0.29586616   1.00000000   0.53056693     0.46940160
    5  0.67926329   0.81495231   1.00000000   0.56243008     0.00000000
    6  0.84907913   0.30990785   1.00000000   0.56243008     0.50504446
    7  1.01889491   0.67592067   1.00000000   0.67592067     0.00000000
    8  1.18871069   1.42302132   1.00000000   1.42302132     0.00000000
    9  1.35852647   0.77383965   1.00000000   0.88282645     0.00000000
   10  1.52834225   0.96452963   1.00000000   0.88282645    -0.21797359
   11  1.69815803   0.81110394   1.00000000   0.88282645    -0.05456722
   12  1.86797380   0.85406107   1.00000000   0.88282645    -0.19801223
   13  2.03778958   0.64349437   1.00000000   0.88282645    -0.25554299
   14  2.20760536   0.97737789   1.00000000   0.88282645    -0.73420715
   15  2.37742114   1.15537858   1.00000000   0.88282645    -0.54510427
   16  2.54723692   0.56083721   1.00000000   0.56083721     0.00000000
   17  2.71705270   0.13335583   1.00000000   0.33889818     0.00000000
   18  2.88686848   0.54444051   1.00000000   0.33889818    -0.41108465
   19  3.05668426   0.13875470   1.00000000   0.13875470     0.00000000
   20  3.22650003  -0.04640606   1.00000000  -0.04640606     0.00000000
   21  3.39631581  -0.62116194   1.00000000  -0.49260452     0.00000000
   22  3.56613159  -0.72986054   1.00000000  -0.49260452    -0.25711471
   23  3.73594737  -0.42234552   1.00000000  -0.49260452    -0.73162675
   24  3.90576315  -0.19705015   1.00000000  -0.49260452    -0.59110874
   25  4.07557917  -1.15346658   1.00000000  -1.04743886     0.00000000
   26  4.24539518  -0.94141126   1.00000000  -1.04743886    -0.21205521
   27  4.41521120  -1.44482923   1.00000000  -1.44482923     0.00000000
   28  4.58502722  -0.88721591   1.00000000  -0.90038264     0.00000000
   29  4.75484324  -0.79661936   1.00000000  -0.90038264     0.02633345
   30  4.92465925  -1.01731253   1.00000000  -0.90038264     0.23386002
   31  5.09447527  -0.70590812   1.00000000  -0.85262930     0.00000000
   32  5.26429129  -0.99935043   1.00000000  -0.85262930     0.29344237
   33  5.43410730  -0.79215324   1.00000000  -0.84135753     0.00000000
   34  5.60392332  -0.81061769   1.00000000  -0.84135753     0.09840858
   35  5.77373934  -0.92130160   1.00000000  -0.84135753     0.15988827
   36  5.94355536  -0.36139026   1.00000000  -0.36139026     0.00000000
   37  6.11337137  -0.32846338   1.00000000  -0.32846338     0.00000000
   38  6.28318739  -0.11702699   1.00000000  -0.11702699     0.00000000
   39  6.45300341   0.26048851   1.00000000   0.26048851     0.00000000
   40  6.62281942   0.28090286   1.00000000   0.28090286     0.00000000
   41  6.79263544   0.50810623   1.00000000   0.40323606     0.00000000
   42  6.96245146   0.39394283   1.00000000   0.40323606     0.20974034
   43  7.13226748   0.34477669   1.00000000   0.40323606     0.19115388
   44  7.30208349   0.36611846   1.00000000   0.40323606     0.07423514
   45  7.47189951   0.84789491   1.00000000   0.84789491     0.00000000
   46  7.64171553   1.30279446   1.00000000   1.30279446     0.00000000
   47  7.81153154   1.12024808   1.00000000   1.12024808     0.00000000
   48  7.98134756   0.64851850   1.00000000   0.90794599     0.00000000
   49  8.15116310   1.16737342   1.00000000   0.90794599    -0.51885486
   50  8.32097912   0.56379461   1.00000000   0.66863179     0.00000000
   51  8.49079514   0.77346897   1.00000000   0.66863179    -0.20967436
   52  8.66061115   0.30015272   1.00000000   0.41664183     0.00000000
   53  8.83042717   0.37584800   1.00000000   0.41664183    -0.23297822
   54  9.00024319   0.57392478   1.00000000   0.41664183    -0.31456590
   55  9.17005920  -0.06206506   1.00000000  -0.03658105     0.00000000
   56  9.33987522  -0.06143407   1.00000000  -0.03658105    -0.05096801
   57  9.50969124  -0.17890602   1.00000000  -0.03658105    -0.10067403
   58  9.67950726   0.15608093   1.00000000  -0.03658105    -0.38532397
   59  9.84932327  -0.34440824   1.00000000  -0.34440824     0.00000000
   60 10.01913929  -0.43234563   1.00000000  -0.43234563     0.00000000
   61 10.18895531  -0.78878468   1.00000000  -0.62215328     0.00000000
   62 10.35877132  -0.53564811   1.00000000  -0.62215328    -0.33326316
   63 10.52858734  -0.73198432   1.00000000  -0.62215328    -0.16025281
   64 10.69840336  -0.54197019   1.00000000  -0.62215328    -0.37991488
   65 10.86821938  -0.51237893   1.00000000  -0.62215328    -0.21954870
   66 11.03803539  -1.14682889   1.00000000  -0.93060130     0.00000000
   67 11.20785141  -0.71437371   1.00000000  -0.93060130    -0.43245518
   68 11.37766743  -0.98006439   1.00000000  -0.98006439     0.00000000
   69 11.54748344  -1.29468524   1.00000000  -1.29468524     0.00000000
   70 11.71729946  -1.23147118   1.00000000  -1.23147118     0.00000000
   71 11.88711548  -0.70714092   1.00000000  -0.70714092     0.00000000
   72 12.05693150  -0.27478614   1.00000000  -0.27478614     0.00000000
   73 12.22674751  -0.02609733   1.00000000  -0.15828712     0.00000000
   74 12.39656353  -0.29047692   1.00000000  -0.15828712     0.26437959
   75 12.56637096  -0.06848977   1.00000000  -0.06848977     0.00000000

  Value of objective function at the optimum=    0.1217571378E+01
Stop - Program terminated.

Finally,  we responded with a carriage return, due to a 'READ *' statement in 
DRIVER1, in order to make the program terminate.

The  example  on  the  use  of  the  software package L2WPMA is complete. The 
computer output (namely files RAPP_B, WPMAPP, WIVAPP, WIAKN, WIACT) presented 
in this appendix is contained in the subdirectory AppndxB.

3. MORE EXAMPLES IN APPENDIX C
In  Appendix  C,  we apply L2WPMA to the data sets XFWDAT1, XFWDAT2, XFWDAT3, 
XFWDAT4,  XFWDAT_D,  XFWDAT_C,  XFWDAT_W,  XFWDAT_A  and XFWDAT_F and present 
relevant output.



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

APPENDIX C

DEMONSTRATING L2WPMA ON CERTAIN DATA SETS
=========================================

1. OVERVIEW
-----------
The  main  purpose of this appendix is to demonstrate the use of the software 
package  L2WPMA  on  certain data sets. We proceed as follows. First, we show 
the  trivial  cases diagnostics by subroutine TRIVIA and the several messages 
by subroutine MESSGW. Specifically, we employ the datafiles XFWDAT1, XFWDAT2, 
XFWDAT3  and  XFWDAT4  and  show the derivation of the files R1, R2, R3, R40, 
R41,...,  R49,  R415.  Secondly,  we employ the datafiles XFWDAT_D, XFWDAT_C, 
XFWDAT_W,  XFWDAT_A and XFWDAT_F in order to demonstrate the following cases: 
when  a  monotonic  section  in  an optimal piecewise monotonic approximation 
degenerates  to  a  single  component  (output  file  RD  and output files in 
subdirectory   <D>);   when   the  first  monotonic  section  of  an  optimal  
approximation  is decreasing (output file RC and output files in subdirectory 
<C>);  when  the  data  weights  are supplied by the user (output file RW and 
output  files  in  subdirectory  <W>);  when  the data weighting is automatic 
(there  are  three  cases  here:  output files RA_W2, RA_W3, RA_W4 and output 
files  in  subdirectories  <A_W2>,  <A_W3>,  <A_W4>); when only the data F is 
provided  (output  file  RF  and  output  files in subdirectory <F>). All the 
mentioned files are presented along with the demonstration process.

2. TRIVIAL CASES
----------------
This  section  shows  the  trivial cases diagnostics by subroutine TRIVIA. We 
consider  the  datafiles XFWDAT1, XFWDAT2 and XFWDAT3 that contain the values 
of I1, N and the values of (X,F,WF) in triads. We apply the subroutine L2WPMA 
and  obtain  the  output  files  R1,  R2 and R3 respectively by the following 
process.

We consider the datafile XFWDAT1 that contains only one data triad:

Datafile XFWDAT1
~~~~~~~~~~~~~~~~
1 1
1.0 2.1 1.0
~~~~~~~~~~~~~~~~

The  first  line  of  this  file  implies that I1=1, N=1, and the second line 
implies that X(1)=1.0, F(1)=2.1, WF(1)=1.0.

Copy file XFWDAT1 to file XFWDAT (XFWDAT is the default data filename used by 
DRIVER1. XFWDAT has to be in the directory where DRIVER1 is.).

Run DRIVER1 (with parameter IFILE=1). Then to the displayed messages

     X-F-W Data supply for smoothing from datafile  "XFWDAT" .
and
     Just below, input number of monotonic sections < 16

we  responded  by  typing  the  number  5  (which is assigned to the variable 
KSECTN).  Then  L2WPMA  performed the smoothing calculation and the output is 
contained in file R1 below. The associated output files WPMAPP, WIVAPP, WIAKN 
and WACTLG are included in the subdirectory DATA\1.

Output file R1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
5

     WARNING: 
      Required number of monotonic sections   =    5
      is greater than/equal to number of data =    1
      it is recommended: 1<= Number Monotonic Sections < Number of data


     There is only one data point, so data itself
      is the required approximation.
      Now number of monotonic sections is exactly 0.


     (Termination due to subroutine TRIVIA.)


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)



       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  2.09999990  1.00000000  2.09999990

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Next we consider the datafile XFWDAT2 that contains monotonic increasing data 
(8  triads),  we  follow the process described above and we derive the output 
file  R2.  The  associated  output files WPMAPP, WIVAPP, WIAKN and WACTLG are 
included in the subdirectory DATA\2.

Datafile XFWDAT2
~~~~~~~~~~~~~~~~
1 8
1 1.1 1.0
2 2.1 1.0
3 3.1 1.0
4 4.1 1.0
5 5.1 1.0
6 6.1 1.0
7 7.1 1.0
8 8.1 1.0
~~~~~~~~~~~~~~~

Here  we have I1=1, N=8, while X(i)=i, for i=1,2,...,8, F(1)=1.1,..., F(8)=8.1 
and WF(i)=1.0, for i=1,2,...,8.

Output file R2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
2

     Data itself is the required approximation.
      (Best monotonic increasing)
      Now number of monotonic sections is exactly 1.


     (Termination due to subroutine TRIVIA.)


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                8


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)



       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000   1.10000002   1.00000000   1.10000002
    2  2.00000000   2.09999990   1.00000000   2.09999990     0.00000000
    3  3.00000000   3.09999990   1.00000000   3.09999990     0.00000000
    4  4.00000000   4.09999990   1.00000000   4.09999990     0.00000000
    5  5.00000000   5.09999990   1.00000000   5.09999990     0.00000000
    6  6.00000000   6.09999990   1.00000000   6.09999990     0.00000000
    7  7.00000000   7.09999990   1.00000000   7.09999990     0.00000000
    8  8.00000000   8.10000038   1.00000000   8.10000038     0.00000000

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Finally,  we consider the datafile XFWDAT3 that contains monotonic decreasing 
data  (8  triads),  we  follow  the process described above and we derive the 
output  file R3. The associated output files WPMAPP, WIVAPP, WIAKN and WACTLG 
are  included  in  the  subdirectory  DATA\3.  Now,  the  number of monotonic 
sections  is  exactly 2, but the first section degenerates to a single point. 
Therefore we see in R3 below that the softare provides ITHETA(0)=ITHETA(1)=1.

Datafile XFWDAT3
~~~~~~~~~~~~~~~~
1 8
1 8.1 1.0
2 7.1 1.0
3 6.1 1.0
4 5.1 1.0
5 4.1 1.0
6 3.1 1.0
7 2.1 1.0
8 1.1 1.0
~~~~~~~~~~~~~~~~

Output file R3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
5

     Data itself is the requires approximation.
      (Best monotonic decreasing)
      Now number of monotonic sections is exactly 2
      but the first section degenerates to a single point.


     (Termination due to subroutine TRIVIA.)


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                1
                2                8


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)



       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000   8.10000038   1.00000000   8.10000038
    2  2.00000000   7.09999990   1.00000000   7.09999990     0.00000000
    3  3.00000000   6.09999990   1.00000000   6.09999990     0.00000000
    4  4.00000000   5.09999990   1.00000000   5.09999990     0.00000000
    5  5.00000000   4.09999990   1.00000000   4.09999990     0.00000000
    6  6.00000000   3.09999990   1.00000000   3.09999990     0.00000000
    7  7.00000000   2.09999990   1.00000000   2.09999990     0.00000000
    8  8.00000000   1.10000002   1.00000000   1.10000002     0.00000000

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


3. AN EXAMPLE WHEN THE MONOTONIC SECTIONS ARE 0,1,2,...,15
----------------------------------------------------------
We  consider the datafile XFWDAT4 that contains the values I1=1, N=14 and the 
14 data values presented at Section 5 of [1] in triads (X,F,WF):

datafile XFWDAT4
~~~~~~~~~~~~~~~~
1 14
1.0   -0.10  1.0
2.0    0.71  1.0
3.0    0.69  1.0
4.0    0.87  1.0
5.0   -1.00  1.0
6.0   -1.11  1.0
7.0    1.00  1.0
8.0    1.00  1.0
9.0   -1.00  1.0
10.0  -1.00  1.0
11.0   0.68  1.0
12.0   0.73  1.0
13.0   0.70  1.0
14.0   0.50  1.0
~~~~~~~~~~~~~~~~

We  copy  XFWDAT4  to  XFWDAT  and  we  apply repeatedly subroutine L2WPMA to 
XFWDAT,  via  the  driver  program  DRIVER1,  where  the  number of monotonic 
sections  is  allowed to take the values KSECTN=0,1,2,...,9,15. Eleven output 
files  are  derived  and  presented below, one file for each value of KSECTN, 
named   R40,   R41,   R42,...,   R49,   R415  correspondingly.  Also,  eleven  
subdirectories  include the associated output files WPMAPP, WIVAPP, WIAKN and 
WACTLG. For example subdirectory <41> includes the data files associated with 
KSECTN=1; <48> with KSECTN=8 etc. Each best approximation, contained in these 
files,  is  easy  to  be  found  by  hand  computation. We note that all best 
approximations  for  KSECTN=9,10,...,14  are  identical to that when KSECTN=8 
(which  is  presented  later  in  R48).  Table  2  in  [1]  presents the best 
approximations obtained by these calculations. 

To  derive  these  files  run  DRIVER1  (with parameter IFILE=1). Then to the 
displayed messages

     X-F-W Data supply for smoothing from datafile  "XFWDAT" .
and
     Just below, input number of monotonic sections < 16

we  responded  by  typing a number from 0 up to 15 (which was assigned to the 
variable  KSECTN) and, L2WPMA performed the smoothing calculation. The output 
files derived for the various values of KSECTN follow.

KSECTN=0
Output file R40
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
0

     Calculation incomplete because required 
      number of monotonic sections is less than one.
      It is recommended: 1<= Number Monotonic Sections < Number of data


     (Termination due to subroutine TRIVIA.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=1
Output file R41
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
1

     Best monotonic approximation:
      Required number of monotonic sections is exactly 1.


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     1
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  1.3844
                2                4                  2.7289
                3                5                  4.4333
                4                6                  2.3978
                5                7                  0.1422
                6                8                  2.1067
                7                9                  4.0711
                8               10                  2.0356
                9               12                  0.0550
               10               13                  0.2100
               11               14                  0.3050


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3               11
                4               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.01777778     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.01777778     1.38444436
    4  4.00000000   0.87000000   1.00000000   0.01777778     2.72888875
    5  5.00000000  -1.00000000   1.00000000   0.01777778     4.43333340
    6  6.00000000  -1.11000001   1.00000000   0.01777778     2.39777780
    7  7.00000000   1.00000000   1.00000000   0.01777778     0.14222221
    8  8.00000000   1.00000000   1.00000000   0.01777778     2.10666656
    9  9.00000000  -1.00000000   1.00000000   0.01777778     4.07111120
   10 10.00000000  -1.00000000   1.00000000   0.01777778     2.03555560
   11 11.00000000   0.68000001   1.00000000   0.65250003     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.65250003     0.05499995
   13 13.00000000   0.69999999   1.00000000   0.65250003     0.20999992
   14 14.00000000   0.50000000   1.00000000   0.65250003     0.30499983

  Value of objective function at the optimum=    0.7998630524E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=2
Output file R42
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
2

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     2
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     4
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                7
                2               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  1.3560
                2                4                  2.6720
                3                5                  4.3480
                4                6                  2.2840
                5               10                 -2.2033
                6               11                 -4.4067
                7               12                 -3.2500
                8               13                 -1.9933
                9               14                 -0.7967


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                7
                4                8
                5                9
                6               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.03199999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.03199999     1.35599995
    4  4.00000000   0.87000000   1.00000000   0.03199999     2.67199993
    5  5.00000000  -1.00000000   1.00000000   0.03199999     4.34800005
    6  6.00000000  -1.11000001   1.00000000   0.03199999     2.28400016
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000   0.10166669     0.00000000
   10 10.00000000  -1.00000000   1.00000000   0.10166669    -2.20333338
   11 11.00000000   0.68000001   1.00000000   0.10166669    -4.40666676
   12 12.00000000   0.73000002   1.00000000   0.10166669    -3.25000000
   13 13.00000000   0.69999999   1.00000000   0.10166669    -1.99333322
   14 14.00000000   0.50000000   1.00000000   0.10166669    -0.79666662

  Value of objective function at the optimum=    0.7637363434E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=3
Output file R43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
3

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     3
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                7
                2                9
                3               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  1.3560
                2                4                  2.6720
                3                5                  4.3480
                4                6                  2.2840
                5               12                  0.0550
                6               13                  0.2100
                7               14                  0.3050


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                7
                4                8
                5                9
                6               10
                7               11
                8               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.03199999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.03199999     1.35599995
    4  4.00000000   0.87000000   1.00000000   0.03199999     2.67199993
    5  5.00000000  -1.00000000   1.00000000   0.03199999     4.34800005
    6  6.00000000  -1.11000001   1.00000000   0.03199999     2.28400016
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.65250003     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.65250003     0.05499995
   13 13.00000000   0.69999999   1.00000000   0.65250003     0.20999992
   14 14.00000000   0.50000000   1.00000000   0.65250003     0.30499983

  Value of objective function at the optimum=    0.3996354818E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


KSECTN=4
Output file R44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
4

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     4
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     4
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                4
                2                6
                3                7
                4               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0200
                2               10                 -2.2033
                3               11                 -4.4067
                4               12                 -3.2500
                5               13                 -1.9933
                6               14                 -0.7967


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                4
                4                5
                5                6
                6                7
                7                8
                8                9
                9               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.69999999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69999999     0.01999998
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000   0.10166669     0.00000000
   10 10.00000000  -1.00000000   1.00000000   0.10166669    -2.20333338
   11 11.00000000   0.68000001   1.00000000   0.10166669    -4.40666676
   12 12.00000000   0.73000002   1.00000000   0.10166669    -3.25000000
   13 13.00000000   0.69999999   1.00000000   0.10166669    -1.99333322
   14 14.00000000   0.50000000   1.00000000   0.10166669    -0.79666662

  Value of objective function at the optimum=    0.3673483610E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


KSECTN=5
Output file R45
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
5

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     5
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                4
                2                6
                3                7
                4                9
                5               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0200
                2               12                  0.0550
                3               13                  0.2100
                4               14                  0.3050


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                4
                4                5
                5                6
                6                7
                7                8
                8                9
                9               10
               10               11
               11               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.69999999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69999999     0.01999998
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.65250003     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.65250003     0.05499995
   13 13.00000000   0.69999999   1.00000000   0.65250003     0.20999992
   14 14.00000000   0.50000000   1.00000000   0.65250003     0.30499983

  Value of objective function at the optimum=    0.3247499466E-01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=6
Output file R46
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
6

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     6
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     4
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                4
                2                6
                3                7
                4                9
                5               12
                6               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0200


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                4
                4                5
                5                6
                6                7
                7                8
                8                9
                9               10
               10               11
               11               12
               12               13
               13               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.69999999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69999999     0.01999998
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.68000001     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.73000002     0.00000000
   13 13.00000000   0.69999999   1.00000000   0.69999999     0.00000000
   14 14.00000000   0.50000000   1.00000000   0.50000000     0.00000000

  Value of objective function at the optimum=    0.1999996166E-03
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=7
Output file R47 (a monotonic section degenerates to a single component, which 
                 is noticed by ITHETA(6)=ITHETA(7)=14)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
7

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     7
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                4
                2                6
                3                7
                4                9
                5               12
                6               14
                7               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0200


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                4
                4                5
                5                6
                6                7
                7                8
                8                9
                9               10
               10               11
               11               12
               12               13
               13               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.69999999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69999999     0.01999998
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.68000001     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.73000002     0.00000000
   13 13.00000000   0.69999999   1.00000000   0.69999999     0.00000000
   14 14.00000000   0.50000000   1.00000000   0.50000000     0.00000000

  Value of objective function at the optimum=    0.1999996166E-03
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=8
Output file R48 (data is the required best approximation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
8

     Data itself is the best approximation, 
      because number or required monotonic sectns=    8
      is either equal to, or it exceeds number of,
      monotonic sections in data.


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     2
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     8
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     4
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                2
                2                3
                3                4
                4                6
                5                7
                6                9
                7               12
                8               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                4
                5                5
                6                6
                7                7
                8                8
                9                9
               10               10
               11               11
               12               12
               13               13
               14               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.70999998     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69000000     0.00000000
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.68000001     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.73000002     0.00000000
   13 13.00000000   0.69999999   1.00000000   0.69999999     0.00000000
   14 14.00000000   0.50000000   1.00000000   0.50000000     0.00000000

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

KSECTN=9
Output file R49 (This file presents the same best approximation as R48. The 
                 parameter KSECTN, initially equal to 9, is redefined by the 
                 software to 8, which is the number of monotonic sections of 
                 the data.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
9

     Data itself is the best approximation, 
      because number or required monotonic sectns=    9
      is either equal to, or it exceeds number of,
      monotonic sections in data.


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     2
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     8
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                2
                2                3
                3                4
                4                6
                5                7
                6                9
                7               12
                8               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                4
                5                5
                6                6
                7                7
                8                8
                9                9
               10               10
               11               11
               12               12
               13               13
               14               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.70999998     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69000000     0.00000000
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.68000001     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.73000002     0.00000000
   13 13.00000000   0.69999999   1.00000000   0.69999999     0.00000000
   14 14.00000000   0.50000000   1.00000000   0.50000000     0.00000000

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


KSECTN=15
Output file R415 (this file differs from R49 only in the "warning" comment)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
15

     WARNING: 
      Required number of monotonic sections   =   15
      is greater than/equal to number of data =   14
      it is recommended: 1<= Number Monotonic Sections < Number of data


     Data itself is the best approximation, 
      because number or required monotonic sectns=   15
      is either equal to, or it exceeds number of,
      monotonic sections in data.


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     2
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     8
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     5
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                2
                2                3
                3                4
                4                6
                5                7
                6                9
                7               12
                8               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))



            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                4
                5                5
                6                6
                7                7
                8                8
                9                9
               10               10
               11               11
               12               12
               13               13
               14               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.70999998     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69000000     0.00000000
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   10 10.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
   11 11.00000000   0.68000001   1.00000000   0.68000001     0.00000000
   12 12.00000000   0.73000002   1.00000000   0.73000002     0.00000000
   13 13.00000000   0.69999999   1.00000000   0.69999999     0.00000000
   14 14.00000000   0.50000000   1.00000000   0.50000000     0.00000000

  Value of objective function at the optimum=    0.0000000000E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4. AN EXAMPLE WHEN A MONOTONIC SECTION DEGENERATES TO A SINGLE COMPONENT
------------------------------------------------------------------------
We  present  an  example,  where  a  monotonic  section  of  a best piecewise 
monotonic approximation degenerates to a single component.

We  consider  the  datafile XFWDAT_D that contains the values I1=1, N=100 and 
100 data values in triads (X,F,WF):

Datafile XFWDAT_D
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1  100 
   -0.2500000000E+01    0.2066337109E+01    0.1000000000E+01
   -0.2454545498E+01    0.2839424372E+01    0.1000000000E+01
   -0.2409090996E+01    0.3338893414E+01    0.1000000000E+01
      ...                   ...                  ...
   See the DATA      See the MEASUREMENTS   See the DATA WEIGHTS 
   POINTS column     column in table of     column in table of
   in table of       output below.          output below.
   output below.         
      ...                   ...                  ...
    0.1909089208E+01   -0.1830021620E+01    0.1000000000E+01
    0.1954543710E+01   -0.2773060322E+01    0.1000000000E+01
    0.2000000000E+01   -0.2807628393E+01    0.1000000000E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We  apply DRIVER1 (with parameter IFILE=1) to this data by requiring KSECTN=7 
monotonic  sections  and  the  output file RD, below, is displayed. Also, the 
associated  output files WPMAPP, WIVAPP, WIAKN and WACTLG are included in the 
subdirectory DATA\D.

Output file RD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
7

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =   100
     NUMBER OF MONOTONIC SECTIONS =     7
     NUMBER OF LOCAL MINIMA IN F  =    31
     NUMBER OF LOCAL MAXIMA IN F  =    31
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                8
                2               50
                3               64
                4               78
                5               89
                6              100
                7              100


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                4                  0.5455
                2                5                  0.1175
                3                6                  0.6510
                4                7                  0.0487
                5               10                 -0.0297
                6               14                 -0.2209
                7               15                 -0.1283
                8               18                 -0.4717
                9               19                 -0.2465
               10               20                 -0.8704
               11               21                 -1.8102
               12               22                 -3.7524
               13               23                 -5.6772
               14               24                 -6.6737
               15               25                 -6.8422
               16               26                 -8.4998
               17               27                 -9.2850
               18               28                -10.6275
               19               29                -10.4292
               20               30                 -9.6729
               21               31                 -9.0537
               22               32                 -7.6013
               23               33                 -6.6369
               24               34                 -5.2840
               25               35                 -4.1268
               26               36                 -3.4843
               27               37                 -2.1462
               28               38                 -1.2871
               29               39                 -0.6545
               30               45                 -0.3485
               31               46                 -0.3689
               32               49                 -0.4789
               33               52                  0.2885
               34               55                  0.3078
               35               59                  0.1949
               36               61                  0.1518
               37               63                  0.1317
               38               67                 -0.2003
               39               71                 -0.2003
               40               72                 -0.1360
               41               77                 -0.1506
               42               80                  0.3286
               43               81                  0.3999
               44               84                  0.2758
               45               87                  0.0224
               46               94                 -0.0366
               47               97                 -0.0076


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                8
                5                9
                6               11
                7               12
                8               13
                9               16
               10               17
               11               40
               12               41
               13               42
               14               43
               15               44
               16               47
               17               48
               18               50
               19               51
               20               53
               21               54
               22               56
               23               57
               24               58
               25               60
               26               62
               27               64
               28               65
               29               66
               30               68
               31               69
               32               70
               33               73
               34               74
               35               75
               36               76
               37               78
               38               79
               39               82
               40               83
               41               85
               42               86
               43               88
               44               89
               45               90
               46               91
               47               92
               48               93
               49               95
               50               96
               51               98
               52               99
               53              100


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1 -2.50000000   2.06633711   1.00000000   2.06633711
    2 -2.45454550   2.83942437   1.00000000   2.83942437     0.00000000
    3 -2.40909100   3.33889341   1.00000000   3.06612945     0.00000000
    4 -2.36363649   2.85211968   1.00000000   3.06612945     0.54552794
    5 -2.31818199   3.33287454   1.00000000   3.06612945     0.11750841
    6 -2.27272749   2.76498914   1.00000000   3.06612945     0.65099859
    7 -2.22727299   3.04176998   1.00000000   3.06612945     0.04871798
    8 -2.18181849   3.67321372   1.00000000   3.67321372     0.00000000
    9 -2.13636398   2.88383007   1.00000000   2.89867544     0.00000000
   10 -2.09090948   2.91352057   1.00000000   2.89867544    -0.02969027
   11 -2.04545498   2.58375192   1.00000000   2.58375192     0.00000000
   12 -2.00000048   2.44191790   1.00000000   2.44191790     0.00000000
   13 -1.95454597   2.04608750   1.00000000   2.15654373     0.00000000
   14 -1.90909147   2.20285869   1.00000000   2.15654373    -0.22091246
   15 -1.86363697   2.22068501   1.00000000   2.15654373    -0.12828255
   16 -1.81818247   1.49134696   1.00000000   1.49134696     0.00000000
   17 -1.77272797   0.96203202   1.00000000   1.19789231     0.00000000
   18 -1.72727346   1.31050181   1.00000000   1.19789231    -0.47172093
   19 -1.68181896   0.88592643   1.00000000   1.19789231    -0.24650192
   20 -1.63636446   0.72802395   1.00000000   1.19789231    -0.87043369
   21 -1.59090996   0.22677830   1.00000000   1.19789231    -1.81017041
   22 -1.54545546   0.23551187   1.00000000   1.19789231    -3.75239849
   23 -1.50000095   0.69962806   1.00000000   1.19789231    -5.67715931
   24 -1.45454645   1.11365747   1.00000000   1.19789231    -6.67368793
   25 -1.40909195   0.36905393   1.00000000   1.19789231    -6.84215736
   26 -1.36363745   0.80530918   1.00000000   1.19789231    -8.49983406
   27 -1.31818295   0.52662486   1.00000000   1.19789231    -9.28500080
   28 -1.27272844   1.29704285   1.00000000   1.19789231   -10.62753582
   29 -1.22727394   1.57604229   1.00000000   1.19789231   -10.42923450
   30 -1.18181944   1.50748599   1.00000000   1.19789231    -9.67293453
   31 -1.13636494   1.92411041   1.00000000   1.19789231    -9.05374718
   32 -1.09091043   1.68009686   1.00000000   1.19789231    -7.60131073
   33 -1.04545593   1.87432086   1.00000000   1.19789231    -6.63690138
   34 -1.00000143   1.77652502   1.00000000   1.19789231    -5.28404427
   35 -0.95454687   1.51911855   1.00000000   1.19789231    -4.12677860
   36 -0.90909231   1.86694026   1.00000000   1.19789231    -3.48432612
   37 -0.86363775   1.62747741   1.00000000   1.19789231    -2.14623022
   38 -0.81818318   1.51417577   1.00000000   1.19789231    -1.28706002
   39 -0.77272862   1.52513885   1.00000000   1.19789231    -0.65449309
   40 -0.72727406   1.14987075   1.00000000   1.14987075     0.00000000
   41 -0.68181950   0.96655428   1.00000000   0.96655428     0.00000000
   42 -0.63636494   0.44230670   1.00000000   0.44230670     0.00000000
   43 -0.59091038  -0.00093934   1.00000000  -0.00093934     0.00000000
   44 -0.54545581  -0.34251827   1.00000000  -0.16826242     0.00000000
   45 -0.50000125  -0.17846130   1.00000000  -0.16826242    -0.34851167
   46 -0.45454669   0.01619229   1.00000000  -0.16826242    -0.36890942
   47 -0.40909213  -0.35920507   1.00000000  -0.35920507     0.00000000
   48 -0.36363757  -0.94929832   1.00000000  -0.70985258     0.00000000
   49 -0.31818300  -0.47040689   1.00000000  -0.70985258    -0.47889137
   50 -0.27272844  -1.03502131   1.00000000  -1.03502131     0.00000000
   51 -0.22727390  -0.71036321   1.00000000  -0.85463798     0.00000000
   52 -0.18181935  -0.99891269   1.00000000  -0.85463798     0.28854954
   53 -0.13636480  -0.67796850   1.00000000  -0.67796850     0.00000000
   54 -0.09091026  -0.18612105   1.00000000  -0.34001526     0.00000000
   55 -0.04545571  -0.49390948   1.00000000  -0.34001526     0.30778843
   56 -0.00000116  -0.14623949   1.00000000  -0.14623949     0.00000000
   57  0.04545338   0.08576743   1.00000000   0.08576743     0.00000000
   58  0.09090793   0.75620520   1.00000000   0.65877116     0.00000000
   59  0.13636248   0.56133705   1.00000000   0.65877116     0.19486809
   60  0.18181702   0.73475897   1.00000000   0.65887630     0.00000000
   61  0.22727157   0.58299357   1.00000000   0.65887630     0.15176535
   62  0.27272612   0.97424448   1.00000000   0.90840310     0.00000000
   63  0.31818068   0.84256172   1.00000000   0.90840310     0.13168275
   64  0.36363524   1.02012062   1.00000000   1.02012062     0.00000000
   65  0.40908980   0.95988411   1.00000000   0.95988411     0.00000000
   66  0.45454437   0.16132572   1.00000000   0.26149160     0.00000000
   67  0.49999893   0.36165747   1.00000000   0.26149160    -0.20033175
   68  0.54545349  -0.19505939   1.00000000  -0.19505939     0.00000000
   69  0.59090805  -0.84810472   1.00000000  -0.84810472     0.00000000
   70  0.63636261  -1.15737629   1.00000000  -1.05721045     0.00000000
   71  0.68181717  -1.02505910   1.00000000  -1.05721045    -0.20033157
   72  0.72727174  -0.98919600   1.00000000  -1.05721045    -0.13602889
   73  0.77272630  -1.12660789   1.00000000  -1.12660789     0.00000000
   74  0.81818086  -1.75268054   1.00000000  -1.75268054     0.00000000
   75  0.86363542  -1.85542512   1.00000000  -1.85542512     0.00000000
   76  0.90908998  -1.95139456   1.00000000  -1.87608898     0.00000000
   77  0.95454454  -1.80078340   1.00000000  -1.87608898    -0.15061116
   78  0.99999911  -2.16933894   1.00000000  -2.16933894     0.00000000
   79  1.04545367  -1.57443857   1.00000000  -1.73872161     0.00000000
   80  1.09090817  -1.70303655   1.00000000  -1.73872161     0.32856607
   81  1.13636267  -1.93868983   1.00000000  -1.73872161     0.39993620
   82  1.18181717  -1.18545246   1.00000000  -1.18545246     0.00000000
   83  1.22727168  -0.92606264   1.00000000  -1.06394148     0.00000000
   84  1.27272618  -1.20182025   1.00000000  -1.06394148     0.27575767
   85  1.31818068  -0.95185661   1.00000000  -0.95185661     0.00000000
   86  1.36363518  -0.89929700   1.00000000  -0.91051173     0.00000000
   87  1.40908968  -0.92172641   1.00000000  -0.91051173     0.02242947
   88  1.45454419  -0.59361863   1.00000000  -0.59361863     0.00000000
   89  1.49999869  -0.33821982   1.00000000  -0.33821982     0.00000000
   90  1.54545319  -0.37636709   1.00000000  -0.37636709     0.00000000
   91  1.59090769  -0.40980679   1.00000000  -0.40980679     0.00000000
   92  1.63636220  -0.72653794   1.00000000  -0.72653794     0.00000000
   93  1.68181670  -1.16563129   1.00000000  -1.14735413     0.00000000
   94  1.72727120  -1.12907696   1.00000000  -1.14735413    -0.03655434
   95  1.77272570  -1.57816422   1.00000000  -1.57816422     0.00000000
   96  1.81818020  -1.70177114   1.00000000  -1.69799554     0.00000000
   97  1.86363471  -1.69421995   1.00000000  -1.69799554    -0.00755119
   98  1.90908921  -1.83002162   1.00000000  -1.83002162     0.00000000
   99  1.95454371  -2.77306032   1.00000000  -2.77306032     0.00000000
  100  2.00000000  -2.80762839   1.00000000  -2.80762839     0.00000000

  Value of objective function at the optimum=    0.7309332371E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We  see  that  the sixth and seventh turning point index (cf. the "Indices of 
Extrema at Optimum" in output file RD) coincide. Thus, the best approximation 
consists of only six monotonic sections, although we required seven.


5. AN EXAMPLE WHEN THE FIRST MONOTONIC SECTION IS DECREASING
------------------------------------------------------------
To  obtain  a  best  piecewise  monotonic approximation whose first monotonic 
section  is  decreasing,  we  let  IORDER=-1  in  the  parameter  settings of 
DRIVER1.F.  It  is  worth  noting  that in order to obtain the best monotonic 
decreasing  approximation,  it  suffices  to  apply  L2WPMA with KSECTN=1 and 
IORDER=-1.  With  the  option  IORDER=-1 we are going to apply DRIVER1 to the 
data contained in the file XFWDAT_C. 

File  XFWDAT_C  contains  I1=1, N=40 and 40 data values in triads (X,F,WF) as 
follows:

Datafile XFWDAT_C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 40
1.57079637        -0.4999847710E+00       0.1000000000E+01
1.81245732        -0.1438781619E+00       0.1000000000E+01
2.05411839        -0.3259539604E-01       0.1000000000E+01
   ...                   ...                  ...
See the DATA     See the MEASUREMENTS     See the DATA WEIGHTS 
POINTS column    column in table of       column in table of
in table of      output below.            output below.
output below.         
   ...                   ...                  ...
10.51225567       -0.5817493200E+00       0.1000000000E+01
10.75391674       -0.1478268951E+00       0.1000000000E+01
10.99557495       -0.5223860592E-01       0.1000000000E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We  copied file XFWDAT_C to file XFWDAT (we remind that XFWDAT is the default 
data filename used by DRIVER1).

We run DRIVER1 (with parameter IFILE=1). Then to the displayed messages

     X-F-W DATA SUPPLY FOR SMOOTHING FROM DATAFILE "XFWDAT" .
and
     JUST BELOW, INPUT NUMBER OF MONOTONIC SECTIONS < 16

we  responded  by  typing  the  number  4 (which was assigned to the variable 
KSECTN).  Then  L2WPMA  performed the smoothing calculation and the output is 
contained in file RC below. Also, the associated output files WPMAPP, WIVAPP, 
WIAKN and WACTLG are included in the subdirectory DATA\C:

Output file RC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
4

     (First monotonic section is required to be decreasing.)


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    40
     NUMBER OF MONOTONIC SECTIONS =     4
     NUMBER OF LOCAL MINIMA IN F  =    13
     NUMBER OF LOCAL MAXIMA IN F  =    12
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                6
                2               18
                3               35
                4               40


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                2                 -0.5490
                2                3                 -0.3858
                3                5                 -0.2187
                4                9                  0.6737
                5               10                  0.0652
                6               11                  0.0189
                7               16                  0.3702
                8               17                  0.2661
                9               20                 -0.0421
               10               22                 -0.4326
               11               23                 -0.8780
               12               24                 -0.6364
               13               26                 -0.0756
               14               28                 -0.3870
               15               29                 -0.0659
               16               31                 -0.1019
               17               33                 -0.0486


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                4
                3                6
                4                7
                5                8
                6               12
                7               13
                8               14
                9               15
               10               18
               11               19
               12               21
               13               25
               14               27
               15               30
               16               32
               17               34
               18               35
               19               36
               20               37
               21               38
               22               39
               23               40


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1   1.57079637  -0.49998477   1.00000000  -0.22548611
    2   1.81245732  -0.14387816   1.00000000  -0.22548611    -0.54899728
    3   2.05411839  -0.03259540   1.00000000  -0.22548611    -0.38578138
    4   2.29577947  -0.85495162   1.00000000  -0.74560165     0.00000000
    5   2.53744054  -0.63625175   1.00000000  -0.74560165    -0.21869993
    6   2.77910161  -1.37578082   1.00000000  -1.37578082     0.00000000
    7   3.02076268  -1.16831732   1.00000000  -1.16831732     0.00000000
    8   3.26242375  -0.49757642   1.00000000  -0.83444482     0.00000000
    9   3.50408483  -1.13873148   1.00000000  -0.83444482     0.67373657
   10   3.74574590  -0.85755271   1.00000000  -0.83444482     0.06516325
   11   3.98740697  -0.84391856   1.00000000  -0.83444482     0.01894748
   12   4.22906780  -0.56682825   1.00000000  -0.56682825     0.00000000
   13   4.47072887  -0.48874643   1.00000000  -0.48874643     0.00000000
   14   4.71238995   0.17338158   1.00000000   0.17338158     0.00000000
   15   4.95405102   0.70275611   1.00000000   0.51764011     0.00000000
   16   5.19571209   0.46558633   1.00000000   0.51764011     0.37023216
   17   5.43737316   0.38457781   1.00000000   0.51764011     0.26612461
   18   5.67903423   1.11544669   1.00000000   1.11544669     0.00000000
   19   5.92069530   0.98896503   1.00000000   1.01003671     0.00000000
   20   6.16235638   1.03110838   1.00000000   1.01003671    -0.04214334
   21   6.40401745   0.62352431   1.00000000   0.83980024     0.00000000
   22   6.64567852   0.61705577   1.00000000   0.83980024    -0.43255186
   23   6.88733959   0.96061152   1.00000000   0.83980024    -0.87804079
   24   7.12900066   1.15800953   1.00000000   0.83980024    -0.63641822
   25   7.37066174   0.11525160   1.00000000   0.15303981     0.00000000
   26   7.61232281   0.19082803   1.00000000   0.15303981    -0.07557642
   27   7.85398388  -0.48866478   1.00000000  -0.29518130     0.00000000
   28   8.09564495  -0.13463341   1.00000000  -0.29518130    -0.38696694
   29   8.33730602  -0.26224574   1.00000000  -0.29518130    -0.06587115
   30   8.57896709  -0.70288193   1.00000000  -0.65194333     0.00000000
   31   8.82062817  -0.60100472   1.00000000  -0.65194333    -0.10187721
   32   9.06228924  -1.08283901   1.00000000  -1.05851495     0.00000000
   33   9.30395031  -1.03419089   1.00000000  -1.05851495    -0.04864812
   34   9.54561138  -1.17510724   1.00000000  -1.17510724     0.00000000
   35   9.78727245  -1.36862314   1.00000000  -1.36862314     0.00000000
   36  10.02893353  -0.85123414   1.00000000  -0.85123414     0.00000000
   37  10.27059460  -0.82258469   1.00000000  -0.82258469     0.00000000
   38  10.51225567  -0.58174932   1.00000000  -0.58174932     0.00000000
   39  10.75391674  -0.14782690   1.00000000  -0.14782690     0.00000000
   40  10.99557495  -0.05223861   1.00000000  -0.05223861     0.00000000

  Value of objective function at the optimum=    0.6911643744E+00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


6. AN EXAMPLE OF WEIGHTING CERTAIN DATA POINTS
----------------------------------------------
This  section  gives  an  example of weighting certain data points, where the 
weights  are  supplied  by  the user. In this case, in order to obtain a best 
piecewise  monotonic approximation, we let MODEWF=0 in the parameter settings 
of DRIVER1.F. 

We  consider the datafile XFWDAT_W that contains the values I1=1, N=75 and 75 
data  values  in  triads  (X,F,WF), where the weights WF(i) are set to unity, 
except  that  WF(19)=0.01,  WF(20)=1.1, WF(21)=1.01, WF(22)=1.6, WF(23)=1.01, 
WF(24)=1.7, WF(25)=0.01, WF(i)=0.0001, i=56,57,58.

Datafile XFWDAT_W
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1    75
0              -0.4984740913  1
0.08490791172  0.2070840895   1
0.1698158234   0.2497286946   1
0.2547237277   0.4025464952   1
0.3396316469   0.5528773069   1
0.424539566    0.7999916077   1
0.5094474554   0.7558646202   1
0.5943553448   0.1115960479   1
0.6792632341   0.7819774747   1
0.7641711235   1.190565586    1
0.8490790129   0.5080308914   1
0.9339869022   0.9061027765   1
1.018894792    1.13950491     1
1.103802681    1.018682957    1
1.18871057     0.5855756998   1
1.27361846     1.055037498    1
1.358526349    0.8343111277   1
1.443434238    1.183271408    1
1.528342128    1.327633381    0.01
1.613250017    1.08789885     1.1
1.698157907    1.336395741    0.01
1.783065796    0.8448857069   1.6
1.867973685    1.335422158    0.01
1.952881575    0.796653986    1.7
2.037789583    1.378475666    0.01
2.122697592    0.42704615     1
2.2076056      0.4732196927   1
2.292513609    1.23632884     1
2.377421618    0.956232667    1
2.462329626    0.6160354614   1
2.547237635    0.8678176403   1
2.632145643    0.7240186334   1
2.717053652    0.3270072043   1
2.80196166     0.3592244983   1
2.886869669    -0.09357082844 1
2.971777678    -0.1633491367  1
3.056685686    0.007174707949 1
3.141593695    -0.1377976537  1
3.226501703    0.2336563766   1
3.311409712    -0.5924780369  1
3.39631772     -0.2315246463  1
3.481225729    -0.4150897264  1
3.566133738    -0.252682358   1
3.651041746    -0.4778771698  1
3.735949755    -0.3662400246  1
3.820857763    -0.7627221346  1
3.905765772    -0.4058259726  1
3.99067378     -0.4862729311  1
4.075581551    -1.127420902   1
4.160489559    -1.22510922    1
4.245397568    -0.8344160914  1
4.330305576    -1.040753126   1
4.415213585    -1.002791405   1
4.500121593    -0.6048465371  1
4.585029602    -0.9061068892  1
4.669937611    -1.324184895   0.0001
4.754845619    -1.240611076   0.0001
4.839753628    -1.465700388   0.0001
4.924661636    -0.7502180934  1
5.009569645    -1.281556845   1
5.094477654    -0.8515850902  1
5.179385662    -1.134116173   1
5.264293671    -1.259027243   1
5.349201679    -0.6208944917  1
5.434109688    -0.6094859242  1
5.519017696    -0.6995429397  1
5.603925705    -1.087536573   1
5.688833714    -0.8127297163  1
5.773741722    -0.05017724633 1
5.858649731    -0.0130649507  1
5.943557739    -0.6518893242  1
6.028465748    -0.08803871274 1
6.113373756    -0.4693475962  1
6.198281765    0.3151907921   1
6.283185482    -0.1264284551  1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We  are  going  to  apply  DRIVER1 to the data contained in file XFWDAT_W, by 
requiring  3  monotonic  sections. As usually, we copy XFWDAT_W to XFWDAT and 
upon  calling  DRIVER1  we  obtain  the  best  weighted  piecewise  monotonic  
approximation displayed in the fifth column of the following table. Note that 
the  second,  third  and  fourth  column  of  this  table present X, F and WF 
respectively.  In  order  to compare the effect of data weighting on the best 
approximation, we present in the sixth column the best approximation with all 
the  weights  set  to unity (parameter MODEWF=1 in DRIVER1). One may see that 
weighting  certain  data  points affects only locally the best approximation. 
Further,  we  include in the subdirectory DATA\W the screen output RW and the 
associated output files WPMAPP, WIVAPP, WIAKN and WACTLG.


TABLE  1   Best  weighted  piecewise  monotonic  approximation  (Y)  with  
KSECTN=3 to the data of file XFWDAT_W (parameter MODEWF=0 in DRIVER1) and 
best approximation (Y with w=1) to the same data when the weights are set 
to unity (parameter MODEWF=1 in DRIVER1).
=========================================================================
     X              F              WF      Y                Y with w=1
-------------------------------------------------------------------------
1    0              -0.4984740913  1       -0.4984740913    -0.4984740913
2    0.08490791172  0.2070840895   1       0.2070840895     0.2070840895
3    0.1698158234   0.2497286946   1       0.2497286946     0.2497286946
4    0.2547237277   0.4025464952   1       0.4025464952     0.4025464952
5    0.3396316469   0.5528773069   1       0.5528773069     0.5528773069
6    0.424539566    0.7999916077   1       0.5558174253     0.5558174253
7    0.5094474554   0.7558646202   1       0.5558174253     0.5558174253
8    0.5943553448   0.1115960479   1       0.5558174253     0.5558174253
9    0.6792632341   0.7819774747   1       0.7819774747     0.7819774747
10   0.7641711235   1.190565586    1       0.8492982388     0.8492982388
11   0.8490790129   0.5080308914   1       0.8492982388     0.8492982388
12   0.9339869022   0.9061027765   1       0.9061027765     0.9061027765
13   1.018894792    1.13950491     1       0.9145878553     0.9145878553
14   1.103802681    1.018682957    1       0.9145878553     0.9145878553
15   1.18871057     0.5855756998   1       0.9145878553     0.9145878553
16   1.27361846     1.055037498    1       0.9446743131     0.9446743131
17   1.358526349    0.8343111277   1       0.9446743131     0.9446743131
18   1.443434238    1.183271408    1       1.183271408      1.183271408
19   1.528342128    1.327633381    0.01    1.327633381      1.207766056
20   1.613250017    1.08789885     1.10    1.090137601      1.207766056
21   1.698157907    1.336395741    0.01    1.090137601      1.336395741
22   1.783065796    0.8448857069   1.60    0.8479325175     1.090153933
23   1.867973685    1.335422158    0.01    0.8479325175     1.090153933
24   1.952881575    0.796653986    1.70    0.8000564575     1.087564826
25   2.037789583    1.378475666    0.01    0.8000564575     1.087564826
26   2.122697592    0.42704615     1       0.77320683       0.77320683
27   2.2076056      0.4732196927   1       0.77320683       0.77320683
28   2.292513609    1.23632884     1       0.77320683       0.77320683
29   2.377421618    0.956232667    1       0.77320683       0.77320683
30   2.462329626    0.6160354614   1       0.7419265509     0.7419265509
31   2.547237635    0.8678176403   1       0.7419265509     0.7419265509
32   2.632145643    0.7240186334   1       0.7240186334     0.7240186334
33   2.717053652    0.3270072043   1       0.3431158662     0.3431158662
34   2.80196166     0.3592244983   1       0.3431158662     0.3431158662
35   2.886869669    -0.09357082844 1       -0.03077730723   -0.03077730723
36   2.971777678    -0.1633491367  1       -0.03077730723   -0.03077730723
37   3.056685686    0.007174707949 1       -0.03077730723   -0.03077730723
38   3.141593695    -0.1377976537  1       -0.03077730723   -0.03077730723
39   3.226501703    0.2336563766   1       -0.03077730723   -0.03077730723
40   3.311409712    -0.5924780369  1       -0.3729436994    -0.3729436994
41   3.39631772     -0.2315246463  1       -0.3729436994    -0.3729436994
42   3.481225729    -0.4150897264  1       -0.3729436994    -0.3729436994
43   3.566133738    -0.252682358   1       -0.3729436994    -0.3729436994
44   3.651041746    -0.4778771698  1       -0.4220585823    -0.4220585823
45   3.735949755    -0.3662400246  1       -0.4220585823    -0.4220585823
46   3.820857763    -0.7627221346  1       -0.5516070127    -0.5516070127
47   3.905765772    -0.4058259726  1       -0.5516070127    -0.5516070127
48   3.99067378     -0.4862729311  1       -0.5516070127    -0.5516070127
49   4.075581551    -1.127420902   1       -0.936473012     -0.9630634785
50   4.160489559    -1.22510922    1       -0.936473012     -0.9630634785
51   4.245397568    -0.8344160914  1       -0.936473012     -0.9630634785
52   4.330305576    -1.040753126   1       -0.936473012     -0.9630634785
53   4.415213585    -1.002791405   1       -0.936473012     -0.9630634785
54   4.500121593    -0.6048465371  1       -0.936473012     -0.9630634785
55   4.585029602    -0.9061068892  1       -0.936473012     -0.9630634785
56   4.669937611    -1.324184895   0.0001  -0.936473012     -1.282397985
57   4.754845619    -1.240611076   0.0001  -0.936473012     -1.282397985
58   4.839753628    -1.465700388   0.0001  -0.936473012     -1.465700388
59   4.924661636    -0.7502180934  1       -0.936473012     -1.055300713
60   5.009569645    -1.281556845   1       -1.281556845     -1.055300713
61   5.094477654    -0.8515850902  1       -1.081576228     -1.055300713
62   5.179385662    -1.134116173   1       -1.081576228     -1.055300713
63   5.264293671    -1.259027243   1       -1.081576228     -1.055300713
64   5.349201679    -0.6208944917  1       -0.766037941     -0.766037941
65   5.434109688    -0.6094859242  1       -0.766037941     -0.766037941
66   5.519017696    -0.6995429397  1       -0.766037941     -0.766037941
67   5.603925705    -1.087536573   1       -0.766037941     -0.766037941
68   5.688833714    -0.8127297163  1       -0.766037941     -0.766037941
69   5.773741722    -0.05017724633 1       -0.2545035779    -0.2545035779
70   5.858649731    -0.0130649507  1       -0.2545035779    -0.2545035779
71   5.943557739    -0.6518893242  1       -0.2545035779    -0.2545035779
72   6.028465748    -0.08803871274 1       -0.2545035779    -0.2545035779
73   6.113373756    -0.4693475962  1       -0.2545035779    -0.2545035779
74   6.198281765    0.3151907921   1       0.09438116848    0.09438116848
75   6.283185482    -0.1264284551  1       0.09438116848    0.09438116848
===========================================================================


7. EXAMPLES WITH AUTOMATIC WEIGHTING
------------------------------------
7.1 INTRODUCTION
This  section  gives three examples, each in a separate subsection, where the 
weights  are  calculated automatically by the software package. Specifically, 
each  of  the  options  MODEWF=2,3,4  in  the parameter settings of DRIVER1.F 
allows  the  automatic  generation  of  weights  that depend on the abscissae 
spacing. 

We  consider  the datafile XFWDAT_A that contains I1=1, N=100 and 100 data in 
triads  (X,F,WF)  in  increasing  order  of X. The measurements, F, have been 
generated  by  adding  random  numbers uniformly distributed in (-0.5,0.5) to 
sin(pi*X), where X had allowed to take random values uniformly distributed in 
(0,2.5). The weights, WF, are set initially to unity. 

Datafile XFWDAT_A
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1  100
    0.4196166992E-03   -0.4986664653E+00    0.1000000000E+01
    0.1632712781E-01    0.1467082202E+00    0.1000000000E+01
    0.5256734788E-01    0.5965234637E+00    0.1000000000E+01
    0.5687803030E-01   -0.1409056783E-01    0.1000000000E+01
    0.1055543125E+00    0.5122967958E+00    0.1000000000E+01
    0.1057450473E+00   -0.1146335304E+00    0.1000000000E+01
    0.1119630784E+00    0.1689255834E+00    0.1000000000E+01
    0.1129167527E+00    0.8424775004E+00    0.1000000000E+01
    0.1235599071E+00    0.1747841835E+00    0.1000000000E+01
    0.1585030556E+00    0.4430579543E+00    0.1000000000E+01
    0.2421225607E+00    0.5085961819E+00    0.1000000000E+01
    0.2793545127E+00    0.6671133637E+00    0.1000000000E+01
    0.2803082764E+00    0.5216986537E+00    0.1000000000E+01
    0.3435568511E+00    0.1055015683E+01    0.1000000000E+01
    0.3471809030E+00    0.1350390315E+01    0.1000000000E+01
    0.3857480884E+00    0.9371343255E+00    0.1000000000E+01
    0.4385824502E+00    0.7028972507E+00    0.1000000000E+01
    0.4391928017E+00    0.1274271011E+01    0.1000000000E+01
    0.4428930581E+00    0.1037898064E+01    0.1000000000E+01
    0.4657053947E+00    0.1032601118E+01    0.1000000000E+01
    0.5043107271E+00    0.6307239532E+00    0.1000000000E+01
    0.5150682926E+00    0.6809198856E+00    0.1000000000E+01
    0.5184633732E+00    0.1135946989E+01    0.1000000000E+01
    0.5189974308E+00    0.1293107796E+01    0.1000000000E+01
    0.6518272161E+00    0.5389159918E+00    0.1000000000E+01
    0.7616922259E+00    0.6321765184E+00    0.1000000000E+01
    0.7931638956E+00    0.1163604259E+00    0.1000000000E+01
    0.7955291271E+00    0.7037745714E+00    0.1000000000E+01
    0.8163958192E+00    0.7478320599E+00    0.1000000000E+01
    0.8190280199E+00    0.4986451268E+00    0.1000000000E+01
    0.8549630046E+00    0.6620241404E+00    0.1000000000E+01
    0.9041733146E+00    0.1486998498E+00    0.1000000000E+01
    0.9150072336E+00    0.2223693430E+00    0.1000000000E+01
    0.9365606308E+00    0.1558519900E-01    0.1000000000E+01
    0.9729152322E+00   -0.3486215174E+00    0.1000000000E+01
    0.9803540111E+00    0.3342832625E-01    0.1000000000E+01
    0.9886701107E+00   -0.1238780320E+00    0.1000000000E+01
    0.9923704863E+00   -0.9306252003E-01    0.1000000000E+01
    0.1023765922E+01    0.1689177752E-01    0.1000000000E+01
    0.1044213057E+01   -0.1906924844E+00    0.1000000000E+01
    0.1050163984E+01   -0.1365345418E+00    0.1000000000E+01
    0.1076943636E+01   -0.4736579657E+00    0.1000000000E+01
    0.1089455962E+01   -0.6832471490E+00    0.1000000000E+01
    0.1091325283E+01   -0.7683994770E+00    0.1000000000E+01
    0.1101472497E+01   -0.3934086859E+00    0.1000000000E+01
    0.1103227258E+01    0.6594955921E-02    0.1000000000E+01
    0.1144388437E+01   -0.3170641065E+00    0.1000000000E+01
    0.1154306889E+01   -0.8093857765E+00    0.1000000000E+01
    0.1157968998E+01   -0.2649448812E+00    0.1000000000E+01
    0.1159914613E+01   -0.8106480837E+00    0.1000000000E+01
    0.1182574153E+01   -0.5731629729E+00    0.1000000000E+01
    0.1208972335E+01   -0.1002135992E+01    0.1000000000E+01
    0.1216525555E+01   -0.8130989075E+00    0.1000000000E+01
    0.1225757241E+01   -0.4892273545E+00    0.1000000000E+01
    0.1253643036E+01   -0.1029191375E+01    0.1000000000E+01
    0.1285534501E+01   -0.9277139902E+00    0.1000000000E+01
    0.1317006230E+01   -0.9333460331E+00    0.1000000000E+01
    0.1346684933E+01   -0.4781659245E+00    0.1000000000E+01
    0.1349851131E+01   -0.8232959509E+00    0.1000000000E+01
    0.1394750953E+01   -0.8181976080E+00    0.1000000000E+01
    0.1431754112E+01   -0.1073945522E+01    0.1000000000E+01
    0.1468146801E+01   -0.7266443968E+00    0.1000000000E+01
    0.1506904602E+01   -0.8388202190E+00    0.1000000000E+01
    0.1507629395E+01   -0.5855142474E+00    0.1000000000E+01
    0.1514343500E+01   -0.5194624662E+00    0.1000000000E+01
    0.1522430778E+01   -0.1145248413E+01    0.1000000000E+01
    0.1525482535E+01   -0.7336173058E+00    0.1000000000E+01
    0.1539978743E+01   -0.1044301271E+01    0.1000000000E+01
    0.1560120583E+01   -0.1225376296E+01    0.1000000000E+01
    0.1563973427E+01   -0.1260675716E+01    0.1000000000E+01
    0.1593118191E+01   -0.1036441803E+01    0.1000000000E+01
    0.1608758688E+01   -0.7292929888E+00    0.1000000000E+01
    0.1619783401E+01   -0.6229922771E+00    0.1000000000E+01
    0.1644960642E+01   -0.1019566536E+01    0.1000000000E+01
    0.1679827571E+01   -0.9131079912E+00    0.1000000000E+01
    0.1682230830E+01   -0.8967585564E+00    0.1000000000E+01
    0.1768863916E+01   -0.5120428801E+00    0.1000000000E+01
    0.1791409135E+01   -0.8198174238E+00    0.1000000000E+01
    0.1806477427E+01   -0.2298344970E+00    0.1000000000E+01
    0.1814145088E+01   -0.4263780117E+00    0.1000000000E+01
    0.1829861879E+01   -0.7459678650E+00    0.1000000000E+01
    0.1918173432E+01    0.1075553894E+00    0.1000000000E+01
    0.2039559126E+01    0.5714680552E+00    0.1000000000E+01
    0.2137789011E+01    0.4100314081E+00    0.1000000000E+01
    0.2139086008E+01    0.4866189957E+00    0.1000000000E+01
    0.2183451653E+01    0.4994559586E+00    0.1000000000E+01
    0.2192607164E+01    0.3656423688E+00    0.1000000000E+01
    0.2211718798E+01    0.6423195004E+00    0.1000000000E+01
    0.2261768579E+01    0.9565419555E+00    0.1000000000E+01
    0.2296482801E+01    0.9795770049E+00    0.1000000000E+01
    0.2306439400E+01    0.1006894231E+01    0.1000000000E+01
    0.2314717293E+01    0.7984004021E+00    0.1000000000E+01
    0.2331235170E+01    0.5290495157E+00    0.1000000000E+01
    0.2407148838E+01    0.8467086554E+00    0.1000000000E+01
    0.2451514482E+01    0.6508232355E+00    0.1000000000E+01
    0.2461509228E+01    0.7813985348E+00    0.1000000000E+01
    0.2472381115E+01    0.1059250236E+01    0.1000000000E+01
    0.2479667425E+01    0.1197403669E+01    0.1000000000E+01
    0.2483291388E+01    0.5210686922E+00    0.1000000000E+01
    0.2486152411E+01    0.7354466915E+00    0.1000000000E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7.2 MODEWF=2
Upon  execution  of  DRIVER1  (with MODEWF=2), we required KSECTN=3 monotonic 
sections  and,  the weights and the best approximation obtained by L2WPMA are 
presented in the fourth and fifth column respectively of the following table. 
The  sixth  column  presents  a  best  approximation,  when  unit weights are 
assigned  to  this  data.  Comparing  the components of the approximations of 
columns  5  and  6,  we  see  that  when the weights are calculated by taking 
account  of  the  (irregular)  data  spacing,  the  approximation is globally 
affected.  Note  that  immediately  after  the  formation of the weights, the 
message "(AUTOMATIC WEIGHT GENERATION DUE TO ABSCISSAE SPACING.)" appears. 

Further, we include the screen output RA_W2 after Table below. The associated 
output   files   WPMAPP,  WIVAPP,  WIAKN  and  WACTLG  are  included  in  the  
subdirectory DATA\A_W2.

TABLE 2  Best weighted piecewise monotonic approximation (Y) with KSECTN=3 to 
the   data  of  file  XFWDAT_A  (parameter  MODEWF=2  in  DRIVER1)  and  best  
approximation (Y with w=1) to the same data when the weights are set to unity 
(parameter MODEWF=1 in DRIVER1).
================================================================================
    X               F               WF               Y              Y (with w=1)
--------------------------------------------------------------------------------
1   0.0004196166992 -0.4986664653   0.009999999776  -0.4986664653  -0.4986664653
2   0.01632712781   0.1467082202    0.002679344499  -0.1016980261   0.1467082202
3   0.05256734788   0.5965234637    0.001176088466  -0.1016980261   0.229804337
4   0.0568780303    -0.01409056783  0.009887460619  -0.1016980261   0.229804337
5   0.1055543125    0.5122967958    0.0008756154566 -0.1016980261   0.229804337
6   0.1057450473    -0.1146335304   0.2234604806    -0.1016980261   0.229804337
7   0.1119630784    0.1689255834    0.006854534149  0.1689255834    0.229804337
8   0.1129167527    0.8424775004    0.04469209909   0.6568642855    0.4867732227
9   0.1235599071    0.1747841835    0.004004612099  0.6568642855    0.4867732227
10  0.1585030556    0.4430579543    0.001219744328  0.6568642855    0.4867732227
11  0.2421225607    0.5085961819    0.0005097100511 0.6568642855    0.5085961819
12  0.2793545127    0.6671133637    0.001144761452  0.6568642855    0.5944060087
13  0.2803082764    0.5216986537    0.04468790442   0.6568642855    0.5944060087
14  0.3435568511    1.055015683     0.0006738760858 1.055015683     1.055015683
15  0.347180903     1.350390315     0.01176078711   1.205191374     1.350390315
16  0.3857480884    0.9371343255    0.001105128671  1.205191374     0.9969603419
17  0.4385824502    0.7028972507    0.00080670428   1.205191374     0.9969603419
18  0.4391928017    1.274271011     0.06983140111   1.205191374     0.9969603419
19  0.4428930581    1.037898064     0.01151858177   1.205191374     0.9969603419
20  0.4657053947    1.032601118     0.001868362073  1.205191374     0.9969603419
21  0.5043107271    0.6307239532    0.001104036695  1.205191374     0.9351745844
22  0.5150682926    0.6809198856    0.003962021321  1.205191374     0.9351745844
23  0.5184633732    1.135946989     0.01255396008   1.205191374     0.9351745844
24  0.5189974308    1.293107748     0.07980731875   1.293107748     0.9351745844
25  0.6518272161    0.5389159918    0.0003208745911 0.6682408452    0.5855462551
26  0.7616922259    0.6321765184    0.0003879461437 0.6682408452    0.5855462551
27  0.7931638956    0.1163604259    0.001354287961  0.6682408452    0.545727253
28  0.7955291271    0.7037745714    0.01802009903   0.6682408452    0.545727253
29  0.8163958192    0.7478320599    0.002042571083  0.6682408452    0.545727253
30  0.8190280199    0.4986451268    0.01619242318   0.5097957253    0.545727253
31  0.8549630046    0.6620241404    0.001186078298  0.5097957253    0.545727253
32  0.9041733146    0.1486998498    0.000866113347  0.2090769857    0.1855345964
33  0.9150072336    0.222369343     0.003934098408  0.2090769857    0.1855345964
34  0.9365606308    0.015585199     0.001977493521  0.015585199     0.015585199
35  0.9729152322    -0.3486215174   0.001172388089  -0.03146696463  -0.1030483916
36  0.9803540111    0.03342832625   0.005729664117  -0.03146696463  -0.1030483916
37  0.9886701107    -0.123878032    0.005125203636  -0.09354384989  -0.1030483916
38  0.9923704863    -0.09306252003  0.01151821017   -0.09354384989  -0.1030483916
39  1.023765922     0.01689177752   0.001357576461  -0.09354384989  -0.1030483916
40  1.044213057     -0.1906924844   0.002084482927  -0.148743391    -0.1636135131
41  1.050163984     -0.1365345418   0.007162195165  -0.148743391    -0.1636135131
42  1.076943636     -0.4736579657   0.001591570559  -0.3911449611   -0.4381970763
43  1.089455962     -0.683247149    0.003406377276  -0.3911449611   -0.4381970763
44  1.091325283     -0.768399477    0.02280063555   -0.3911449611   -0.4381970763
45  1.101472497     -0.3934086859   0.004200335592  -0.3911449611   -0.4381970763
46  1.103227258     0.006594955921  0.02428918146   -0.3911449611   -0.4381970763
47  1.144388437     -0.3170641065   0.001035483088  -0.3911449611   -0.4381970763
48  1.154306889     -0.8093857765   0.004297213629  -0.4117578268   -0.5371653438
49  1.157968998     -0.2649448812   0.01163856778   -0.4117578268   -0.5371653438
50  1.159914613     -0.8106480837   0.02190654911   -0.6811048985   -0.6919054985
51  1.182574153     -0.5731629729   0.001880960772  -0.6811048985   -0.6919054985
52  1.208972335     -1.002135992    0.001614569686  -0.6811048985   -0.7681540847
53  1.216525555     -0.8130989075   0.005642852746  -0.6811048985   -0.7681540847
54  1.225757241     -0.4892273545   0.004616892431  -0.6811048985   -0.7681540847
55  1.253643036     -1.029191375    0.001528437948  -0.6811048985   -0.7958452106
56  1.285534501     -0.9277139902   0.001336461166  -0.6811048985   -0.7958452106
57  1.31700623      -0.9333460331   0.001354285399  -0.6811048985   -0.7958452106
58  1.346684933     -0.4781659245   0.00143610395   -0.6811048985   -0.7958452106
59  1.349851131     -0.8232959509   0.01346147526   -0.6811048985   -0.7958452106
60  1.394750953     -0.818197608    0.0009492621757 -0.6811048985   -0.7958452106
61  1.431754112     -1.073945522    0.00115183962   -0.6811048985   -0.7958452106
62  1.468146801     -0.7266443968   0.001171161188  -0.6811048985   -0.7958452106
63  1.506904602     -0.838820219    0.001099693589  -0.6811048985   -0.7958452106
64  1.507629395     -0.5855142474   0.05880539119   -0.6811048985   -0.7958452106
65  1.5143435       -0.5194624662   0.006348083727  -0.6811048985   -0.7958452106
66  1.522430778     -1.145248413    0.005270216614  -0.8463917375   -0.9394328594
67  1.525482535     -0.7336173058   0.01396628004   -0.8463917375   -0.9394328594
68  1.539978743     -1.044301271    0.002940196777  -1.044301271    -1.044301271
69  1.560120583     -1.225376248    0.002116078045  -1.225376248    -1.225376248
70  1.563973427     -1.260675669    0.01106240042   -1.260675669    -1.260675669
71  1.593118191     -1.036441803    0.001462413813  -1.036441803    -1.036441803
72  1.608758688     -0.7292929888   0.002725086175  -0.849519372    -0.836343646
73  1.619783401     -0.6229922771   0.003866014769  -0.849519372    -0.836343646
74  1.644960642     -1.019566536    0.001692866324  -0.849519372    -0.836343646
75  1.679827571     -0.9131079912   0.001222410705  -0.849519372    -0.836343646
76  1.68223083      -0.8967585564   0.01773495972   -0.849519372    -0.836343646
77  1.768863916     -0.5120428801   0.0004919795319 -0.7562622428   -0.6659301519
78  1.791409135     -0.8198174238   0.001890498679  -0.7562622428   -0.6659301519
79  1.806477427     -0.229834497    0.002828568919  -0.4543754756   -0.4673934579
80  1.814145088     -0.4263780117   0.005558632314  -0.4543754756   -0.4673934579
81  1.829861879     -0.745967865    0.002711857902  -0.4543754756   -0.4673934579
82  1.918173432     0.1075553894    0.0004826288496 0.1075553894    0.1075553894
83  2.039559126     0.5714680552    0.0003511262476 0.4725016057    0.4666433632
84  2.137789011     0.4100314081    0.0004338975414 0.4725016057    0.4666433632
85  2.139086008     0.4866189957    0.03286183625   0.4725016057    0.4666433632
86  2.183451653     0.4994559586    0.0009606916574 0.4725016057    0.4666433632
87  2.192607164     0.3656423688    0.004655305296  0.4725016057    0.4666433632
88  2.211718798     0.6423195004    0.002230144339  0.6423195004    0.6423195004
89  2.261768579     0.9565419555    0.00085158617   0.7899553776    0.8186742067
90  2.296482801     0.9795770049    0.001227787929  0.7899553776    0.8186742067
91  2.3064394       1.006894231     0.004280749243  0.7899553776    0.8186742067
92  2.314717293     0.7984004021    0.005148859229  0.7899553776    0.8186742067
93  2.33123517      0.5290495157    0.002580337925  0.7899553776    0.8186742067
94  2.407148838     0.8467086554    0.0005614496768 0.7899553776    0.8186742067
95  2.451514482     0.6508232355    0.0009606916574 0.7899553776    0.8186742067
96  2.461509228     0.7813985348    0.004264411051  0.7899553776    0.8186742067
97  2.472381115     1.059250236     0.003920359537  0.7899553776    0.8782923222
98  2.479667425     1.197403669     0.005849559791  0.7899553776    0.8782923222
99  2.483291388     0.5210686922    0.01176107768   0.7899553776    0.8782923222
100 2.486152411     0.7354466915    0.01489736512   0.7899553776    0.8782923222
================================================================================

Output file RA_W2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16


     Automatic weight generation due to abscissae spacing


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =   100
     NUMBER OF MONOTONIC SECTIONS =     3
     NUMBER OF LOCAL MINIMA IN F  =    33
     NUMBER OF LOCAL MAXIMA IN F  =    33
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1               24
                2               70
                3              100


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0013
                2                4                  0.0030
                3                5                  0.0047
                4                6                  0.0058
                5                9                  0.0166
                6               10                  0.0127
                7               11                  0.0122
                8               12                  0.0121
                9               13                  0.0121
               10               16                  0.0034
               11               17                  0.0028
               12               18                  0.0020
               13               19                  0.0117
               14               20                  0.0078
               15               21                  0.0072
               16               22                  0.0059
               17               23                  0.0017
               18               26                 -0.0001
               19               27                 -0.0001
               20               28                 -0.0016
               21               29                 -0.0003
               22               31                 -0.0004
               23               33                 -0.0001
               24               36                 -0.0007
               25               38                 -0.0003
               26               39                 -0.0003
               27               41                 -0.0002
               28               43                 -0.0003
               29               44                 -0.0023
               30               45                 -0.0195
               31               46                 -0.0195
               32               47                 -0.0002
               33               49                 -0.0034
               34               51                 -0.0057
               35               52                 -0.0053
               36               53                 -0.0063
               37               54                 -0.0078
               38               55                 -0.0060
               39               56                 -0.0071
               40               57                 -0.0077
               41               58                 -0.0084
               42               59                 -0.0078
               43               60                 -0.0117
               44               61                 -0.0119
               45               62                 -0.0128
               46               63                 -0.0129
               47               64                 -0.0133
               48               65                 -0.0021
               49               67                 -0.0032
               50               73                  0.0007
               51               74                  0.0024
               52               75                  0.0018
               53               76                  0.0017
               54               78                  0.0002
               55               80                  0.0013
               56               81                  0.0016
               57               84                  0.0001
               58               85                  0.0000
               59               86                  0.0009
               60               87                  0.0010
               61               90                  0.0003
               62               91                  0.0007
               63               92                  0.0026
               64               93                  0.0027
               65               94                  0.0013
               66               95                  0.0014
               67               96                  0.0011
               68               97                  0.0011
               69               98                  0.0032
               70               99                  0.0079
               71              100                  0.0016


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                7
                4                8
                5               14
                6               15
                7               24
                8               25
                9               30
               10               32
               11               34
               12               35
               13               37
               14               40
               15               42
               16               48
               17               50
               18               66
               19               68
               20               69
               21               70
               22               71
               23               72
               24               77
               25               79
               26               82
               27               83
               28               88
               29               89
               30              100


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  0.00041962  -0.49866647   0.01000000  -0.49866647
    2  0.01632713   0.14670822   0.00267934  -0.10169803     0.00000000
    3  0.05256735   0.59652346   0.00117609  -0.10169803     0.00133113
    4  0.05687803  -0.01409057   0.00988746  -0.10169803     0.00297347
    5  0.10555431   0.51229680   0.00087562  -0.10169803     0.00470590
    6  0.10574505  -0.11463353   0.22346048  -0.10169803     0.00578115
    7  0.11196308   0.16892558   0.00685453   0.16892558     0.00000000
    8  0.11291675   0.84247750   0.04469210   0.65686429     0.00000000
    9  0.12355991   0.17478418   0.00400461   0.65686429     0.01659089
   10  0.15850306   0.44305795   0.00121974   0.65686429     0.01272980
   11  0.24212256   0.50859618   0.00050971   0.65686429     0.01220822
   12  0.27935451   0.66711336   0.00114476   0.65686429     0.01205708
   13  0.28030828   0.52169865   0.04468790   0.65686429     0.01208054
   14  0.34355685   1.05501568   0.00067388   1.05501568     0.00000000
   15  0.34718090   1.35039032   0.01176079   1.20519137     0.00000000
   16  0.38574809   0.93713433   0.00110513   1.20519137     0.00341531
   17  0.43858245   0.70289725   0.00080670   1.20519137     0.00282283
   18  0.43919280   1.27427101   0.06983140   1.20519137     0.00201243
   19  0.44289306   1.03789806   0.01151858   1.20519137     0.01166028
   20  0.46570539   1.03260112   0.00186836   1.20519137     0.00780632
   21  0.50431073   0.63072395   0.00110404   1.20519137     0.00716140
   22  0.51506829   0.68091989   0.00396202   1.20519137     0.00589293
   23  0.51846337   1.13594699   0.01255396   1.20519137     0.00173858
   24  0.51899743   1.29310775   0.07980732   1.29310775     0.00000000
   25  0.65182722   0.53891599   0.00032087   0.66824085     0.00000000
   26  0.76169223   0.63217652   0.00038795   0.66824085    -0.00008299
   27  0.79316390   0.11636043   0.00135429   0.66824085    -0.00011097
   28  0.79552913   0.70377457   0.01802010   0.66824085    -0.00160578
   29  0.81639582   0.74783206   0.00204257   0.66824085    -0.00032514
   30  0.81902802   0.49864513   0.01619242   0.50979573     0.00000000
   31  0.85496300   0.66202414   0.00118608   0.50979573    -0.00036111
   32  0.90417331   0.14869985   0.00086611   0.20907699     0.00000000
   33  0.91500723   0.22236934   0.00393410   0.20907699    -0.00010459
   34  0.93656063   0.01558520   0.00197749   0.01558520     0.00000000
   35  0.97291523  -0.34862152   0.00117239  -0.03146696     0.00000000
   36  0.98035401   0.03342833   0.00572966  -0.03146696    -0.00074366
   37  0.98867011  -0.12387803   0.00512520  -0.09354385     0.00000000
   38  0.99237049  -0.09306252   0.01151821  -0.09354385    -0.00031094
   39  1.02376592   0.01689178   0.00135758  -0.09354385    -0.00029985
   40  1.04421306  -0.19069248   0.00208448  -0.14874339     0.00000000
   41  1.05016398  -0.13653454   0.00716220  -0.14874339    -0.00017488
   42  1.07694364  -0.47365797   0.00159157  -0.39114496     0.00000000
   43  1.08945596  -0.68324715   0.00340638  -0.39114496    -0.00026265
   44  1.09132528  -0.76839948   0.02280064  -0.39114496    -0.00225267
   45  1.10147250  -0.39340869   0.00420034  -0.39114496    -0.01945596
   46  1.10322726   0.00659496   0.02428918  -0.39114496    -0.01947497
   47  1.14438844  -0.31706411   0.00103548  -0.39114496    -0.00015342
   48  1.15430689  -0.80938578   0.00429721  -0.41175783     0.00000000
   49  1.15796900  -0.26494488   0.01163857  -0.41175783    -0.00341738
   50  1.15991461  -0.81064808   0.02190655  -0.68110490     0.00000000
   51  1.18257415  -0.57316297   0.00188096  -0.68110490    -0.00567570
   52  1.20897233  -1.00213599   0.00161457  -0.68110490    -0.00526963
   53  1.21652555  -0.81309891   0.00564285  -0.68110490    -0.00630629
   54  1.22575724  -0.48922735   0.00461689  -0.68110490    -0.00779593
   55  1.25364304  -1.02919137   0.00152844  -0.68110490    -0.00602418
   56  1.28553450  -0.92771399   0.00133646  -0.68110490    -0.00708823
   57  1.31700623  -0.93334603   0.00135429  -0.68110490    -0.00774740
   58  1.34668493  -0.47816592   0.00143610  -0.68110490    -0.00843061
   59  1.34985113  -0.82329595   0.01346148  -0.68110490    -0.00784773
   60  1.39475095  -0.81819761   0.00094926  -0.68110490    -0.01167593
   61  1.43175411  -1.07394552   0.00115184  -0.68110490    -0.01193621
   62  1.46814680  -0.72664440   0.00117116  -0.68110490    -0.01284119
   63  1.50690460  -0.83882022   0.00109969  -0.68110490    -0.01294785
   64  1.50762939  -0.58551425   0.05880539  -0.68110490    -0.01329473
   65  1.51434350  -0.51946247   0.00634808  -0.68110490    -0.00205224
   66  1.52243078  -1.14524841   0.00527022  -0.84639174     0.00000000
   67  1.52548254  -0.73361731   0.01396628  -0.84639174    -0.00315008
   68  1.53997874  -1.04430127   0.00294020  -1.04430127     0.00000000
   69  1.56012058  -1.22537625   0.00211608  -1.22537625     0.00000000
   70  1.56397343  -1.26067567   0.01106240  -1.26067567     0.00000000
   71  1.59311819  -1.03644180   0.00146241  -1.03644180     0.00000000
   72  1.60875869  -0.72929299   0.00272509  -0.84951937     0.00000000
   73  1.61978340  -0.62299228   0.00386601  -0.84951937     0.00065525
   74  1.64496064  -1.01956654   0.00169287  -0.84951937     0.00240677
   75  1.67982757  -0.91310799   0.00122241  -0.84951937     0.00183103
   76  1.68223083  -0.89675856   0.01773496  -0.84951937     0.00167557
   77  1.76886392  -0.51204288   0.00049198  -0.75626224     0.00000000
   78  1.79140913  -0.81981742   0.00189050  -0.75626224     0.00024030
   79  1.80647743  -0.22983450   0.00282857  -0.45437548     0.00000000
   80  1.81414509  -0.42637801   0.00555863  -0.45437548     0.00127026
   81  1.82986188  -0.74596786   0.00271186  -0.45437548     0.00158151
   82  1.91817343   0.10755539   0.00048263   0.10755539     0.00000000
   83  2.03955913   0.57146806   0.00035113   0.47250161     0.00000000
   84  2.13778901   0.41003141   0.00043390   0.47250161     0.00006950
   85  2.13908601   0.48661900   0.03286184   0.47250161     0.00001529
   86  2.18345165   0.49945596   0.00096069   0.47250161     0.00094313
   87  2.19260716   0.36564237   0.00465531   0.47250161     0.00099492
   88  2.21171880   0.64231950   0.00223014   0.64231950     0.00000000
   89  2.26176858   0.95654196   0.00085159   0.78995538     0.00000000
   90  2.29648280   0.97957700   0.00122779   0.78995538     0.00028373
   91  2.30643940   1.00689423   0.00428075   0.78995538     0.00074936
   92  2.31471729   0.79840040   0.00514886   0.78995538     0.00260668
   93  2.33123517   0.52904952   0.00258034   0.78995538     0.00269364
   94  2.40714884   0.84670866   0.00056145   0.78995538     0.00134719
   95  2.45151448   0.65082324   0.00096069   0.78995538     0.00141092
   96  2.46150923   0.78139853   0.00426441   0.78995538     0.00114359
   97  2.47238111   1.05925024   0.00392036   0.78995538     0.00107061
   98  2.47966743   1.19740367   0.00584956   0.78995538     0.00318208
   99  2.48329139   0.52106869   0.01176108   0.78995538     0.00794887
  100  2.48615241   0.73544669   0.01489737   0.78995538     0.00162407

  Value of objective function at the optimum=    0.2278449759E-01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7.3 MODEWF=3
As in Subsection 7.2, but MODEWF=3. We include the screen output RA_W3 below. 
The  associated output files WPMAPP, WIVAPP, WIAKN and WACTLG are included in 
the subdirectory DATA\A_W3.

Output file RA_W3 (note the cyclical permutation of the weights compared to
                  the weights of subsection 7.2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
3

     Automatic weight generation due to abscissae spacing


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =   100
     NUMBER OF MONOTONIC SECTIONS =     3
     NUMBER OF LOCAL MINIMA IN F  =    33
     NUMBER OF LOCAL MAXIMA IN F  =    33
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1               24
                2               70
                3              100


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                4                  0.0030
                2                5                  0.0022
                3                6                  0.0323
                4                7                  0.0247
                5                9                  0.0016
                6               10                  0.0005
                7               11                  0.0003
                8               13                  0.0002
                9               15                  0.0069
               10               16                  0.0082
               11               17                  0.0084
               12               19                  0.0080
               13               20                  0.0084
               14               21                  0.0086
               15               22                  0.0062
               16               26                 -0.0001
               17               28                 -0.0116
               18               29                 -0.0105
               19               30                 -0.0005
               20               31                 -0.0004
               21               33                 -0.0002
               22               36                 -0.0025
               23               37                 -0.0008
               24               38                 -0.0007
               25               39                 -0.0006
               26               41                 -0.0001
               27               44                 -0.0084
               28               45                 -0.0107
               29               46                 -0.0056
               30               47                 -0.0045
               31               48                 -0.0030
               32               49                 -0.0102
               33               51                 -0.0004
               34               52                  0.0000
               35               53                 -0.0034
               36               54                 -0.0045
               37               55                 -0.0038
               38               56                 -0.0047
               39               57                 -0.0053
               40               58                 -0.0060
               41               60                 -0.0001
               42               61                 -0.0001
               43               62                 -0.0008
               44               63                 -0.0006
               45               64                 -0.0056
               46               65                 -0.0029
               47               67                 -0.0021
               48               68                 -0.0001
               49               73                  0.0011
               50               74                  0.0019
               51               75                  0.0016
               52               76                  0.0000
               53               78                  0.0007
               54               80                  0.0010
               55               81                  0.0004
               56               84                  0.0001
               57               86                  0.0001
               58               87                  0.0004
               59               90                  0.0003
               60               91                  0.0015
               61               92                  0.0032
               62               93                  0.0030
               63               94                  0.0026
               64               95                  0.0027
               65               96                  0.0010
               66               97                  0.0006
               67               98                  0.0032
               68               99                  0.0116
               69              100                  0.0021


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                8
                5               12
                6               14
                7               18
                8               23
                9               24
               10               25
               11               27
               12               32
               13               34
               14               35
               15               40
               16               42
               17               43
               18               50
               19               59
               20               66
               21               69
               22               70
               23               71
               24               72
               25               77
               26               79
               27               82
               28               83
               29               85
               30               88
               31               89
               32              100


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  0.00041962  -0.49866647   0.00267934  -0.49866647
    2  0.01632713   0.14670822   0.00117609   0.14670822     0.00000000
    3  0.05256735   0.59652346   0.00988746   0.44486001     0.00000000
    4  0.05687803  -0.01409057   0.00087562   0.44486001     0.00299913
    5  0.10555431   0.51229680   0.22346048   0.44486001     0.00219540
    6  0.10574505  -0.11463353   0.00685453   0.44486001     0.03233432
    7  0.11196308   0.16892558   0.04469210   0.44486001     0.02466418
    8  0.11291675   0.84247750   0.00400461   0.63892281     0.00000000
    9  0.12355991   0.17478418   0.00121974   0.63892281     0.00163032
   10  0.15850306   0.44305795   0.00050971   0.63892281     0.00049805
   11  0.24212256   0.50859618   0.00114476   0.63892281     0.00029839
   12  0.27935451   0.66711336   0.04468790   0.66495311     0.00000000
   13  0.28030828   0.52169865   0.00067388   0.66495311     0.00019307
   14  0.34355685   1.05501568   0.01176079   0.76332206     0.00000000
   15  0.34718090   1.35039032   0.00110513   0.76332206     0.00686109
   16  0.38574809   0.93713433   0.00080670   0.76332206     0.00815867
   17  0.43858245   0.70289725   0.06983140   0.76332206     0.00843910
   18  0.43919280   1.27427101   0.01151858   0.92895836     0.00000000
   19  0.44289306   1.03789806   0.00186836   0.92895836     0.00795502
   20  0.46570539   1.03260112   0.00110404   0.92895836     0.00836210
   21  0.50431073   0.63072395   0.00396202   0.92895836     0.00859095
   22  0.51506829   0.68091989   0.01255396   0.92895836     0.00622773
   23  0.51846337   1.13594699   0.07980732   1.13594699     0.00000000
   24  0.51899743   1.29310775   0.00032087   1.29310775     0.00000000
   25  0.65182722   0.53891599   0.00038795   0.61141002     0.00000000
   26  0.76169223   0.63217652   0.00135429   0.61141002    -0.00005625
   27  0.79316390   0.11636043   0.01802010   0.43877736     0.00000000
   28  0.79552913   0.70377457   0.00204257   0.43877736    -0.01161997
   29  0.81639582   0.74783206   0.01619242   0.43877736    -0.01053742
   30  0.81902802   0.49864513   0.00118608   0.43877736    -0.00052873
   31  0.85496300   0.66202414   0.00086611   0.43877736    -0.00038671
   32  0.90417331   0.14869985   0.00393410   0.17334312     0.00000000
   33  0.91500723   0.22236934   0.00197749   0.17334312    -0.00019390
   34  0.93656063   0.01558520   0.00117239   0.01558520     0.00000000
   35  0.97291523  -0.34862152   0.00572966  -0.12954180     0.00000000
   36  0.98035401   0.03342833   0.00512520  -0.12954180    -0.00251051
   37  0.98867011  -0.12387803   0.01151821  -0.12954180    -0.00084000
   38  0.99237049  -0.09306252   0.00135758  -0.12954180    -0.00070952
   39  1.02376592   0.01689178   0.00208448  -0.12954180    -0.00061048
   40  1.04421306  -0.19069248   0.00716220  -0.18084572     0.00000000
   41  1.05016398  -0.13653454   0.00159157  -0.18084572    -0.00014105
   42  1.07694364  -0.47365797   0.00340638  -0.47365797     0.00000000
   43  1.08945596  -0.68324715   0.02280064  -0.49841824     0.00000000
   44  1.09132528  -0.76839948   0.00420034  -0.49841824    -0.00842843
   45  1.10147250  -0.39340869   0.02428918  -0.49841824    -0.01069645
   46  1.10322726   0.00659496   0.00103548  -0.49841824    -0.00559526
   47  1.14438844  -0.31706411   0.00429721  -0.49841824    -0.00454939
   48  1.15430689  -0.80938578   0.01163857  -0.49841824    -0.00299076
   49  1.15796900  -0.26494488   0.02190655  -0.49841824    -0.01022919
   50  1.15991461  -0.81064808   0.00188096  -0.70016718     0.00000000
   51  1.18257415  -0.57316297   0.00161457  -0.70016718    -0.00041562
   52  1.20897233  -1.00213599   0.00564285  -0.70016718    -0.00000551
   53  1.21652555  -0.81309891   0.00461689  -0.70016718    -0.00341344
   54  1.22575724  -0.48922735   0.00152844  -0.70016718    -0.00445622
   55  1.25364304  -1.02919137   0.00133646  -0.70016718    -0.00381141
   56  1.28553450  -0.92771399   0.00135429  -0.70016718    -0.00469086
   57  1.31700623  -0.93334603   0.00143610  -0.70016718    -0.00530719
   58  1.34668493  -0.47816592   0.01346148  -0.70016718    -0.00597693
   59  1.34985113  -0.82329595   0.00094926  -0.79633683     0.00000000
   60  1.39475095  -0.81819761   0.00115184  -0.79633683    -0.00005118
   61  1.43175411  -1.07394552   0.00117116  -0.79633683    -0.00010154
   62  1.46814680  -0.72664440   0.00109969  -0.79633683    -0.00075179
   63  1.50690460  -0.83882022   0.05880539  -0.79633683    -0.00059851
   64  1.50762939  -0.58551425   0.00634808  -0.79633683    -0.00559501
   65  1.51434350  -0.51946247   0.00527022  -0.79633683    -0.00291838
   66  1.52243078  -1.14524841   0.01396628  -1.07039571     0.00000000
   67  1.52548254  -0.73361731   0.00294020  -1.07039571    -0.00209083
   68  1.53997874  -1.04430127   0.00211608  -1.07039571    -0.00011044
   69  1.56012058  -1.22537625   0.01106240  -1.22537625     0.00000000
   70  1.56397343  -1.26067567   0.00146241  -1.26067567     0.00000000
   71  1.59311819  -1.03644180   0.00272509  -1.03644180     0.00000000
   72  1.60875869  -0.72929299   0.00386601  -0.86993557     0.00000000
   73  1.61978340  -0.62299228   0.00169287  -0.86993557     0.00108745
   74  1.64496064  -1.01956654   0.00122241  -0.86993557     0.00192354
   75  1.67982757  -0.91310799   0.01773496  -0.86993557     0.00155772
   76  1.68223083  -0.89675856   0.00049198  -0.86993557     0.00002639
   77  1.76886392  -0.51204288   0.00189050  -0.69652033     0.00000000
   78  1.79140913  -0.81981742   0.00282857  -0.69652033     0.00069751
   79  1.80647743  -0.22983450   0.00555863  -0.31918538     0.00000000
   80  1.81414509  -0.42637801   0.00271186  -0.31918538     0.00099334
   81  1.82986188  -0.74596786   0.00048263  -0.31918538     0.00041195
   82  1.91817343   0.10755539   0.00035113   0.10755539     0.00000000
   83  2.03955913   0.57146806   0.00043390   0.41213518     0.00000000
   84  2.13778901   0.41003141   0.03286184   0.41213518     0.00013827
   85  2.13908601   0.48661900   0.00096069   0.45984975     0.00000000
   86  2.18345165   0.49945596   0.00465531   0.45984975     0.00005143
   87  2.19260716   0.36564237   0.00223014   0.45984975     0.00042019
   88  2.21171880   0.64231950   0.00085159   0.64231950     0.00000000
   89  2.26176858   0.95654196   0.00122779   0.83965087     0.00000000
   90  2.29648280   0.97957700   0.00428075   0.83965087     0.00028703
   91  2.30643940   1.00689423   0.00514886   0.83965087     0.00148501
   92  2.31471729   0.79840040   0.00258034   0.83965087     0.00320724
   93  2.33123517   0.52904952   0.00056145   0.83965087     0.00299436
   94  2.40714884   0.84670866   0.00096069   0.83965087     0.00264558
   95  2.45151448   0.65082324   0.00426441   0.83965087     0.00265914
   96  2.46150923   0.78139853   0.00392036   0.83965087     0.00104867
   97  2.47238111   1.05925024   0.00584956   0.83965087     0.00059193
   98  2.47966743   1.19740367   0.01176108   0.83965087     0.00316105
   99  2.48329139   0.52106869   0.01489737   0.83965087     0.01157616
  100  2.48615241   0.73544669   0.01000000   0.83965087     0.00208409

  Value of objective function at the optimum=    0.2718751132E-01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7.4 MODEWF=4
As in Subsection 7.2, but MODEWF=4. We include the screen output RA_W4 below. 
The  associated output files WPMAPP, WIVAPP, WIAKN and WACTLG are included in 
the subdirectory DATA\A_W4.

Output file RA_W4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 21
3

     Automatic weight generation due to abscissae spacing


     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =   100
     NUMBER OF MONOTONIC SECTIONS =     3
     NUMBER OF LOCAL MINIMA IN F  =    33
     NUMBER OF LOCAL MAXIMA IN F  =    33
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1               24
                2               70
                3              100


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                4                  0.0140
                2                6                  0.0074
                3                7                  0.0043
                4                8                  0.0029
                5                9                  0.0085
                6               13                  0.0035
                7               15                  0.0072
                8               16                  0.0242
                9               17                  0.0233
               10               18                  0.0103
               11               19                  0.0117
               12               20                  0.0141
               13               21                  0.0194
               14               22                  0.0038
               15               26                 -0.0083
               16               28                 -0.0149
               17               29                 -0.0114
               18               30                 -0.0069
               19               31                 -0.0091
               20               33                 -0.0015
               21               36                 -0.0101
               22               37                 -0.0077
               23               38                 -0.0078
               24               39                 -0.0070
               25               41                 -0.0008
               26               43                 -0.0053
               27               44                 -0.0102
               28               45                 -0.0154
               29               46                 -0.0160
               30               47                 -0.0011
               31               49                 -0.0022
               32               51                 -0.0039
               33               53                 -0.0086
               34               54                 -0.0097
               35               56                 -0.0102
               36               57                 -0.0146
               37               58                 -0.0192
               38               59                 -0.0068
               39               60                 -0.0051
               40               61                 -0.0018
               41               62                 -0.0177
               42               63                 -0.0078
               43               64                 -0.0070
               44               65                 -0.0050
               45               67                 -0.0028
               46               73                  0.0038
               47               74                  0.0128
               48               75                  0.0038
               49               76                  0.0023
               50               78                  0.0101
               51               79                  0.0020
               52               80                  0.0105
               53               81                  0.0147
               54               84                  0.0146
               55               85                  0.0051
               56               86                  0.0042
               57               87                  0.0039
               58               90                  0.0138
               59               91                  0.0221
               60               92                  0.0260
               61               93                  0.0261
               62               94                  0.0016
               63               95                  0.0080
               64               96                  0.0003
               65               98                  0.0014
               66               99                  0.0037
               67              100                  0.0007


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                3
                4                5
                5               10
                6               11
                7               12
                8               14
                9               23
               10               24
               11               25
               12               27
               13               32
               14               34
               15               35
               16               40
               17               42
               18               48
               19               50
               20               52
               21               55
               22               66
               23               68
               24               69
               25               70
               26               71
               27               72
               28               77
               29               82
               30               83
               31               88
               32               89
               33               97
               34              100


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1   0.00041962  -0.49866647   0.00795376  -0.49866647
    2   0.01632713   0.14670822   0.02607387   0.14670822     0.00000000
    3   0.05256735   0.59652346   0.02027545   0.25062522     0.00000000
    4   0.05687803  -0.01409057   0.02649348   0.25062522     0.01402649
    5   0.10555431   0.51229680   0.02443351   0.36152178     0.00000000
    6   0.10574505  -0.11463353   0.00320438   0.36152178     0.00736793
    7   0.11196308   0.16892558   0.00358585   0.36152178     0.00431636
    8   0.11291675   0.84247750   0.00579841   0.36152178     0.00293511
    9   0.12355991   0.17478418   0.02279315   0.36152178     0.00851268
   10   0.15850306   0.44305795   0.05928133   0.44305795     0.00000000
   11   0.24212256   0.50859618   0.06042573   0.50859618     0.00000000
   12   0.27935451   0.66711336   0.01909286   0.57593119     0.00000000
   13   0.28030828   0.52169865   0.03210117   0.57593119     0.00348186
   14   0.34355685   1.05501568   0.03343631   0.94698817     0.00000000
   15   0.34718090   1.35039032   0.02109562   0.94698817     0.00722408
   16   0.38574809   0.93713433   0.04570077   0.94698817     0.02424412
   17   0.43858245   0.70289725   0.02672236   0.94698817     0.02334346
   18   0.43919280   1.27427101   0.00215530   0.94698817     0.01029810
   19   0.44289306   1.03789806   0.01325630   0.94698817     0.01170888
   20   0.46570539   1.03260112   0.03070883   0.94698817     0.01411914
   21   0.50431073   0.63072395   0.02468145   0.94698817     0.01937729
   22   0.51506829   0.68091989   0.00707632   0.94698817     0.00376557
   23   0.51846337   1.13594699   0.00196457   1.13594699     0.00000000
   24   0.51899743   1.29310775   0.06668192   1.29310775     0.00000000
   25   0.65182722   0.53891599   0.12134740   0.57323903     0.00000000
   26   0.76169223   0.63217652   0.07066834   0.57323903    -0.00833003
   27   0.79316390   0.11636043   0.01691845   0.55541420     0.00000000
   28   0.79552913   0.70377457   0.01161596   0.55541420    -0.01485622
   29   0.81639582   0.74783206   0.01174945   0.55541420    -0.01140952
   30   0.81902802   0.49864513   0.01928359   0.55541420    -0.00688791
   31   0.85496300   0.66202414   0.04257265   0.55541420    -0.00907733
   32   0.90417331   0.14869985   0.03002211   0.17451309     0.00000000
   33   0.91500723   0.22236934   0.01619366   0.17451309    -0.00154994
   34   0.93656063   0.01558520   0.02895400   0.01558520     0.00000000
   35   0.97291523  -0.34862152   0.02189669  -0.11747167     0.00000000
   36   0.98035401   0.03342833   0.00787744  -0.11747167    -0.01012283
   37   0.98867011  -0.12387803   0.00600824  -0.11747167    -0.00774542
   38   0.99237049  -0.09306252   0.01754791  -0.11747167    -0.00782240
   39   1.02376592   0.01689178   0.02592129  -0.11747167    -0.00696575
   40   1.04421306  -0.19069248   0.01319903  -0.16071343     0.00000000
   41   1.05016398  -0.13653454   0.01636529  -0.16071343    -0.00079139
   42   1.07694364  -0.47365797   0.01964599  -0.33956692     0.00000000
   43   1.08945596  -0.68324715   0.00719082  -0.33956692    -0.00526871
   44   1.09132528  -0.76839948   0.00600827  -0.33956692    -0.01021139
   45   1.10147250  -0.39340869   0.00595099  -0.33956692    -0.01536447
   46   1.10322726   0.00659496   0.02145797  -0.33956692    -0.01600530
   47   1.14438844  -0.31706411   0.02553982  -0.33956692    -0.00114944
   48   1.15430689  -0.80938578   0.00679028  -0.65027440     0.00000000
   49   1.15796900  -0.26494488   0.00280386  -0.65027440    -0.00216082
   50   1.15991461  -0.81064808   0.01230258  -0.65248865     0.00000000
   51   1.18257415  -0.57316297   0.02452886  -0.65248865    -0.00389154
   52   1.20897233  -1.00213599   0.01697570  -0.74931997     0.00000000
   53   1.21652555  -0.81309891   0.00839245  -0.74931997    -0.00858346
   54   1.22575724  -0.48922735   0.01855874  -0.74931997    -0.00965398
   55   1.25364304  -1.02919137   0.02988863  -0.85806721     0.00000000
   56   1.28553450  -0.92771399   0.03168160  -0.85806721    -0.01022935
   57   1.31700623  -0.93334603   0.03057522  -0.85806721    -0.01464240
   58   1.34668493  -0.47816592   0.01642245  -0.85806721    -0.01924573
   59   1.34985113  -0.82329595   0.02403301  -0.85806721    -0.00676791
   60   1.39475095  -0.81819761   0.04095149  -0.85806721    -0.00509659
   61   1.43175411  -1.07394552   0.03669792  -0.85806721    -0.00183115
   62   1.46814680  -0.72664440   0.03757524  -0.85806721    -0.01767572
   63   1.50690460  -0.83882022   0.01974130  -0.85806721    -0.00779923
   64   1.50762939  -0.58551425   0.00371945  -0.85806721    -0.00703931
   65   1.51434350  -0.51946247   0.00740069  -0.85806721    -0.00501182
   66   1.52243078  -1.14524841   0.00556952  -0.89345187     0.00000000
   67   1.52548254  -0.73361731   0.00877398  -0.89345187    -0.00280477
   68   1.53997874  -1.04430127   0.01731902  -1.04430127     0.00000000
   69   1.56012058  -1.22537625   0.01199734  -1.22537625     0.00000000
   70   1.56397343  -1.26067567   0.01649880  -1.26067567     0.00000000
   71   1.59311819  -1.03644180   0.02239263  -1.03644180     0.00000000
   72   1.60875869  -0.72929299   0.01333261  -0.87110579     0.00000000
   73   1.61978340  -0.62299228   0.01810098  -0.87110579     0.00378147
   74   1.64496064  -1.01956654   0.03002208  -0.87110579     0.01276366
   75   1.67982757  -0.91310799   0.01863509  -0.87110579     0.00384946
   76   1.68223083  -0.89675856   0.04451817  -0.87110579     0.00228403
   77   1.76886392  -0.51204288   0.05458915  -0.60462642     0.00000000
   78   1.79140913  -0.81981742   0.01880676  -0.60462642     0.01010811
   79   1.80647743  -0.22983450   0.01136798  -0.60462642     0.00201402
   80   1.81414509  -0.42637801   0.01169223  -0.60462642     0.01053528
   81   1.82986188  -0.74596786   0.05201417  -0.60462642     0.01470352
   82   1.91817343   0.10755539   0.10484862   0.10755539     0.00000000
   83   2.03955913   0.57146806   0.10980779   0.50515717     0.00000000
   84   2.13778901   0.41003141   0.04976344   0.50515717     0.01456290
   85   2.13908601   0.48661900   0.02283132   0.50515717     0.00509533
   86   2.18345165   0.49945596   0.02676058   0.50515717     0.00424883
   87   2.19260716   0.36564237   0.01413357   0.50515717     0.00394369
   88   2.21171880   0.64231950   0.03458071   0.64231950     0.00000000
   89   2.26176858   0.95654196   0.04238200   0.79370159     0.00000000
   90   2.29648280   0.97957700   0.02233541   0.79370159     0.01380300
   91   2.30643940   1.00689423   0.00911725   0.79370159     0.02210621
   92   2.31471729   0.79840040   0.01239789   0.79370159     0.02599367
   93   2.33123517   0.52904952   0.04621577   0.79370159     0.02611018
   94   2.40714884   0.84670866   0.06013966   0.79370159     0.00164798
   95   2.45151448   0.65082324   0.02718019   0.79370159     0.00802363
   96   2.46150923   0.78139853   0.01043332   0.79370159     0.00025671
   97   2.47238111   1.05925024   0.00907910   0.98351789     0.00000000
   98   2.47966743   1.19740367   0.00545514   0.98351789     0.00137516
   99   2.48329139   0.52106869   0.00324249   0.98351789     0.00370872
  100   2.48615241   0.73544669   0.00143051   0.98351789     0.00070974

  Value of objective function at the optimum=    0.5492874607E-01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

8. ONLY THE DATA (F) ARE PROVIDED (MODEWF=5)
--------------------------------------------
This  section  gives  an example, where only the data file that includes F is 
provided.  The abscissae X and the weights WF are calculated automatically by 
the  software  package  by  specifying  MODEWF=5  in  the calling sequence of 
L2WPMA.  Specifically, the software sets X(i)=i, for i=I1,...,N, and WF(i)=1, 
for i=I1,...,N. The user should replace the instruction 
                        READ (2,*) X(I), F(I), WF(i)
with the instruction
                               READ (2,*) F(I)
in  the  source  code  of  DRIVER1  (see beginning of Section 2, Appendix A), 
before he executes DRIVER1.

We consider the datafile XFWDAT_F that contains I1=1, N=14 and 14 data values 
for F as follows:

Datafile XFWDAT_F
~~~~~~~~~~~~~~~~~~
1 14
-0.10
0.71
0.69
0.87
-1.00
-1.11
1.00
1.00
-1.00
-1.00
0.68
0.73
0.70
0.50
~~~~~~~~~~~~~~~~~~~

We  copied  file XFWDAT_F to file XFWDAT, we applied DRIVER1 with MODEWF=5 by 
requiring  KSECTN=4  monotonic  sections  and we obtained the output file RF, 
below.  The  associated  output  files  WPMAPP,  WIVAPP, WIAKN and WACTLG are 
included in the subdirectory DATA\F.

Output file RF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     X-F-W Data supply for smoothing from datafile  "XFWDAT" .

     Just below, input number of monotonic sections < 16
4

     -----------------------------------------
     RETURN FROM L2WPMA WITH MODE =     1
     NUMBER OF DATA (F)           =    14
     NUMBER OF MONOTONIC SECTIONS =     4
     NUMBER OF LOCAL MINIMA IN F  =     5
     NUMBER OF LOCAL MAXIMA IN F  =     4
     -----------------------------------------


     -------------------------------------------------
     Best piecewise monotonic approximation to the data
     from file "XFWDAT" is now kept in file ..."WPMAPP".

     Indices of extrema of best approximation are now
     kept in file ............................"WIVAPP".

     Indices of spline representation of best apprxmtn
     are now kept in file ....................."WIAKN".

     Indices of active constraints of best apprxtn and 
     Lagrange multipliers are now kept in file "WACTLG".
     --------------------------------------------------


            INDICES OF EXTREMA AT OPTIMUM
            Increment      Data index
            (J)            (ITHETA)
                0                1
                1                4
                2                6
                3                7
                4               14


            INDICES OF ACTIVE CONSTRAINTS AT OPTIMUM
            Increment      Active constraint      Lagrange mult
            (I)            (IACT)                 (PAR(IACT))
                1                3                  0.0200
                2               10                 -2.2033
                3               11                 -4.4067
                4               12                 -3.2500
                5               13                 -1.9933
                6               14                 -0.7967


            INDICES OF KNOTS AT OPTIMUM
            Increment      Knot index
            (I)            (IAKN)
                1                1
                2                2
                3                4
                4                5
                5                6
                6                7
                7                8
                8                9
                9               14


       Data points  Measurements  Data weights  Best appxmtn  Lagrange mult
       (X)          (F)           (WF)          (Y)           (PAR)

    1  1.00000000  -0.10000000   1.00000000  -0.10000000
    2  2.00000000   0.70999998   1.00000000   0.69999999     0.00000000
    3  3.00000000   0.69000000   1.00000000   0.69999999     0.01999998
    4  4.00000000   0.87000000   1.00000000   0.87000000     0.00000000
    5  5.00000000  -1.00000000   1.00000000  -1.00000000     0.00000000
    6  6.00000000  -1.11000001   1.00000000  -1.11000001     0.00000000
    7  7.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    8  8.00000000   1.00000000   1.00000000   1.00000000     0.00000000
    9  9.00000000  -1.00000000   1.00000000   0.10166669     0.00000000
   10 10.00000000  -1.00000000   1.00000000   0.10166669    -2.20333338
   11 11.00000000   0.68000001   1.00000000   0.10166669    -4.40666676
   12 12.00000000   0.73000002   1.00000000   0.10166669    -3.25000000
   13 13.00000000   0.69999999   1.00000000   0.10166669    -1.99333322
   14 14.00000000   0.50000000   1.00000000   0.10166669    -0.79666662

  Value of objective function at the optimum=    0.3673483610E+01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

APPENDIX D

REMARKS ON THE FORTRAN LISTINGS
===============================

This  appendix addresses some details of the Fortran subroutines that compose 
the software package. Each of the five subroutines is  considered separately. 
In  order  to  make  the  code  readable  and  reasonably self-described, all  
Fortran  modules  begin  with  comments  that  explain  the  input and output  
arguments,  the  working space and the method followed. Also, comments inside 
the  code help readability. The references are cited in the beginning of this 
document.  For  the terminology used and the numbering of formulae the reader 
should refer to [1].

SUBROUTINE L2WPMA
-----------------
This  subroutine  implements  Algorithm 1 of [2] except that, as described by 
[1], L2WPMA allows data weights and at the end of the calculation it provides 
a  spline  representation  of  the  solution  and  the corresponding Lagrange 
multipliers.  The  instructions  up to label 20 perform some initial settings 
that  depend on the values of the arguments IORDER and MODEWF, and, also, set 
the  arrays  FT and FTNEG that are used by the monotonic algorithm L2WMON (in 
Steps  3  and 6 of Algorithm 1). If MODEWF=2,3,4 especially, then the weights 
are  defined  so  as  to  reflect differences from the abscissae spacing. The 
following  block  of instructions employs subroutine TRIVIA in order to check 
on some trivial cases that may cause termination of subroutine L2WPMA.

Then  the  main calculation begins by employing subroutine XTREMA in order to 
form the arrays LOWER and IUPPER. It continues by allowing the possibility of 
calculating the best approximation with only one monotonic section. Next, the 
instructions   up  to  label  60  examine  whether  the  data  satisfies  the  
constraints  (Step 0 of Algorithm 1), in which case ITHETA is defined and the 
program  terminates.  The  block  of instructions that includes labels 60-100 
implements  Step  1  of Algorithm 1. The counters IL and IU of the index sets 
LOWER  and  IUPPER  respectively  are both initialized to I1. The integer ILU 
corresponds  to  variable t of Algorithm 1 as it appears from Step 1 onwards. 
Initially ILU is set to IUPPER(IU). The block of the three instructions after 
label  100  (cf.  Step  2  of  Algorithm  1)  increments  IL  by one and sets 
ILU=LOWER(IL).  The  following  instruction  (cf.  Step  3  of  Algorithm  1)  
calculates the best weighted least squares monotonic decreasing approximation 
to  F  ranging  in [ITHETA(2),ILU] due to FT. The block of instructions up to 
label  160 (cf. Step 4 of Algorithm 1) calculates G(M,ILU) by formulae (2.10) 
for  even  values  of  M in [1,KSECTN-1]. The next block of instructions (cf. 
Step  5  of  Algorithm  1)  increments IU by one and sets ILU=IUPPER(IU). The 
following  instruction  (cf.  Step  6  of  Algorithm  1)  calculates the best 
weighted  least  squares  monotonic decreasing approximation to -F ranging in 
[ITHETA(3),ILU]  due to FTNEG. The block of instructions up to label 230 (cf. 
Step  7 of Algorithm 1) calculates G(M,ILU) by formulae (2.10) for odd values 
of M in [1,KSECTN-1]. Step 8 causes the process from label 100 to be repeated 
until ILU exhausts LOWER. Then the block of instructions that includes labels 
250-310  calculates  the  optimal value of the index of the rightmost integer 
variable of the required approximation (cf. Step 9 of Algorithm 1).

The  next  block of instructions that includes labels 320-330 (cf. Step 10 of 
Algorithm 1) uses ITHETA(0:KSECTN) to store an optimal sequence of  values of 
the  variables  {t(j):  j=0,1,...,KSECTN}  by  employing the backward tracing 
formula  (2.8)  due  to  the  data  index set INDX. The block of instructions 
between  the  labels  330-390 (cf. Steps 11-14 of Algorithm 1) calculates the 
optimal  approximation that is associated to the integer variables (1.3) that 
are  now  held  in ITHETA. At the end of the calculation, L2WPMA provides the 
knot indices of a spline representation of the solution and the corresponding 
Lagrange multipliers.

SUBROUTINE TRIVIA
-----------------
This  subroutine  investigates  for  trivial  cases  before  Algorithm  1  is   
employed to calculate an optimal approximation. The comments at the beginning 
of this subroutine explain its method.

SUBROUTINE XTREMA
-----------------
This  subroutine  forms  the sets of the indices of the local minima  and the 
local  maxima   of  the data denoted by script-L and script-U respectively in 
Section 2 of [1]. Both these sets require only N-I1+1 memory positions, their 
interior  elements  interlace  and   they   can   be   formed  in   O(N-I1+1)   
computer operations. We associate the arrays LOWER and IUPPER with these sets 
respectively.  The  integer array INDX(I1:N) is used to indicate the position  
of  the  data index of a local minimum value in the data in LOWER (or a local 
maximum  value  in  the  data  in IUPPER). Thus if i is the data index and if 
LOWER(IL)=i  then  INDX(i)=IL,  where  IL  is  a  counter  on  LOWER  (or, if 
IUPPER(IU)=i  then   INDX(i)=IU, where IU is a counter on IUPPER). Subroutine 
XTREMA is called by  L2WPMA and on return to L2WPMA yields also the number of 
the  local  minima and  the local maxima of the data, NL and NU respectively. 
LOWER and IUPPER may contain the end range indices I1 and/or N.

SUBROUTINE L2WMON
-----------------
Given  integers L1 and LN such that I1<=L1<=LN<=N, this subroutine calculates 
all  the  numbers  a(L1,i), i=L1,L1+1,...,LN, defined by (2.4) in [1] and the 
best  weighted  least  squares monotonic increasing approximation to the data 
X(i),  F(i),  WF(i), i=L1,L1+1, ...,LN. The return of the solution components 
that  occur  in  the expression (2.1) depends on a flag (MODE) whose value is 
set  by  the  calling subroutine L2WPMA. A modified version of Algorithm 1 of 
Demetriou and Powell [3] is implemented in this calculation and it is easy to 
relate  the  steps of this algorithm to the listing of the subroutine L2WMON. 
It   is   worth  noting  that  this  subroutine  requires  O(LN-L1)  computer  
operations, which is extremely little work for its task. Further, the numbers 
b(L1,i), i=L1,L1+1,...,LN, defined by formula (2.5) in [1], can be calculated 
by  applying  L2WMON to the data X(L1:LN), FT(L1:LN) with weights WFT(L1:LN). 
At  the  end of the calculation, L2WMON provides the knot indices of a spline 
representation  of  the  monotonic  components and the corresponding Lagrange 
multipliers.

SUBROUTINE MESSGW
-----------------
This subroutine includes certain messages associated with  the  operations of
Subroutines L2WPMA and TRIVIA.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

December 2004                                    University of Athens, Greece
                                                         Ioannis C. DEMETRIOU

                         END OF FILE 'INSTDE04.txt'
