home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1987 / 03 / extreme.inc < prev    next >
Encoding:
Text File  |  1987-02-03  |  1.5 KB  |  43 lines

  1. (*****************************************************************************)
  2. (*                                                                           *)
  3. (*                        ---  EXTREME.INC  ---                              *)
  4. (*                                                                           *)
  5. (*               Unterprogramm-Modul zur Extremwertberechung                 *)
  6. (*                                                                           *)
  7. (*****************************************************************************)
  8.  
  9.  
  10. Procedure FindExtremeValues;
  11.  
  12.  
  13.    Var x,dx,
  14.        xmin,xmax :Real;
  15.        found,
  16.        Success   :Boolean;
  17.  
  18.    Begin
  19.    ClrScr;
  20.    WriteLn ('Extremwertbestimmung'); WriteLn;
  21.    Write ('im Bereich von xmin='); Read (xmin);
  22.    Write (' bis xmax='); Read (xmax);
  23.    Write (' mit Schrittweite dx='); ReadLn (dx);
  24.    WriteLn; WriteLn;
  25.    found := false;
  26.    x := Solve (xmin,xmax,dx,1,Success);
  27.    If Success then
  28.       Repeat
  29.          If (fn(x-dx,1) > 0) and (fn(x+dx,1) < 0) then
  30.             Write ('H')
  31.          else
  32.             if (fn(x-dx,1) < 0) and (fn(x+dx,1) > 0) then
  33.                Write ('T')
  34.             else
  35.                Write ('S');
  36.          WriteLn (' (',x:m:n,', ',fn(x,0):m:n,')');
  37.          found := true;
  38.          xmin := x + dx;
  39.          x := Solve (xmin,xmax,dx,1,Success)
  40.       until not Success or (x>xmax);
  41.    if not found then WriteLn ('Keine Extremwerte gefunden!')
  42.    End;
  43.