|
4152 - in trunk/Graph: . src/math tests [eZComponents: Trunk]: msg#00326web.ezcomponents.cvs
Author: Kore Nordmann Date: 2006-11-30 14:59:55 +0100 (Thu, 30 Nov 2006) New Revision: 4152 Log: - Fixed: Bug #9588 (Wrong polynoms build from data) Modified: trunk/Graph/ChangeLog trunk/Graph/src/math/matrix.php trunk/Graph/tests/dataset_average_test.php Modified: trunk/Graph/ChangeLog =================================================================== --- trunk/Graph/ChangeLog 2006-11-30 13:57:47 UTC (rev 4151) +++ trunk/Graph/ChangeLog 2006-11-30 13:59:55 UTC (rev 4152) @@ -8,6 +8,7 @@ - Added feature #9647: Add render to output method - Fixed issue #9612: Element links for SVG image in the legend require you to click on exactly the text. +- Fixed issue #9588: Wrong polynoms build from data - Fixed issue #9586: No data rendered with string keys on date axis. - Fixed issue #9583: Data typecasting should only be done in axis - Fixed issue #9568: Devision by zero warning Modified: trunk/Graph/src/math/matrix.php =================================================================== --- trunk/Graph/src/math/matrix.php 2006-11-30 13:57:47 UTC (rev 4151) +++ trunk/Graph/src/math/matrix.php 2006-11-30 13:59:55 UTC (rev 4152) @@ -339,6 +339,7 @@ { // Build complete equatation $equatation = new ezcGraphMatrix( $this->rows, $columns = ( $this->columns + 1 ) ); + for ( $i = 0; $i < $this->rows; ++$i ) { for ( $j = 0; $j < $this->columns; ++$j ) @@ -357,7 +358,7 @@ { if ( $equatation->get( $j, $i ) == 0 ) { - $factor = 0; + continue; } else { Modified: trunk/Graph/tests/dataset_average_test.php =================================================================== --- trunk/Graph/tests/dataset_average_test.php 2006-11-30 13:57:47 UTC (rev 4151) +++ trunk/Graph/tests/dataset_average_test.php 2006-11-30 13:59:55 UTC (rev 4152) @@ -120,6 +120,44 @@ ); } + public function testCreateDatasetFromDataset4() + { + $points = array(); + for ( $x = -1; $x <= 5; ++$x ) + { + $points[$x] = pow( $x - 2, 3 ) - .21 * pow( $x - 2, 2 ) + .2 * ( $x - 2 ) - 2.45; + } + + $arrayDataSet = new ezcGraphArrayDataSet( $points ); + + $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet, 3 ); + $polynom = $averageDataSet->getPolynom(); + + $this->assertEquals( + '1.00 * x^3 + -6.21 * x^2 + 13.04 * x + -11.69', + $polynom->__toString() + ); + } + + public function testCreateDatasetFromDataset5() + { + $points = array(); + for ( $x = -3; $x <= 3; ++$x ) + { + $points[$x] = pow( $x, 3 ) - .21 * pow( $x, 2 ) + .2 * $x - 2.45; + } + + $arrayDataSet = new ezcGraphArrayDataSet( $points ); + + $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet, 3 ); + $polynom = $averageDataSet->getPolynom(); + + $this->assertEquals( + 'x^3 + -0.21 * x^2 + 0.20 * x + -2.45', + $polynom->__toString() + ); + } + public function testCreateDatasetFromDatasetLowOrder() { $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) ); |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | 4151 - trunk/Template/tests/scripts [eZComponents: Trunk]: 00326, Jan Borsodi |
|---|---|
| Next by Date: | 4153 - trunk/Template/docs [eZComponents: Trunk]: 00326, Jan Borsodi |
| Previous by Thread: | 4151 - trunk/Template/tests/scripts [eZComponents: Trunk]i: 00326, Jan Borsodi |
| Next by Thread: | 4153 - trunk/Template/docs [eZComponents: Trunk]: 00326, Jan Borsodi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |