2017 © Pedro Peláez
 

library tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

image

necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  • Thursday, March 17, 2016
  • by necromant2005
  • Repository
  • 1 Watchers
  • 2 Stars
  • 4,352 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 3 % Grown

The README.md

tt-math

Build Status, (*1)

Introduction

Standard Math Algorithms: Running Average, Linear Interpolation, (*2)

Features / Goals

  • Simple functional API
  • Implementation Running Average with custom window size
  • Implementation Running Average with custom window size and Edge binding
  • Implementation Linear interpolation
  • Implementation Derivative
  • Implementation Local Extremum

Installation

Main Setup

With composer

  1. Add this to your composer.json:
"require": {
    "necromant2005/tt-math": "1.*",
}
  1. Now tell composer to download TweeMath PHP SDK by running the command:
$ php composer.phar update

Usage

Running average using with window size = 2, (*3)

use TweeMath\Algorithm;

Algorithm\RunningAverage(array(0 => 0, 1 => 2, 3 => 3, 4 => 5, 5 => 3, 6 => 1), 2);
// array(1 => 1,  4 => 4, 6 => 2)

Running average using with window size = 2 and edges binding, (*4)

use TweeMath\Algorithm;

Algorithm\RunningAverageEdge(array(0 => 0, 1 => 2, 3 => 3, 4 => 5, 5 => 3), 2);
// array(0 => 0, 1 => 1,  4 => 4, 5 => 3)

Linear interpolation for the next point x=2, (*5)

use TweeMath\Algorithm;

Algorithm\LinearInterpolation(array(0 => 0, 1 => 1), 2); // 2

Linear interpolation for large numbers for the next point max + 2, (*6)

use TweeMath\Algorithm;

$max = (PHP_MAX_INT >> 1)  + 1000;
Algorithm\LinearInterpolationGracefull(array(time() => $max, time() + 1 => $max + 1), time() + 2); // $max + 2

Derivative for input with epsilon = 1, (*7)

use TweeMath\Algorithm;

Algorithm\Derivative(array(0 => 0, 1 => 2, 4 => 5, 6 => 1), 1); 
// array(0 => 2, 1 => 3, 4 => -5)

Local Extremum's for input with epsilon = 1, (*8)

use TweeMath\Algorithm;

Algorithm\LocalExtremum(array(0 => 0, 1 => 2, 2 => 4,  3 => 3, 4 => 5, 5 => 3, 6 => 1), 1); 
// array(2 => -1, 3 => 2, 4 => -2)

The Versions

17/03 2016

dev-master

9999999-dev https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation derivative local extremum

17/03 2016

1.1.0

1.1.0.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation derivative local extremum

05/10 2015

1.0.7

1.0.7.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation derivative local extremum

06/05 2014

1.0.6

1.0.6.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation derivative local extremum

24/03 2014

1.0.5

1.0.5.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation, derivative, local extremum

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation derivative local extremum

23/03 2014

1.0.4

1.0.4.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation

23/03 2014

1.0.3

1.0.3.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation

23/03 2014

1.0.2

1.0.2.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear interpolation

23/03 2014

1.0.1

1.0.1.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear extrapolation

23/03 2014

1.0

1.0.0.0 https://github.com/necromant2005/tt-math

php standard math algorithms: running average, linear interpolation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

math running average linear extrapolation