*Name: print
*Type: BuildinFunction
*Section: 51 General Functions
*Parameters: (Any) arg...
*Return: -1
*DescriptionShort: Prints one or more expressions
*DescriptionLong:
 The print function simply prints the result of an arbitrary number
 of expressions. In other words: First arg0 will be calculated then
 arg1 and so on. print explicitly prints the type of the results.
*Example:
 (  1)>print(5+4,dincarr(10),"blabla");
 <int> 9
 <dblarr>
            0            1            2            3            4            5 
            6            7            8            9 
 <string> "blabla"
*End:

*Name: printf
*Type: BuildinFunction
*Section: 51 General Functions
*Parameters: (string) format, (Any) arg...
*Return: -1
*DescriptionShort: Formated output of one or more expressions
*DescriptionLong:
 The printf acts in the same way as the corresponding C function.
 For detailed information of the format-string's structure refer to
 a C-introduction.
*Example:
 (  1)>printf("The Value of %s is %g\n","bla",5+4);
 The Value of bla is 9
*End:

*Name: sprintf
*Type: BuildinFunction
*Section: 51 General Functions
*Parameters: (string) format, (Any) arg...
*Return: string (containing the output)
*DescriptionShort: Formated output in a string
*DescriptionLong:
 The sprintf acts in the same way as the printf with the
 only difference that the output is not printed on the console but is stored
 in a string. Note that the Xi version of sprintf has a slightly different
 calling sceem than the coresponding C function.
*Example:
 (  1)>a=sprintf("The Value of %s is %g","bla",5+4);
 (  2)>print(a);
 <string> "The Value of bla is 9"
*SeeAlso: printf
*End:

*Name: ostream
*Type: BuildinFunction
*Section: 51 General Functions
*Parameters: (string) name, (int) ascii = 0, (int) bin = 0, (int) fortran = 0
*Return: ostream  (Containing the output stream)
*DescriptionShort: Opens a file for writing
*DescriptionLong:
 The ostream opens a file name for writing, if the file exists it
 will be erased, so be causious with this function. The ascii flag
 indicates that the file should be written in a readable format, i.e. numbers
 will be explicitly written and arrays are given in tabular order - of cause
 this costs a lot of memory. The bin indicates that the file should
 be written in binary (non-readable) format which is a lot faster and costs
 less memory than the ascii-format. The fortran is usefull if you
 want to write output that could be read by a fortran programm with the
 option unformatted. This format is not readable too.
*Example:
 (  1)>s=ostream("bla.out");
 (  2)>arr=dincarr(5,5);
 (  3)>s << arr;
 (  4)>delete s;
 (  5)>$ cat bla.out
            0            1            2            3            4 
            5            6            7            8            9 
           10           11           12           13           14 
           15           16           17           18           19 
           20           21           22           23           24
*SeeAlso: istream
*End:

*Name: istream
*Type: BuildinFunction
*Section: 51 General Functions
*Parameters: (string) name, (int) ascii = 0, (int) bin = 0, (int) fortran = 0
*Return: ostream  (Containing the output stream)
*DescriptionShort: Opens a file for reading
*DescriptionLong:
The istream opens a file name for reading if it exists.
The flags ascii, bin and fortran have the same
meaning as the corresponding flags of the ostream function.
*Example:
 (  1)>s=istream("bla.out");
 (  2)>double arr[5,5];
 (  3)>s >> arr;
 (  4)>delete s;
 (  5)>print(arr);
 <dblarr>
            0            1            2            3            4 
            5            6            7            8            9 
           10           11           12           13           14 
           15           16           17           18           19 
           20           21           22           23           24 
*SeeAlso: ostream
*End:

*Name: sin
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the sine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: cos
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the cosine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: tan
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the tangent
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: asin
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the arcsine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: acos
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the arccosine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: atan
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the arctangent
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: sinh
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the hyperbolic sine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: cosh
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the hyperbolic cosine
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: tanh
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the hyperbolic tangent
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: exp
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Raises e to the power of value
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: log
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the natural logarithm
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: log10
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the logarithm to the base 10
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: sqrt
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]/complex/complex[]
*DescriptionShort: Calculates the square root
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: abs
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]
*DescriptionShort: Calculates the absolute value
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: real
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]
*DescriptionShort: Returns the real part of complex numbers
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: imag
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]
*DescriptionShort: Returns the imaginary part of complex numbers
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: norm
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) value
*Return: double/double[]
*DescriptionShort: Calculates the norm of the complex numbers
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: pow
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]/complex/complex[]) basis,
             (double/complex) exponent
*Return: double/double[]/complex/complex[]
*DescriptionShort: Raises basis to the power of exponent
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: fft
*Type: BuildinFunction
*Section: 533 Fast Fourier Transform
*Parameters: (complex[]) array, (int) index...
*Return: complex[] (fast fourier transform, space to frequency)
*DescriptionShort: Multivariate fast fourier transform
*DescriptionLong:
 fft performs a multivariate complex fast fourier transform to
 go form space to frequency using mixed-radix fast fourier transform 
 algorithm. The parameter array contains a multidimensional array
 for which the FFT should be computed. The parameters index1, index2 etc.
 determine the indices over which the FFT will be performed. If these
 parameters are omitted the function fft computes the complete FFT of the
 input array.
*Example:
 (  1)>a=dincarr(3,3);
 (  2)>b=fft(a);
 (  3)>e=fft(a,0,1);
 (  4)>c=fft(a,0); 
 (  5)>d=fft(c,1);
              now b, d and e are equal        
*SeeAlso: rev_fft
*Reference:
 This function is based on the subroutine
 multifft in the GO collection.(By R.C. Singleton, Stanford Research
 Institute, Sept. 1968).
*End:

*Name: rev_fft
*Type: BuildinFunction
*Section: 533 Fast Fourier Transform
*Parameters: (complex[]) array, (int) index...
*Return: complex[] (fast fourier transform, frequency to space)
*DescriptionShort: Multivariate fast fourier transform
*DescriptionLong:
rev_fft performs a multivariate complex fast fourier transform to
go form frequency to space using mixed-radix fast fourier transform 
algorithm. The parameter array contains a multidimensional array
for which the FFT should be computed. The parameters index1, index2 etc.
determine the indices over which the FFT will be performed. If these
parameters are omitted the function <EM>fft</EM> computes the complete
FFT of  the input array.
*Example:
 (  1)>a=dincarr(3,3);
 (  2)>b=rev_fft(a);
 (  3)>c=rev_fft(a,0);
 (  4)>e=fft(a,0,1); 
 (  5)>d=rev_fft(fft(a,0),0);
              now e is equal b and d is equal a        
*SeeAlso: fft
*Reference:
 This function is based on the subroutine
 multifft in the GO collection.(By R.C. Singleton, Stanford Research
 Institute, Sept. 1968).
*End:

*Name: resize
*Type: BuildinFunction
*Section: 534 Interpolation
*Parameters: (Any[]) array, (int)dim...,
             (int) sample = 0, (int) linear = 0
*Return: Any[]  (matches array)
*DescriptionShort: Resizes an array
*DescriptionLong:
 This functions resizes a multidimensional array. The new dimensions are given
 by the parameters dim1, dim2, ... . If the flag sample i
 set resize uses nearst neigbbourhood sampling to magnify or shrink the
 array. Set linear to advice resize to use the
 multilinear interpolation method. If either sample or linear
 are given resize uses nearst neigbbourhood sampling.
*Example:
 (  1)>a=dincarr(5);
 (  2)>b=resize(a,10,\linear);
 (  3)>c=resize(a,10,\sample);
 (  4)>print(a,b,c);
 <dblarr>
            0            1            2            3            4 
 <dblarr>
          0.2          0.6            1          1.4          1.8
          2.2          2.6            3          3.4          3.8 
 <dblarr>
            0            0            1            1            2
            2            3            3            4            4 
*SeeAlso:
*End:

*Name: invert
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: double[]/complex[] (inverse of the matrix)
*DescriptionShort: Calculates the inerse of a square matrix
*DescriptionLong:
 This function computes the inverse of a matrix using the LU
 factorization.
*Example:
 (  1)>print(invert(dincarr(2,2)));
 <dblarr>
         -1.5          0.5 
            1            0 
 (  2)>print(invert(dincarr(2,2))#dincarr(2,2));
 <dblarr>
            1            0 
            0            1 
*SeeAlso:
*Reference:
 This function is based on the subroutines dgetrf and zgetrf of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: determ
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: double/complex (the determinant of the matrix)
*DescriptionShort: Calculates the determinant of a square matrix
*DescriptionLong:
 The function determ computes the determinant of a sqaure
 real or complex matrix using LU decomposition.
*Example:
 (  1)>print(determ(dincarr(2,2)));
 <double> -2
*SeeAlso:
*Reference:
 This function is based on the subroutines dgetrf and zgetrf of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: rcond
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: double/complex (reciprocal of the condition number)
*DescriptionShort: Estimates the reciprocal of a condition number of a matrix
*DescriptionLong:
 rcond returns the reciprocal of the condition number of a real
 or complex matrix in 1-norm,  using the LU factorization. To compute
 this number an estimate is obtained for norm(inv(A)).
*Example:
 (  1)>print(rcond(dincarr(2,2)));
 <double> 0.1
*SeeAlso:
*Reference:
 This function is based on the subroutines dgecon and zgecon of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     February 29, 1992
 
*End:

*Name: rcond_inf
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: double/complex (reciprocal of the condition number)
*DescriptionShort: Estimates the reciprocal of a condition number of a matrix
*DescriptionLong:
 rcond returns the reciprocal of the condition number of a real
 or complex matrix in the infinity-norm,  using the LU factorization.
 To compute this number an estimate is obtained for norm(inv(A)).
*Example:
 (  1)>print(rcond_inf(dincarr(2,2)));
 <double> 0.1
*SeeAlso:
*Reference:
 This function is based on the subroutines dgecon and zgecon of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     February 29, 1992
 
*End:

*Name: eigenvector
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: double[]/complex[] (eigenvectors of the matrix)
*DescriptionShort: Calculates the eigenvectors of a square matrix
*DescriptionLong:
 eigenvector performs a QR decomposition of the matrix to
 get the eigenvectors of a square matrix. The return value is a matrix.
 The eigenvectors are stored in the columns of the return matrix.
 The computed eigenvectors are normalized to have Euclidean norm equal to 1.
*Example:
 (  1)>print(eigenvector(dincarr(2,2)));
 <dblarr>
  0.2703230127 -0.8719282093 
  0.9627696863  0.4896337385 
*SeeAlso:
*Reference:
 This function is based on the subroutines dgeev and zgeev of LAPACK.
 
 *  -- LAPACK driver routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: eigenvalue
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: complex[] (eigenvalues of the matrix)
*DescriptionShort: Calculates the eigenvalues of a square matrix
*DescriptionLong:
 eigenvalue performs a QR decomposition of the square matrix to
 obtain the eigenvalues of a matrix.
*Example:
 (  1)>print(eigenvalue(dincarr(2,2)))
 <cpxarr>
 (  3.561552813,            0) (-0.5615528128,            0) 
*SeeAlso:
*Reference:
 This function is based on the subroutines dgeev and zgeev of LAPACK.
 
 *  -- LAPACK driver routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: lu
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: [double[]/complex[], int[]] (LU factorization, pivot indices)
*DescriptionShort: Calculates the LU decomposition of a matrix
*DescriptionLong:
 lu computes an LU factorization of a real or complex matrix
 using partial pivoting with row interchanges. The factors L and U are
 stored in the lower und upper part of the first return value. The
 unit diagonal elements of L are not stored. The second return value
 is the vector of pivot indices. This vector is needed in the call to
 lu_invert
*Example:
 (  1)>[LU, pivot]=lu(dincarr(2,2));
 (  2)>print(LU,pivot);
 <dblarr>
            2            3 
            0            1 
 <intarr>
 2 2 
*SeeAlso: lu_invert
*Reference:
 This function is based on the subroutines dgetrf and zgetrf of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     March 31, 1993
 
*End:

*Name: qr
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: [double[]/complex[], double[]/complex[]] (QR matrices)
*DescriptionShort: Calculates the QR factorization of a matrix
*DescriptionLong:
 The function qr performs a QR  factorization of a real or complex
 matrix. The elements on and obove the diagonal of the first return value
 (matrix) contain the upper trapezoidal matrix R,the elements below the
 diagonal, with the second return value (vector), represent the orthogonal
 matrix Q as a product of elementary reflectors.
 The matrix Q is represented as a product of elementary reflectors.
  Q = H[1] H[2] . . . H[k]. 
 Each H[i] has the form  H[i] = I - tau[i] * v * v' 
 where tau[i] is the second return value, and v is a vector with
 v[1:i-1] = 0 and v[i] = 1; v[i+1:m] is stored in the first return value.
*Example:
 (  1)>[qr, tau]=qr(dincarr(2,2));
 (  2)>print(qr,tau)
 <dblarr>
            1            0 
 <dblarr>
           -2           -3 
            1           -1 
*SeeAlso:
*Reference:
 This function is based on the subroutines dgeqrf and zgeqrf of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: svd
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) matrix
*Return: [double[]/complex[], double[]/complex[],double[]/complex[]]
*DescriptionShort: Calculates the singular value decomposition of a matrix
*DescriptionLong:
 svd computes the singular value decomposition of a real or complex
 M-by-N matrix A.
 
 A = u * w * vt
 
 The first return value is a vector containing the singular values of A, the
 second is an M-by-M orthogonal matrix and the thrirdis an N-by-N
 orthogonal matrix. The first min(m,n) columns of second and the rows of the
 third return matrix are the left and right singular vectors of A.
*Example:
 (  1)>[w,u,vt]=svd(dincarr(2,2));
 (  2)>print(w,u,vt)
 <dblarr>
  3.702459174 0.5401815135 
 <dblarr>
 -0.2297529205  0.9732489895 
 -0.9732489895 -0.2297529205 
 <dblarr>
 -0.5257311121 -0.8506508084 
 -0.8506508084  0.5257311121 
*SeeAlso: svd_back_sub
*Reference:
 This function is based on the subroutines dgesvd and zgesvd of LAPACK.
 
 *  -- LAPACK driver routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: svd_back_sub
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) w, (double[]/complex[]) u,
             (double[]/complex[]) vt, (double[]/complex[]) b
*Return: double[]/complex[]  (solution of (u*w*vt) * x = b)
*DescriptionShort: Back substitution to solve a system of linear equations
*DescriptionLong:
 This function performs a back substitution to solve a system of
 linear equations. SVD is a useful technique to manage a system of
 equations (matrices) that are nearly singular. A typical use is
*Example:
 (  1)>a={{2.0,2.5,2.5},{2,2.5,2.5},{1.6,-0.4,2.8},{2,-0.5,0.5},{1.2,-0.3,-2.9}}
 (  2)>b={1.0,1.0,0.6,0.0,-0.8}
 (  3)>[w,u,vt]=svd(a)
 (  4)>w[where(w < 1e-10)]=0.0;
 (  5)>x=svd_back_sub(w,u,vt,b);
 (  6)>print(a#x);
 <dblarr>
              1              1            0.6 1.45716772e-16           -0.8 
*SeeAlso: svd
*End:

*Name: lu_invert
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) lu, (int[]) pivot
*Return: double[]/complex[]  (inverse of the matrix to lu)
*DescriptionShort: Second method to invert a matrix
*DescriptionLong:
 If a matrix was decomposed by the function lu the inverse can
 be computed with lu_invert. The function
 invert is based on the same algorithm.
*Example:
 (  1)>[LU, pivot]=lu(dincarr(2,2));
 (  2)>print(lu_invert(LU, pivot));
 <dblarr>
         -1.5          0.5 
            1            0 
*SeeAlso: lu, invert
*Reference:
 This function is based on the subroutines dgetri and zgetri of LAPACK.
 
 *  -- LAPACK routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     September 30, 1994
 
*End:

*Name: linear_solve
*Type: BuildinFunction
*Section: 532 Linear Algebra
*Parameters: (double[]/complex[]) A, (double[]/complex[]) b
*Return: double[]/complex[]  (solution to linear equations Ax=b)
*DescriptionShort: Solves a system of linear equations
*DescriptionLong:
 linear_solve computes the solution to a system of
 linear equations. The algorithm is LU decomposition with partial pivoting
 and row interchanges.
*Example:
 (  1)>print(linear_solve(dincarr(2,2),{1,2}))
 <dblarr>
         -0.5            1 
*SeeAlso: lu
*Reference:
 This function is based on the subroutines dgesv and zgesv of LAPACK.
 
 *  -- LAPACK driver routine (version 2.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
 *     March 31, 1993
 
*End:

*Name: ode_solve
*Type: BuildinFunction
*Section: 537 Ordinary Differential Equations
*Parameters: (Stmt) func, (double[]) y, (double[]) t,
             (double[]) abs_tol = 1.0e-10, (double) rel_tol = 1.0e-10
*Return: double[]  (solution at desired points)
*DescriptionShort: Solving ordinary differential equations
*DescriptionLong:
 ode_solve solves the initial value problem of first order
 ordinary differential equations.
 
      dy/dt = f(t,y) ,  or, in component form,
      dy(i)/dt = f(i) = f(i,t,y(1),y(2),...,y(neq)) (i = 1,...,neq).
 
 This function switches automatically between stiff and nonstiff methods.
 This means that the user does not have to determine whether the
 problem is stiff or not, and the solver will automatically choose the
 appropriate method.  It always starts with the nonstiff method. 
 \b\Xi\b\ the the ordinary differential equation will be determined in
 a similar way like writing down it on a piece of paper.
        (y; t) -> y': y' = f (y,t)
 The vector y describes the initial values for y at the point
 t[0] and the vector t gives the desired values of the independent
 variable. The optional variable rel_tol is the relative tolerance
 parameter. Vector abs_tol gives the absolute tolerance parameter.
 The estimated local error in y[i] will be controlled so as to be less than
 
              error[i] = rel_tol*abs(y[i]) + abs_tol[i]
 
*Example:
 (  1)>t=interval(0,5,10);
 Function interval defined
 (  2)>y=ode_solve([ (y; t)->y' : y'=2*y*t+t*t*t; ], {-0.5}, t,\rel_tol=1e-14);
 (  3)>plot(t,y,\curve,\marker=4);
 (  4)>t=interval(0,2*~pi,100);
 (  5)>double[] f(double y[]) { return { y[1], -y[0] }; }
 Function f defined
 (  6)>y=ode_solve([ (y; t)->y' : y'=f(y);], {0,1}, t);
 (  7)>window(0,\clearAll);
 (  8)>plot(y[0,*], y[1,*],\curve);
 (  9)>u=replicate(x=interval(-1,1,9),10);
 ( 10)>velocity_field(-transpose(u), u, x, x);
 Function arrowHead defined
 Function velocity_field defined
 Function error defined
*SeeAlso:
*Reference:
 This function is based on the subroutine lsoda of ODEPACK
 
 c authors..
 c                      linda r. petzold
 c                      applied mathematics division 8331
 c                      sandia national laboratories
 c                      livermore, ca 94550
 c and
 c                      alan c. hindmarsh,
 c                      mathematics and statistics division, l-316
 c                      lawrence livermore national laboratory
 c                      livermore, ca 94550.
 
*End:

*Name: find_root
*Type: BuildinFunction
*Section: 535 Root Finding and Minimizing of Functions
*Parameters: (Stmt) func, (double[]) x,
             (double) tol = 1.0e-8, (int) fcn_calls = 400
*Return: [double[],double[]] (root of func and function values)
*DescriptionShort: Finds the root of a function
*DescriptionLong:
 The purpose of find_root is to find a zero of a system of n nonlinear
 functions in n variables by a modification of the powell hybrid method.
 The jacobian is calculated by a forward-difference approximation. 
 In \b\Xi\b\ the function func will be determined in a similar way
 like writing down it on a piece of paper.
    x< -> y : y=f (x).
 The parameter x contains an initial estimate of the solution vector.
 Termination occurs when the algorithm estimates that the relative error
 between x and the solution is at most tol. Termination also occurs
 when the number of calls to the function func is at least
 fcn_calls by the end of an iteration.
*Example:
 (  1)>[x,f]=find_root([x->y: y=cos(x);],{2});
 Message: algorithm estimates that the relative error between x and the solution is at most tol in function find_root
 (  2)>print(x,f);
 <dblarr>
  1.570796327 
 <dblarr>
 6.123031769e-17 
 (  3)>print(find_root([x->y: y=cos(x);],{2, 4}));
 Message: algorithm estimates that the relative error between x and the
 solution is at most tol in function find_root
 <dblarr>
  1.570796327   4.71238898 
 (  4)>double[] f(double x[]) { return {sin(x[0]),3*cos(x[1]),cos(x[0]*x[2])};}
 Function f defined
 (  5)>print(find_root( [q->z : z=f(q);], {2,2,2}, \tol=1e-5,\fcn_calls=30));
 Message: algorithm estimates that the relative error between x and the
 solution is at most tol in function find_root
 <dblarr>
  3.141592654  1.570796327          1.5 
*SeeAlso:
*Reference:
 This function is based on the subroutine hybrd1 of MINPACK
 
 c     argonne national laboratory. minpack project. march 1980.
 c     burton s. garbow, kenneth e. hillstrom, jorge j. more
 
*End:

*Name: minimize
*Type: BuildinFunction
*Section: 535 Root Finding and Minimizing of Functions
*Parameters: (Stmt) func, (double[] x),
             (double) tol = 1.0e-8, (int) fcn_calls = 400
*Return: [double[],double[]] (minimum of func and function values)
*DescriptionShort: Finds the minima of a function
*DescriptionLong:
 Use the function minimize to find the minimum of the squares 
 of m nonlinear functions in n variables by a modification of the
 levenberg-marquardt algorithm (To do this the jacobian is calculated by a
 forward-difference approximation). 
 In \b\Xi\b\ the function func will be determined in a similar way
 like writing down it on a piece of paper.
      x -> y : y=f (vector).
 The parameter x contains an initial estimate of the solution vector.
 Termination occurs when the algorithm estimates either that the relative
 error in the sum of squares is at most tol or that
 the relative error between x and the solution is at most tol.
 Termination also occurs when the number of calls to the function func
 is at least fcn_calls by the end of an iteration.
*Example:
 (  1)>[x0,f0]=minimize( [ x->y : y=sin(x); ], {2} );
 Message: algorithm estimates that the relative error between x and the
 solution is at most tol in function minimize
 (  2)>print(x0, f0);
 <dblarr>
  3.141592654 
 <dblarr>
  1.224606354e-16 
 (  3)>print(minimize( [ x->y : y=sin(x); ], {2,5} ));
 Message: algorithm estimates that the relative error between x and the
 solution is at most tol in function minimize
 <dblarr>
  3.141592654  9.424777961 
 (  4)>double[] f(double x[]) { return {sin(x[0]),3*cos(x[1]),cos(x[0]*x[1])};}
 Function f defined
 (  5)>[x,f]=minimize( [q->z : z=f(q);], {1,1}, \tol=1e-5);
 Message: algorithm estimates that the relative error in the sum of squares
 is at most tol in function minimize
(  6)>print(x,f);
 <dblarr>
  0.7711744677  1.597605977 
 <dblarr>
   0.6969779212 -0.08041931522   0.3323210158 
*SeeAlso:
*Reference:
 This function is based on the subroutine lmdif1 of MINPACK
 
 c     argonne national laboratory. minpack project. march 1980.
 c     burton s. garbow, kenneth e. hillstrom, jorge j. more
 
*End:

*Name: erf
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the error function
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: erfc
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the complementary error function
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: gamma
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the gamma function
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: besseli0
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the modified Bessel funcion
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: besseli1
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the modified Bessel funcion
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: besselj0
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the Bessel function of the first kind
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: besselj1
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the Bessel function of the first kind
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: bessely0
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the Bessel function of the second kind
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: bessely1
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double/double[]) value
*Return: double/double[]
*DescriptionShort: Calculates the Bessel function of the second kind
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: set_seed
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (int) number
*Return: int (seed set)
*DescriptionShort: Set the seed for the random number generator
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: get_seed
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters:
*Return: double[] (1634 entries)
*DescriptionShort: Returns the random number generator status
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: recover_seed
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (double[]) value
*Return: -1
*DescriptionShort: Recover the random number generator status 
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: randomu
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (int) number
*Return: double[],-1
*DescriptionShort: Returns sequenze of uniformal distributed random numbers
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: randomn
*Type: BuildinFunction
*Section: 531 Mathematical Functions
*Parameters: (int) number
*Return: double[],-1
*DescriptionShort: Returns sequenze of normal distributed random numbers
*DescriptionLong:
*Example:
*SeeAlso:
*End:

*Name: spline
*Type: BuildinFunction
*Section: 534 Interpolation
*Parameters: (double[]) x, (double[]) y, (double[]) value,
             (double) tension = 0.0 , (double) period = 0.0
*Return: double[] (spline at desired coordinates)
*DescriptionShort: Computes a spline under tension
*DescriptionLong:
 spline computes a spline under tension interpolation of the
 data points given by the vectors x and y. The desired abscissa
 values are determined by the vector value. If tension is nearly
 zero the interpolation will be approximately a cubic spline. For increasing
 tension the result comes closer to a polygonal line. By default the function
 estimates internally the slopes at the two ends of the curve. If 
 period is set spline computes a periodic interpolatory
 spline with this period.
*Example:
 (  1)>x=dincarr(10)/3;
 (  2)>y={2,4,3,2,5,4,7,5,4,7};
 (  3)>value=dincarr(100)/30.;
 (  4)>yn=spline(x,y,value);
 (  5)>plot(value,yn,\marker=3);
*SeeAlso:
*Reference:
 This function is based on the subroutine curv2 of FITPACK.
 
 c
 c                                 coded by alan kaylor cline
 c                           from fitpack -- january 26, 1987
 c                        a curve and surface fitting package
 c                      a product of pleasant valley software
 c                  8603 altus cove, austin, texas 78759, usa
 
*End:

*Name: spline_curve
*Type: BuildinFunction
*Section: 534 Interpolation
*Parameters: (double[]) x, (double[]) y, (double[]) value,
             (double) tension = 0.0 , (int) closed = 0
*Return: [double[], double[]] (x and y coordinates of the spline)
*DescriptionShort: Determines a parametric spline under tension
*DescriptionLong:
 The function spline_curve computes a spline under tension
 passing through a sequence of points (x[0], y[0]), ... , (x[n-1], y[n-1])
 (n is the number of entries of x or y).
 value contains the values to be mapped to the points on the curve
 The interval (0,1) for value is mapped onto the curve. This means 0 is
 mapping to (x[0], y[0]) and 1 mapping to (x[n-1], y[n-1]).
 If tension is nearly zero the interpolation will be approximately a
 cubic spline. For increasing tension the result comes closer to a 
 polygonal line. By default the function estimates internally the
 slopes at the two ends of the curve. If closed is set
 spline_curve computes a closed curve in the plane.
*Example:
 (  1)>i=interval(0,6.28,5);
 Function interval defined
 (  2)>x=cos(i);
 (  3)>y=sin(i);
 (  4)>[xn1, yn1]=spline_curve(x,y,dincarr(100)/100.);
 (  5)>[xn2, yn2]=spline_curve(x,y,dincarr(100)/100.,\closed);
 (  6)>plot(xn1,yn1,\line);
 (  7)>plot(xn2,yn2,\line);
*SeeAlso:
*Reference:
 This function is based on the subroutine kurvp2 and kurvp1 of FITPACK.
 
 c
 c                                 coded by alan kaylor cline
 c                           from fitpack -- january 26, 1987
 c                        a curve and surface fitting package
 c                      a product of pleasant valley software
 c                  8603 altus cove, austin, texas 78759, usa
 
*End:

*Name: derive
*Type: BuildinFunction
*Section: 536 Integration and Differentiation
*Parameters: (double[]) x, (double[]) y, (double[]) value,
             (double) tension = 0.0
*Return: double[] (first derivative at desired coordinates)
*DescriptionShort: Computes the first derivative
*DescriptionLong:
 The function derive differentiates a curve at a given point
 using a spline under tension.  The curve is givin by x and
 y. The desired abscissa values are determined by the vector
 value. If tension is nearly zero the interpolation will be
 approximately a cubic spline. For increasing tension the result comes
 closer to a polygonal line. By default the function estimates internally
 the slopes at the two ends of the curve.
*Example:
 (  1)>x=dincarr(10)/3;
 (  2)>y={2,4,3,2,5,4,7,5,4,7};
 (  3)>value=x;
 (  4)>print(derive(x,y,value));
 <dblarr>
         10.5  1.162708102 -6.150832408  5.440621532  2.388346282  3.005993341 
  3.587680355 -8.356714761   2.83917869           15 
*SeeAlso:
*Reference:
 This function is based on the subroutine curvd of FITPACK.
 
 c
 c                                 coded by alan kaylor cline
 c                           from fitpack -- january 26, 1987
 c                        a curve and surface fitting package
 c                      a product of pleasant valley software
 c                  8603 altus cove, austin, texas 78759, usa
 
*End:

*Name: integrate
*Type: BuildinFunction
*Section: 536 Integration and Differentiation
*Parameters: (double[]) x, (double[]) y,
             (double) start, (double) end,
             (double) tension = 0.0, (double) period = 0.0
*Return: double (value of the integral)
*DescriptionShort: Integrates a function
*DescriptionLong:
 integrate integrates a function specified by a spline
 under tension between two given limits.  The curve is givin by x</EM> and
 y.  If tension is nearly zero the interpolation will be approximately
 a cubic spline. For increasing tension the result comes closer to apolygonal
 line. By default the function estimates internally the slopes at thetwo ends
 of the curve. period is set integrate uses a periodic 
 interpolatory spline with this period.
*Example:
 (  1)>x=interval(0,6.28,20);
 Function interval defined
 (  2)>y=sin(x);
 (  3)>print(integrate(x,y,0,~pi));
 <double> 2.00023
 (  4)>print(integrate(x,y,0,~pi,\tension=10));
 <double> 1.99132
 (  5)>print(integrate(x,y,0,~pi,\period=2*~pi));
 <double> 1.99997
*SeeAlso:
*Reference:
 This function is based on the subroutine curvi of FITPACK.
 
 c
 c                                 coded by alan kaylor cline
 c                           from fitpack -- january 26, 1987
 c                        a curve and surface fitting package
 c                      a product of pleasant valley software
 c                  8603 altus cove, austin, texas 78759, usa
 
*End:

*Name: spline2d
*Type: BuildinFunction
*Section: 534 Interpolation
*Parameters: (double[]) x, (double[]) y, (double[]) z,
             (double[]) xn, (double[]) yn, (int) nppr = 10
*Return: double[] (3d surface at the desired points)
*DescriptionShort: Grid a set of data points in the two dimensional plane
*DescriptionLong:
 spline2d grids a set of data points in a two dimensional plane
 (scattered data interpolation problem). x, y and z contain
 the x,y and z coordinates of the data points.
 xn and yn specify the x and y coordinates
 at which the interpolation function is to be calculated.
 The parameter nppr determines  the desired average number of
 points per region. The infuence region of a point has a area which is
 roughly proportional to nppr
*Example:
*SeeAlso:
*Reference:
 This function is based on the subroutine LOTPS of the module LOTPS
 from package CMLIB.
 
 C     SUBROUTINE LOTPS
 C     THIS VERSION IS DATED 03/04/82.
 C
 C                RICHARD FRANKE
 C                DEPARTMENT OF MATHEMATICS
 C                NAVAL POSTGRADUATE SCHOOL
 C                MONTEREY, CALIFORNIA  93940
 C                     (408)646-2758 / 2206
 
*End:

*Name: window
*Type: BuildinFunction
*Section: 52 2D Plots
*Parameters: (int) num = -1 , (int) bpp = 1, (string) title = ""
             (int[]) size = {600,600}, (int[]) position = {0,0},
             close = 0, name = "", eps = 0, ppm = 0, t3d = 0
*Return: -1
*DescriptionShort: Opens a window and changes it's properties
*DescriptionLong:
 window is the basic function to open a graphic-device. Each
 graphic-device is represented by a number num (-1 means the
 actual device). The parameter bpp sets the bits per pixel of the
 device and can NOT be changed afterwards. If you need more colors you have to
 create a new device with enough bits per pixel. The close flag
 indicates that the device num should be closeed and eventually all
 output should be written to disk. size simply sets the x and y
 resolution of the device. Since all devices are vectorbased the size can be
 changed afterward. 
 If neither the eps flag nor the ppm flag are set
 window set the properties of a X-graphic-device or opens a
 new one. title changes the title of the X-window and
 position sets the x and y coordinates (on the screen) of the
 upper left corner of the window. If position is not given the
 window will be placed anywhere on the screen (depending on the
 window-manager). 
 If the eps flag or the ppm flag are set
 window will be an EPS- respectively PPM-graphic-device. name
 sets the outputname for both devices. If name is not given a
 file "xigraph.eps" respectively "xigraph.ppm" will be written. Note that
 the size of the EPS-graphic-device is measured in units of
 1/10 Milimeters. By default the size of an EPS-device is 1200x1200 i.e.
 12x12 centimeters.
*Example:
*SeeAlso:
*End:

*Name: plot
*Type: BuildinFunction
*Section: 52 2D Plots
*Parameters: (double[]) x = {}, (double[]) y = {},
             (double[]) xerr = {}, (double[]) yerr = {}, (int) color = -1,
             (double[]) xrange = {}, (double[]) yrange = {},
	     (string) title = "", (string) xtitle = "", (string) ytitle = "",
	     (int) num =0, (double[]) position = {},
	     (int) erase = 0, (int) line = 0, (int) curve = 0,
	     (int) marker = 0, (int) noaxis, (int) hist = 0,
	     (double) histzero = 0.0
*Return: -1
*DescriptionShort: General plotting function
*DescriptionLong:
 plot is a general graphical output function that should work for the
 most purposes. x and y are generally arrays filled with
 x and y coordinates. They should be of the same dimension. If not so
 one of them will be truncated to match the dimension of the other.
 If nothing more is determined plot simply sets points at the given
 coordinates. The x- and y-ranges will be set suitably. 
 xerr and yerr are arrays that should be of the same
 dimension as x and y. xerr and yerr
 define the absolute errors (positiv number) of the given points. If one or
 both are given plot draws errorbars around each datapoint. 
 xrange and yrange set the x and y ranges of the plot, both
 can be changed afterwards. title sets the title of the whole plot,
 xtitle and ytitle set the titles of the x- and y-axis. 
 If the line flag is set the points will be connected by straight
 lines. The curve flag indicates that the points should be
 connected by a spline curve. Note that in this case spline means a
 spline in the plane not a function of the x coordinates (use the
 spline function for something like this). 
 With the use of marker a special marker around each point can be
 drawn. Actually the following markers are known:
 
    1           a "x" sign
    2           a "+" sign
    3           a "*" sign (more exactly a "x" together with "+")
    4           a small triangle
    5           a small diamond
    6           a small square
 
 If marker is set to any other value simply a point is drawn. 
 color sets the drawing color. The displayed color depends on
 the number of bits per pixel the graphic-device supports. 
 The num and position are useful if you want to draw more
 than one plot in a graphic-device. num simply sets the number of the
 actual plot or opens a new one. With position you define
 device-normal-coordinates where the plot num should be located. 
 noaxis instructs Xi to draw no axis. 
 If the parameter hist is set a histogram will ploted.
 The parameter histzero determine the minimum of the histogram
 (default is zero).
*Example:
*SeeAlso:
*End:

*Name: point
*Type: BuildinFunction
*Section: 52 2D Plots
*Parameters: (double/double[]) x = {}, (double/double[]) y = {},
             (int) color = -1, (int) marker = 0
*Return: -1
*DescriptionShort: Sets one or more points or markers
*DescriptionLong:
 The point function is an easy interface for the
 plot function. If x and y are merely
 numbers points sets a single point or marker (set by the
 marker parameter) with the  color color. If x
 and y are arrays point sets a bunch of points or markers
 at once.
*Example:
*SeeAlso: plot
*End:

*Name: line
*Type: BuildinFunction
*Section: 52 2D Plots
*Parameters: (double/double[]) x1 = {}, (double/double[]) y1 = {},
             (double) x1, (double) y2, (int) color = -1
*Return: -1
*DescriptionShort: Draws a line or (unfilled) polygon
*DescriptionLong:
 line is also an interface for the plot function.
 If x1 and y1 are simply numbers the parameters x2
 and y2 must also be specified. In this case <TT>line</TT> draws
 a straight line form x1,y1 to x2,y2 with
 the color color. If x1 and y1 are arrays,
 x2 and y2 should be left blank. In this case <TT>line</TT>
 acts the same way as the plot function with the
 line flag set.
*Example:
*SeeAlso: plot
*End:

*Name: contour
*Type: BuildinFunction
*Section: 52 2D Plot
*Parameters: (double[]) z, (double[]) x, (double[]) y,
             (double[]) levels, (int) nlevels
*Return: -1
*DescriptionShort: Draws a contour plot
*DescriptionLong:
 contour draws a contour plot of a 2-dimensional function
 z. If x and y are not given contour
 takes the indices of z as x and y coordinates. Otherwise
 you can specify the x and y coordinates of each point. x and
 y must have the same dimensions as z. 
 The nlevel argument explicitly sets the number of levels
 contour should use. Tell contour at which z-values you
 want a contour line to be drawn with the levels argument.
*Example:
*SeeAlso:
*End:

