webit/complex-number
最新稳定版本:1.0.0
Composer 安装命令:
composer require webit/complex-number
包简介
Web-IT Complex number wrapper
关键字:
README 文档
README
Object wrapper for Complex Number. Provides immutable Complex and ComplexArray classes. Supports operations like: adding, subtraction, multiplication, dividing, square root, absolute and multiplication by scalar value.
Installation
via Composer
Add the webit/complex-number into composer.json
{
"require": {
"php": ">=5.3.2",
"webit/complex-number": "~1.0"
}
}
Usage
$num1 = new Complex(1, 3); // (real, imaginary) // or $num2 = Complex::create(5, 5); $sum = $num1->add($num2); $diff = $num1->sub($num2); $prod = $num1->mul($num2); $quot = $num1->div($num2); $sqrt = $num1->sqrt(); $abs = $num1->abs(); // scalar $conjugated = $num1->getConjugated(); $complexArray1 = new ComplexArray(array(23.4, 23.55)); // accepts array of floats or array of Complex // or $complexArray2 = ComplexArray::create(array(23.4, 23.55)); foreach ($complexArray1 as $complex) { echo $complex ."\n"; }
统计信息
- 总下载量: 355
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-03-23