mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-12 10:18:39 +00:00
43 lines
1.0 KiB
PHP
Executable File
43 lines
1.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Jingga
|
|
*
|
|
* PHP Version 8.1
|
|
*
|
|
* @package tests
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 2.0
|
|
* @version 1.0.0
|
|
* @link https://jingga.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\tests\Math\Numerics\Interpolation;
|
|
|
|
use phpOMS\Math\Numerics\Interpolation\LagrangeInterpolation;
|
|
|
|
/**
|
|
* @testdox phpOMS\tests\Math\Numerics\Interpolation\LagrangeInterpolationTest: Lagrange interpolation
|
|
*
|
|
* @internal
|
|
*/
|
|
final class LagrangeInterpolationTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
/**
|
|
* @testdox The lagrange interpolation is correct
|
|
* @covers phpOMS\Math\Numerics\Interpolation\LagrangeInterpolation
|
|
* @group framework
|
|
*/
|
|
public function testInterpolation() : void
|
|
{
|
|
$interpolation = new LagrangeInterpolation([
|
|
['x' => 0.0, 'y' => 2.0],
|
|
['x' => 1.0, 'y' => 3.0],
|
|
['x' => 2.0, 'y' => 12.0],
|
|
['x' => 5.0, 'y' => 147.0],
|
|
]);
|
|
|
|
self::assertEqualsWithDelta(35.0, $interpolation->interpolate(3.0), 0.1);
|
|
}
|
|
}
|