home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------------------------- *)
- (* SQROOT.PAS *)
- (* Integration der Quadratwurzel-Funktion *)
- (* ------------------------------------------------------------------------- *)
-
- PROGRAM SqRoot;
-
- USES
- NumInt;
-
- CONST
- Max = 100; (* Maximalzahl von Intervallhalbierungenen *)
- m = 15; (* Formatparameter für FLOAT-Zahlen *)
- n = 11;
-
- VAR
- a, b, Result, Error, eps : FLOAT;
- Decimals : BYTE;
-
- {$F+}
- FUNCTION SquareRoot(x : FLOAT) : FLOAT;
- (* die Quadratwurzelfunktion *)
- BEGIN
- SquareRoot := Ln(x);
- END;
- {$F-}
-
- BEGIN
- Write('Integration der Wurzelfunktion:'^M^J^M^J);
- Write('Untergrenze: a = '); Read(a);
- Write('Obergrenze: b = '); Read(b);
- Write('Genauigkeit in Dezimalstellen: '); ReadLn(Decimals);
- Eps := Exp(-ABS(Decimals)*Ln(10));
- IF Adaptive(@Gauss, @SquareRoot, a, b, eps, 1, Max, Result, Error) THEN BEGIN
- WriteLn(^M^J'Ergebnis der Rechnung:'^M^J);
- WriteLn('Integral: I = ', Result:m:n);
- WriteLn(' ±', Error:m:n);
- END ELSE
- WriteLn(^M^J'Geforderte Genauigkeit nicht erreicht !');
- WriteLn;
- END.