diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/math/matrix.php | 9 | ||||
-rw-r--r-- | src/math/polynom.php | 29 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/math/matrix.php b/src/math/matrix.php index 0cfbed3..26da354 100644 --- a/src/math/matrix.php +++ b/src/math/matrix.php @@ -10,6 +10,15 @@ */ /** * Provides a genereic matrix class with basic math operations + * + * The matrix class is used for internal matrix calculations, and it should not + * be required to be used by end users. It offers the common arithmetics + * operations, and a __toString mechanism for debugging. + * + * Beside this it implements more complex matrix algorithms to solve non linear + * equatations using the Gauss-Newton algorithm and LR decomposition using the + * Cholesky-Crout algorithm. These algorithms are required by the average + * polynom calculation in the ezcGraphDataSetAveragePolynom class. * * @version //autogentag// * @package Graph diff --git a/src/math/polynom.php b/src/math/polynom.php index 194681e..718ab5d 100644 --- a/src/math/polynom.php +++ b/src/math/polynom.php @@ -7,9 +7,38 @@ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved. * @license http://ez.no/licenses/new_bsd New BSD License */ + /** * Provides a class for generic operations on polynoms * + * This class is mainly used for internal representation of polynoms in the + * average dataset ezcGraphDataSetAveragePolynom. + * + * It provides only very basic mechanisms to work with polynoms, like adding of + * polynomes and evaluating the polynom with a given number, to calculate a + * point in the chart for a given value on the x axis. + * + * Beside this the __toString implementation may be used to echo the polynoms + * calculated by the least squares mechanism in the above mentioned average + * datasets. The class does not provide any options to customize the output. + * + * The class can be used like: + * + * <code> + * // Equivalent to: x^2 + .5 + * $polynom = new ezcGraphPolynom( array( 2 => 1, 0 => .5 ) ); + * + * // Calculate result for x = 1, echos: 1.5 + * echo $polynom->evaluate( 1 ), PHP_EOL; + * + * // Build the sum with another polynom + * $polynom->add( new ezcGraphPolynom( array( 1 => 1 ) ) ); + * + * // Print polynom, echos: + * // x^2 + x + 5.00e-1 + * echo $polynom, PHP_EOL; + * </code> + * * @version //autogentag// * @package Graph */ |