2019-02-23 02:07:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Arma;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a complex number.
|
|
|
|
*
|
|
|
|
* @package Arma
|
|
|
|
*/
|
|
|
|
abstract class Complex
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Real part of complex number.
|
|
|
|
*
|
|
|
|
* @var number
|
|
|
|
*/
|
|
|
|
public $real;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Imaginary part of complex number.
|
|
|
|
*
|
|
|
|
* @var number
|
|
|
|
*/
|
|
|
|
public $imag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* @param number $real[optional]
|
|
|
|
* @param number $imag[optional]
|
|
|
|
*/
|
2019-04-13 10:17:01 +00:00
|
|
|
function __construct($real, $imag) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a complex number with magnitude r and phase angle theta.
|
|
|
|
*
|
|
|
|
* @param number $r : magnitude
|
|
|
|
* @param number $theta : phase angle
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
static function fromPolar($r, $theta) {}
|
|
|
|
|
|
|
|
// Arithmetic functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Addition of two complex numbers.
|
|
|
|
*
|
|
|
|
* @param number|static $other
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function add($other) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subtraction of two complex numbers.
|
|
|
|
*
|
|
|
|
* @param number|static $other
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function sub($other) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Negation of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function neg() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Multiplication of two complex numbers.
|
|
|
|
*
|
|
|
|
* @param number|static $other
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function mul($other) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Division of two complex numbers.
|
|
|
|
*
|
|
|
|
* @param number|static $other
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function div($other) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the magnitude of the complex number.
|
|
|
|
*
|
|
|
|
* @return number
|
|
|
|
*/
|
|
|
|
function abs() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the phase angle of the complex number.
|
|
|
|
*
|
|
|
|
* @return number
|
|
|
|
*/
|
|
|
|
function arg() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the squared magnitude of the complex number.
|
|
|
|
*
|
|
|
|
* @return number
|
|
|
|
*/
|
|
|
|
function norm() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the complex conjugate.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function conj() {}
|
|
|
|
|
|
|
|
// Exponential functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute base-e exponential of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function exp() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Complex natural logarithm with the branch cuts along the negative real axis.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function log() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Complex common logarithm with the branch cuts along the negative real axis.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function log10() {}
|
|
|
|
|
|
|
|
// Power functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes complex power.
|
|
|
|
*
|
|
|
|
* @param number|static $other
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function pow($other) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Complex square root in the range of the right half-plane.
|
|
|
|
*
|
|
|
|
* @return number
|
|
|
|
*/
|
|
|
|
function sqrt() {}
|
|
|
|
|
|
|
|
// Trigonometric functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes sine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function sin() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes cosine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function cos() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes tangent of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function tan() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes arc sine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function asin() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes arc cosine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function acos() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes arc tangent of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function atan() {}
|
|
|
|
|
|
|
|
// Hyperbolic functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes hyperbolic sine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function sinh() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes hyperbolic cosine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function cosh() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes hyperbolic tangent of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function tanh() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes area hyperbolic sine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function asinh() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes area hyperbolic cosine of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function acosh() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes area hyperbolic tangent of the complex number.
|
|
|
|
*
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
function atanh() {}
|
2019-08-19 17:29:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert this complex number to string.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function __toString() {}
|
2019-02-23 02:07:23 +00:00
|
|
|
}
|