Browse Source

+ Added many functions, mainly statistical

michael 25 years ago
parent
commit
8cd65ed74a
1 changed files with 83 additions and 40 deletions
  1. 83 40
      docs/math.tex

+ 83 - 40
docs/math.tex

@@ -62,7 +62,7 @@ argument \var{x} should lie between -1 and 1 (borders included).
 If the argument \var{x} is not in the allowed range, an
 If the argument \var{x} is not in the allowed range, an
 \var{EInvalidArgument} exception is raised.
 \var{EInvalidArgument} exception is raised.
 \SeeAlso
 \SeeAlso
-\seef{arsin}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
+\seef{arcsin}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
 \end{function}
 \end{function}
 
 
 \FPCexample{ex1}
 \FPCexample{ex1}
@@ -81,7 +81,7 @@ compatibility.
 If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
 If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
 exception is raised.
 exception is raised.
 \SeeAlso
 \SeeAlso
-\seef{cosh}, \seef{sinh}, \seef{arsin}, \seef{arsinh}, \seef{artanh},
+\seef{cosh}, \seef{sinh}, \seef{arcsin}, \seef{arsinh}, \seef{artanh},
 \seef{tanh}
 \seef{tanh}
 \end{function}
 \end{function}
 
 
@@ -97,7 +97,7 @@ argument \var{x} should lie between -1 and 1.
 If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
 If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
 exception is raised.
 exception is raised.
 \SeeAlso
 \SeeAlso
-\seef{arcos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
+\seef{arccos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
 \end{function}
 \end{function}
 
 
 \FPCexample{ex2}
 \FPCexample{ex2}
@@ -107,7 +107,7 @@ exception is raised.
 \Declaration
 \Declaration
 Function arctan2(x,y : float) : float;
 Function arctan2(x,y : float) : float;
 \Description
 \Description
-\var{arctan2} calculates \var{arctan(y/x), and returns an angle in the
+\var{arctan2} calculates \var{arctan(y/x)}, and returns an angle in the
 correct quadrant. The returned angle will be in the range $-\pi$ to
 correct quadrant. The returned angle will be in the range $-\pi$ to
 $\pi$ radians.
 $\pi$ radians.
 The values of \var{x} and \var{y} must be between -2\^{}64 and 2\^{}64,
 The values of \var{x} and \var{y} must be between -2\^{}64 and 2\^{}64,
@@ -118,7 +118,7 @@ On Intel systems this function is implemented with the native intel
 \Errors
 \Errors
 If \var{x} is zero, an overflow error will occur.
 If \var{x} is zero, an overflow error will occur.
 \SeeAlso
 \SeeAlso
-\seef{arcos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
+\seef{arccos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
 \end{function}
 \end{function}
 
 
 \FPCexample{ex6}
 \FPCexample{ex6}
@@ -135,7 +135,7 @@ compatibility.
 \Errors
 \Errors
 None.
 None.
 \SeeAlso
 \SeeAlso
-\seef{arcosh}, \seef{arcos}, \seef{arsin}, \seef{artanh}
+\seef{arcosh}, \seef{arccos}, \seef{arcsin}, \seef{artanh}
 \end{function}
 \end{function}
 
 
 \FPCexample{ex4}
 \FPCexample{ex4}
@@ -154,7 +154,7 @@ The \var{arctanh} variant of this function is supplied for \delphi compatibility
 In case \var{x} is not in the interval [-1,1], an \var{EInvalidArgument}
 In case \var{x} is not in the interval [-1,1], an \var{EInvalidArgument}
 exception is raised.
 exception is raised.
 \SeeAlso
 \SeeAlso
-\seef{arcosh}, \seef{arcos}, \seef{arsin}, \seef{artanh}
+\seef{arcosh}, \seef{arccos}, \seef{arcsin}, \seef{artanh}
 \Errors
 \Errors
 \SeeAlso
 \SeeAlso
 \end{function}
 \end{function}
@@ -434,11 +434,11 @@ will occur.
 Function max(Int1,Int2:Cardinal):Cardinal;
 Function max(Int1,Int2:Cardinal):Cardinal;
 Function max(Int1,Int2:Integer):Integer;
 Function max(Int1,Int2:Integer):Integer;
 \Description
 \Description
-\var{Max} returns the the maximum of \var{Int1} and \var{Int2}.
+\var{Max} returns the maximum of \var{Int1} and \var{Int2}.
 \Errors
 \Errors
 None.
 None.
 \SeeAlso
 \SeeAlso
-\seef{min}, \seef{maxIntValue}, \seef{\maxvalue}
+\seef{min}, \seef{maxIntValue}, \seef{maxvalue}
 \end{function}
 \end{function}
 
 
 \FPCexample{ex24}
 \FPCexample{ex24}
@@ -447,124 +447,164 @@ None.
 \Declaration
 \Declaration
 function MaxIntValue(const Data: array of Integer): Integer;
 function MaxIntValue(const Data: array of Integer): Integer;
 \Description
 \Description
-\var{MaxIntValue} returns the biggest integer out of the \var{Data}
+\var{MaxIntValue} returns the largest integer out of the \var{Data}
 array.
 array.
+
+This function is provided for \delphi compatibility, use the \seef{maxvalue}
+function instead.
 \Errors
 \Errors
 None.
 None.
 \SeeAlso
 \SeeAlso
 \seef{maxvalue}, \seef{minvalue}, \seef{minIntValue}
 \seef{maxvalue}, \seef{minvalue}, \seef{minIntValue}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
+\FPCexample{ex25}
 
 
 
 
 \begin{function}{maxvalue}
 \begin{function}{maxvalue}
 \Declaration
 \Declaration
 Function maxvalue(const data : array of float) : float;
 Function maxvalue(const data : array of float) : float;
+Function maxvalue(const data : array of Integer) : Integer;
+Function maxvalue(const data : PFloat; Const N : Integer) : float;
+Function maxvalue(const data : PInteger; Const N : Integer) : Integer;
 \Description
 \Description
+\var{Maxvalue} returns the largest value in the \var{data} 
+array with integer or float values. The return value has 
+the same type as the elements of the array.
 
 
+The third and fourth forms accept a pointer to an array of \var{N} 
+integer or float values.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{maxIntValue}, \seef{minvalue}, \seef{minIntValue}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
-
+\FPCexample{ex26}
 
 
 \begin{function}{mean}
 \begin{function}{mean}
 \Declaration
 \Declaration
 Function mean(const data : array of float) : float;
 Function mean(const data : array of float) : float;
+Function mean(const data : PFloat; Const N : longint) : float;
 \Description
 \Description
+\var{Mean} returns the average value of \var{data}.
 
 
+The second form accepts a pointer to an array of \var{N} values.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seep{meanandstddev}, \seep{momentskewkurtosis}, \seef{sum}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
-
+\FPCexample{ex27}
 
 
-  var mean,stddev : float);
 \begin{procedure}{meanandstddev}
 \begin{procedure}{meanandstddev}
 \Declaration
 \Declaration
-Procedure meanandstddev(const data : array of float;
+Procedure meanandstddev(const data : array of float; 
+                        var mean,stddev : float);
+procedure meanandstddev(const data : PFloat;
+  Const N : Longint;var mean,stddev : float);
 \Description
 \Description
+\var{meanandstddev} calculates the mean and standard deviation of \var{data}
+and returns the result in \var{mean} and \var{stddev}, respectively.
 
 
+The second form accepts a pointer to an array of \var{N} values.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{mean},\seef{sum}, \seef{sumofsquares}, \seep{momentskewkurtosis}
 \end{procedure}
 \end{procedure}
 
 
-\FPCexample{}
+\FPCexample{ex28}
 
 
 
 
 \begin{function}{min}
 \begin{function}{min}
 \Declaration
 \Declaration
 Function min(Int1,Int2:Cardinal):Cardinal;
 Function min(Int1,Int2:Cardinal):Cardinal;
-\Description
-
-\Errors
-\SeeAlso
-\end{function}
-
-\FPCexample{}
-
-
-\begin{function}{min}
-\Declaration
 Function min(Int1,Int2:Integer):Integer;
 Function min(Int1,Int2:Integer):Integer;
 \Description
 \Description
-
+\var{min} returns the smallest value of \var{Int1} and \var{Int2};
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{max}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
-
+\FPCexample{ex29}
 
 
 \begin{function}{minIntValue}
 \begin{function}{minIntValue}
 \Declaration
 \Declaration
 Function minIntValue(const Data: array of Integer): Integer;
 Function minIntValue(const Data: array of Integer): Integer;
 \Description
 \Description
+\var{MinIntvalue} returns the smallest value in the \var{Data} array.
 
 
+This function is provided for \delphi compatibility, use \var{minvalue}
+instead.
 \Errors
 \Errors
+None
 \SeeAlso
 \SeeAlso
+\seef{minvalue}, \seef{maxIntValue}, \seef{maxvalue}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
+\FPCexample{ex30}
 
 
 
 
 \begin{function}{minvalue}
 \begin{function}{minvalue}
 \Declaration
 \Declaration
 Function minvalue(const data : array of float) : float;
 Function minvalue(const data : array of float) : float;
+Function minvalue(const data : array of Integer) : Integer;
+Function minvalue(const data : PFloat; Const N : Integer) : float;
+Function minvalue(const data : PInteger; Const N : Integer) : Integer;
 \Description
 \Description
+\var{Minvalue} returns the smallest value in the \var{data} 
+array with integer or float values. The return value has 
+the same type as the elements of the array.
 
 
+The third and fourth forms accept a pointer to an array of \var{N} 
+integer or float values.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{maxIntValue}, \seef{maxvalue}, \seef{minIntValue}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
+\FPCexample{ex31}
 
 
 
 
 \begin{procedure}{momentskewkurtosis}
 \begin{procedure}{momentskewkurtosis}
 \Declaration
 \Declaration
-Procedure momentskewkurtosis(const data : array of float;
+procedure momentskewkurtosis(const data : array of float;
+  var m1,m2,m3,m4,skew,kurtosis : float);
+procedure momentskewkurtosis(const data : PFloat; Const N : Integer;
+  var m1,m2,m3,m4,skew,kurtosis : float);
 \Description
 \Description
-
+\var{momentskewkurtosis} calculates the 4 first moments of the distribution
+of valuesin \var{data} and returns them in \var{m1},\var{m2},\var{m3} and
+\var{m4}, as well as the \var{skew} and \var{kurtosis}.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{mean}, \seep{meanandstddev}
 \end{procedure}
 \end{procedure}
 
 
-\FPCexample{}
-
+\FPCexample{ex32}
 
 
 \begin{function}{norm}
 \begin{function}{norm}
 \Declaration
 \Declaration
 Function norm(const data : array of float) : float;
 Function norm(const data : array of float) : float;
+Function norm(const data : PFloat; Const N : Integer) : float;
 \Description
 \Description
+\var{Norm} calculates the Euclidian norm of the array of data.
+This equals \var{sqrt(sumofsquares(data))}.
 
 
+The second form accepts a pointer to an array of \var{N} values.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{sumofsquares}
 \end{function}
 \end{function}
 
 
-\FPCexample{}
+\FPCexample{ex33}
 
 
 
 
 \begin{function}{popnstddev}
 \begin{function}{popnstddev}
@@ -595,9 +635,12 @@ Function popnvariance(const data : array of float) : float;
 \Declaration
 \Declaration
 Function power(base,exponent : float) : float;
 Function power(base,exponent : float) : float;
 \Description
 \Description
-
+\var{power} raises \var{base} to the power \var{power}. This is equivalent
+to \var{exp(power*ln(base))}. Therefore \var{base} should be non-negative.
 \Errors
 \Errors
+None.
 \SeeAlso
 \SeeAlso
+\seef{intpower}
 \end{function}
 \end{function}
 
 
 \FPCexample{}
 \FPCexample{}