PHPackages                             filmtools/polynomial - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. filmtools/polynomial

ActiveLibrary

filmtools/polynomial
====================

2.0.1(7y ago)020MITPHPPHP ^7.1

Since Apr 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/filmtools/polynomial)[ Packagist](https://packagist.org/packages/filmtools/polynomial)[ RSS](/packages/filmtools-polynomial/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (5)Versions (12)Used By (0)

FilmTools · Polynomial
======================

[](#filmtools--polynomial)

**Tools for working with simple polynomial models.**

Installation
------------

[](#installation)

```
$ composer require filmtools/polynomial
```

Upgrading from v1
-----------------

[](#upgrading-from-v1)

From v2 on, this package now uses *SplFixedArrays* wherever possible. This will likely affect all your *CoefficientProviderInterface* implementations, as they now are required to return *\\SplFixedArray*.

Wherever you calculate with *FromCoefficientsInterpolator* or *MultipleInterpolator*, you get *\\SplFixedArray* results. When you rely on array results, just call `$result->toArray()` as defined in [SplFixedArray](https://www.php.net/manual/de/class.splfixedarray.php) methods API.

What's in the package
---------------------

[](#whats-in-the-package)

### Interfaces

[](#interfaces)

**CoefficientsProviderInterface:**Returns the coefficients of the polynomial model.

```
public function getCoefficients(): \SplFixedArray;

```

**InterpolatorInterface:**Find an y value for a given x coordinate.

```
public function interpolate( float $x ): float;

```

**XFinderInterface:**Find an x for a given y, as opposite to *InterpolatorInterface*::interpolate

```
public function findX( float $y ) : float;

```

**PolynomialModelInterface**extends the above *InterpolatorInterface,* *XFinderInterface*, and *CoefficientsProviderInterface*

**PolynomialModelProviderInterface**returns a polynomial model interface instance.

```
public function getPolynomialModel(): PolynomialModelInterface;

```

### FromCoefficientsInterpolator

[](#fromcoefficientsinterpolator)

This callable class interpolates a **iterable with X values** using the **coefficients** given on invokation:

```
