truesocialmetrics/math 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

truesocialmetrics/math

Composer 安装命令:

composer require truesocialmetrics/math

包简介

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

README 文档

README

Build Status

Introduction

Standard Math Algorithms: Running Average, Linear Interpolation

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

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

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

use TweeMath\Algorithm;

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

Linear interpolation for large numbers for the next point max + 2

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

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

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)

统计信息

  • 总下载量: 6.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固