Source for file LagrangeInterpolation.php
Documentation is available at LagrangeInterpolation.php
require_once "../Matrix.php";
* Given n points (x0,y0)...(xn-1,yn-1), the following methid computes
* the polynomial factors of the n-1't degree polynomial passing through
* Example: Passing in three points (2,3) (1,4) and (3,7) will produce
* the results [2.5, -8.5, 10] which means that the points are on the
* curve y = 2.5x² - 8.5x + 10.
* @see http://geosoft.no/software/lagrange/LagrangeInterpolation.java.html
* @author Paul Meagher (port to PHP and minor changes)
$data = array(); // double[n][n];
$rhs = array(); // double[n];
for ($i = 0; $i < $n; $i++ ) {
for ($j = 0; $j < $n; $j++ ) {
return $s->getRowPackedCopy();
$x = array(2.0, 1.0, 3.0);
$y = array(3.0, 4.0, 7.0);
for ($i = 0; $i < 3; $i++ )
|