alemian95/php-complex-numbers 问题修复 & 功能扩展

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

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

alemian95/php-complex-numbers

最新稳定版本:v1.0.1

Composer 安装命令:

composer require alemian95/php-complex-numbers

包简介

Package for manipulating and performing calculations with complex numbers

README 文档

README

Introduction

This library provides a simple way to manipulate and perform calculations with complex numbers.

Installation

You can install this library via Composer

composer require alemian95/php-complex-numbers

Usage

Creating Complex Numbers

You can create a complex number using either Cartesian coordinates (real and imaginary parts) or polar coordinates (magnitude and argument)

use Alemian95\PhpComplexNumbers\Complex;

// Create a complex number using Cartesian coordinates
$complex1 = new Complex(3.0, 4.0);

// Create a complex number using polar coordinates
$complex2 = Complex::createFromPolar(5.0, 0.92729521800161); // Equivalent to (3, 4)

Basic Operations

You can perform basic arithmetic operations on complex numbers, such as addition, subtraction, multiplication, and division:

// Addition
$sum = $complex1->add($complex2);

// Subtraction
$diff = $complex1->sub($complex2);

// Multiplication
$product = $complex1->mul($complex2);

// Division
$quotient = $complex1->div($complex2);

Other operations

You can also perform other operations such as calculating the absolute value, argument, and conjugate of a complex number:

// Absolute value
$absoluteValue = $complex1->abs();

// Argument
$argument = $complex1->arg();

// Conjugate
$conjugate = $complex1->conjugate();

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.

License

This library is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-09