home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / TRANSFOR.PZS / TRANSFOR.PAS
Pascal/Delphi Source File  |  2000-06-30  |  3KB  |  92 lines

  1. {***********************************************************************}
  2. {*                                                                     *}
  3. {*              TRANSFORM ** A DATA TRANFORMATION PROGRAM              *}
  4. {*                copyright (c) 1985 by Larry Marshall                 *}
  5. {*                                                                     *}
  6. {*       This program may be used for noncommercial purposes only.     *}
  7. {*       No commercial use of TRANSFORM may be made without the        *}
  8. {*       author's expressed written permission.                        *}
  9. {*                                                                     *}
  10. {***********************************************************************}
  11.  
  12.  
  13. { This program will allow transformation of data for the purposes }
  14. { of normalization.  The input file must contain only the variable }
  15. { to be transformed.  The input & output files are not defined by the }
  16. { program and are supplied by the user when prompted }
  17.  
  18.  
  19. Program ArcSine (input,output);
  20.  
  21. Var
  22.  Sine,Cosine,Tangent,Val,Tval : real;
  23.  Datain,Dataout : text;
  24.  FileName1,FileName2 : String[14];
  25.  Choice : integer;
  26.  
  27. Begin
  28.  Writeln('          ***********************************************');
  29.  Writeln('          *                                             *');
  30.  Writeln('          *            ** Transform Choices **          *');
  31.  Writeln('          *                                             *');
  32.  Writeln('          *         (1) Arc-sine transformation         *');
  33.  Writeln('          *                                             *');
  34.  Writeln('          *         (2) Log-normal transformation       *');
  35.  Writeln('          *                                             *');
  36.  Writeln('          *         (3) Square root tranformation       *');
  37.  Writeln('          *                                             *');
  38.  Writeln('          ***********************************************');
  39.  Writeln('             Type the number of your choice & <return>');
  40.  Readln(choice);
  41.  Clrscr;
  42.  Writeln;writeln;writeln;writeln;writeln;
  43.  Write('                Name of input file:  ');
  44.  Readln(FileName1);
  45.  Writeln;
  46.  Write('                Name of output file:  ');
  47.  Readln(FileName2);
  48.  
  49.  Assign(Datain,FileName1);
  50.  Assign(Dataout,FileName2);
  51.  Reset (Datain);
  52.  Rewrite(Dataout);
  53.  
  54.  Case Choice of
  55.  
  56.    1 : While not EOF(datain) do
  57.          Begin
  58.            Readln(Datain,Val);
  59.            Sine:=SQRT(Val);
  60.            If Sine = 1 then
  61.             Begin
  62.                Sine:=0.99999999999;
  63.             end
  64.            Else
  65.             Begin
  66.          {   Cosine:=SQRT((1-SQR(Sine))); }
  67.          {   Tangent:=Sine/Cosine;   }
  68.           {  Tval:=Arctan(Tangent); }
  69.              Tval:=arctan(val/sqrt(-val*val+1));
  70.             End;
  71.            Writeln(Dataout,Tval:4:4);
  72.          End;
  73.  
  74.     2 : While not EOF(datain) do
  75.          Begin
  76.            Readln(Datain,Val);
  77.            Tval:=LN(Val+1);
  78.            Writeln(Dataout,Tval:4:4);
  79.          End;
  80.  
  81.      3 : While not EOF(datain) do
  82.          Begin
  83.            Readln(Datain,Val);
  84.            Tval:=SQRT(Val+0.5);
  85.            Writeln(Dataout,Tval:4:4);
  86.          End;
  87.  End;
  88.  
  89.  Close(Datain);
  90.  Close(Dataout);
  91. End.
  92.