summaryrefslogtreecommitdiffstats
path: root/vendor/markbaker/complex
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/markbaker/complex')
-rw-r--r--vendor/markbaker/complex/.github/workflows/main.yml150
-rw-r--r--vendor/markbaker/complex/README.md156
-rw-r--r--vendor/markbaker/complex/classes/Autoloader.php53
-rw-r--r--vendor/markbaker/complex/classes/Bootstrap.php38
-rw-r--r--vendor/markbaker/complex/classes/src/Complex.php390
-rw-r--r--vendor/markbaker/complex/classes/src/Exception.php13
-rw-r--r--vendor/markbaker/complex/classes/src/functions/abs.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acos.php40
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acosh.php36
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acot.php27
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acoth.php27
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acsc.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/acsch.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/argument.php30
-rw-r--r--vendor/markbaker/complex/classes/src/functions/asec.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/asech.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/asin.php39
-rw-r--r--vendor/markbaker/complex/classes/src/functions/asinh.php35
-rw-r--r--vendor/markbaker/complex/classes/src/functions/atan.php47
-rw-r--r--vendor/markbaker/complex/classes/src/functions/atanh.php40
-rw-r--r--vendor/markbaker/complex/classes/src/functions/conjugate.php30
-rw-r--r--vendor/markbaker/complex/classes/src/functions/cos.php36
-rw-r--r--vendor/markbaker/complex/classes/src/functions/cosh.php34
-rw-r--r--vendor/markbaker/complex/classes/src/functions/cot.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/coth.php26
-rw-r--r--vendor/markbaker/complex/classes/src/functions/csc.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/csch.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/exp.php36
-rw-r--r--vendor/markbaker/complex/classes/src/functions/inverse.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/ln.php35
-rw-r--r--vendor/markbaker/complex/classes/src/functions/log10.php34
-rw-r--r--vendor/markbaker/complex/classes/src/functions/log2.php34
-rw-r--r--vendor/markbaker/complex/classes/src/functions/negative.php33
-rw-r--r--vendor/markbaker/complex/classes/src/functions/pow.php42
-rw-r--r--vendor/markbaker/complex/classes/src/functions/rho.php30
-rw-r--r--vendor/markbaker/complex/classes/src/functions/sec.php27
-rw-r--r--vendor/markbaker/complex/classes/src/functions/sech.php27
-rw-r--r--vendor/markbaker/complex/classes/src/functions/sin.php34
-rw-r--r--vendor/markbaker/complex/classes/src/functions/sinh.php34
-rw-r--r--vendor/markbaker/complex/classes/src/functions/sqrt.php31
-rw-r--r--vendor/markbaker/complex/classes/src/functions/tan.php42
-rw-r--r--vendor/markbaker/complex/classes/src/functions/tanh.php37
-rw-r--r--vendor/markbaker/complex/classes/src/functions/theta.php40
-rw-r--r--vendor/markbaker/complex/classes/src/operations/add.php48
-rw-r--r--vendor/markbaker/complex/classes/src/operations/divideby.php58
-rw-r--r--vendor/markbaker/complex/classes/src/operations/divideinto.php58
-rw-r--r--vendor/markbaker/complex/classes/src/operations/multiply.php50
-rw-r--r--vendor/markbaker/complex/classes/src/operations/subtract.php48
-rw-r--r--vendor/markbaker/complex/composer.json77
-rw-r--r--vendor/markbaker/complex/examples/complexTest.php154
-rw-r--r--vendor/markbaker/complex/examples/testFunctions.php52
-rw-r--r--vendor/markbaker/complex/examples/testOperations.php34
-rw-r--r--vendor/markbaker/complex/license.md25
53 files changed, 2646 insertions, 0 deletions
diff --git a/vendor/markbaker/complex/.github/workflows/main.yml b/vendor/markbaker/complex/.github/workflows/main.yml
new file mode 100644
index 0000000..3b41498
--- /dev/null
+++ b/vendor/markbaker/complex/.github/workflows/main.yml
@@ -0,0 +1,150 @@
+name: main
+on: [ push, pull_request ]
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ experimental:
+ - false
+ php-version:
+ - '7.2'
+ - '7.3'
+ - '7.4'
+ - '8.0'
+
+ include:
+ - php-version: '8.1'
+ experimental: true
+
+ name: PHP ${{ matrix.php-version }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP, with composer and extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-version }}
+ coverage: none
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Delete composer lock file
+ id: composer-lock
+ if: ${{ matrix.php-version == '8.1' }}
+ run: |
+ echo "::set-output name=flags::--ignore-platform-reqs"
+
+ - name: Install dependencies
+ run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
+
+ - name: Setup problem matchers for PHP
+ run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
+
+ - name: Setup problem matchers for PHPUnit
+ run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
+
+ - name: "Run PHPUnit tests (Experimental: ${{ matrix.experimental }})"
+ env:
+ FAILURE_ACTION: "${{ matrix.experimental == true }}"
+ run: vendor/bin/phpunit --verbose || $FAILURE_ACTION
+
+ phpcs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP, with composer and extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ coverage: none
+ tools: cs2pr
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: Code style with PHP_CodeSniffer
+ run: ./vendor/bin/phpcs -q --report=checkstyle classes/src/ | cs2pr
+
+ versions:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP, with composer and extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ coverage: none
+ tools: cs2pr
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: Code Version Compatibility check with PHP_CodeSniffer
+ run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full classes/src/ --standard=PHPCompatibility --runtime-set testVersion 7.2-
+
+ coverage:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP, with composer and extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ coverage: pcov
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: Test Coverage
+ run: ./vendor/bin/phpunit --verbose --coverage-text
diff --git a/vendor/markbaker/complex/README.md b/vendor/markbaker/complex/README.md
new file mode 100644
index 0000000..8ded0df
--- /dev/null
+++ b/vendor/markbaker/complex/README.md
@@ -0,0 +1,156 @@
+PHPComplex
+==========
+
+---
+
+PHP Class for handling Complex numbers
+
+Master: [![Build Status](https://travis-ci.org/MarkBaker/PHPComplex.png?branch=master)](http://travis-ci.org/MarkBaker/PHPComplex)
+
+Develop: [![Build Status](https://travis-ci.org/MarkBaker/PHPComplex.png?branch=develop)](http://travis-ci.org/MarkBaker/PHPComplex)
+
+[![Complex Numbers](https://imgs.xkcd.com/comics/complex_numbers_2x.png)](https://xkcd.com/2028/)
+
+---
+
+The library currently provides the following operations:
+
+ - addition
+ - subtraction
+ - multiplication
+ - division
+ - division by
+ - division into
+
+together with functions for
+
+ - theta (polar theta angle)
+ - rho (polar distance/radius)
+ - conjugate
+ * negative
+ - inverse (1 / complex)
+ - cos (cosine)
+ - acos (inverse cosine)
+ - cosh (hyperbolic cosine)
+ - acosh (inverse hyperbolic cosine)
+ - sin (sine)
+ - asin (inverse sine)
+ - sinh (hyperbolic sine)
+ - asinh (inverse hyperbolic sine)
+ - sec (secant)
+ - asec (inverse secant)
+ - sech (hyperbolic secant)
+ - asech (inverse hyperbolic secant)
+ - csc (cosecant)
+ - acsc (inverse cosecant)
+ - csch (hyperbolic secant)
+ - acsch (inverse hyperbolic secant)
+ - tan (tangent)
+ - atan (inverse tangent)
+ - tanh (hyperbolic tangent)
+ - atanh (inverse hyperbolic tangent)
+ - cot (cotangent)
+ - acot (inverse cotangent)
+ - coth (hyperbolic cotangent)
+ - acoth (inverse hyperbolic cotangent)
+ - sqrt (square root)
+ - exp (exponential)
+ - ln (natural log)
+ - log10 (base-10 log)
+ - log2 (base-2 log)
+ - pow (raised to the power of a real number)
+
+
+---
+
+# Usage
+
+To create a new complex object, you can provide either the real, imaginary and suffix parts as individual values, or as an array of values passed passed to the constructor; or a string representing the value. e.g
+
+```
+$real = 1.23;
+$imaginary = -4.56;
+$suffix = 'i';
+
+$complexObject = new Complex\Complex($real, $imaginary, $suffix);
+```
+or
+```
+$real = 1.23;
+$imaginary = -4.56;
+$suffix = 'i';
+
+$arguments = [$real, $imaginary, $suffix];
+
+$complexObject = new Complex\Complex($arguments);
+```
+or
+```
+$complexString = '1.23-4.56i';
+
+$complexObject = new Complex\Complex($complexString);
+```
+
+Complex objects are immutable: whenever you call a method or pass a complex value to a function that returns a complex value, a new Complex object will be returned, and the original will remain unchanged.
+This also allows you to chain multiple methods as you would for a fluent interface (as long as they are methods that will return a Complex result).
+
+## Performing Mathematical Operations
+
+To perform mathematical operations with Complex values, you can call the appropriate method against a complex value, passing other values as arguments
+
+```
+$complexString1 = '1.23-4.56i';
+$complexString2 = '2.34+5.67i';
+
+$complexObject = new Complex\Complex($complexString1);
+echo $complexObject->add($complexString2);
+```
+or pass all values to the appropriate function
+```
+$complexString1 = '1.23-4.56i';
+$complexString2 = '2.34+5.67i';
+
+echo Complex\add($complexString1, $complexString2);
+```
+If you want to perform the same operation against multiple values (e.g. to add three or more complex numbers), then you can pass multiple arguments to any of the operations.
+
+You can pass these arguments as Complex objects, or as an array or string that will parse to a complex object.
+
+## Using functions
+
+When calling any of the available functions for a complex value, you can either call the relevant method for the Complex object
+```
+$complexString = '1.23-4.56i';
+
+$complexObject = new Complex\Complex($complexString);
+echo $complexObject->sinh();
+```
+or you can call the function as you would in procedural code, passing the Complex object as an argument
+```
+$complexString = '1.23-4.56i';
+
+$complexObject = new Complex\Complex($complexString);
+echo Complex\sinh($complexObject);
+```
+When called procedurally using the function, you can pass in the argument as a Complex object, or as an array or string that will parse to a complex object.
+```
+$complexString = '1.23-4.56i';
+
+echo Complex\sinh($complexString);
+```
+
+In the case of the `pow()` function (the only implemented function that requires an additional argument) you need to pass both arguments when calling the function procedurally
+
+```
+$complexString = '1.23-4.56i';
+
+$complexObject = new Complex\Complex($complexString);
+echo Complex\pow($complexObject, 2);
+```
+or pass the additional argument when calling the method
+```
+$complexString = '1.23-4.56i';
+
+$complexObject = new Complex\Complex($complexString);
+echo $complexObject->pow(2);
+```
diff --git a/vendor/markbaker/complex/classes/Autoloader.php b/vendor/markbaker/complex/classes/Autoloader.php
new file mode 100644
index 0000000..e7cfdc4
--- /dev/null
+++ b/vendor/markbaker/complex/classes/Autoloader.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace Complex;
+
+/**
+ *
+ * Autoloader for Complex classes
+ *
+ * @package Complex
+ * @copyright Copyright (c) 2014 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+class Autoloader
+{
+ /**
+ * Register the Autoloader with SPL
+ *
+ */
+ public static function Register()
+ {
+ if (function_exists('__autoload')) {
+ // Register any existing autoloader function with SPL, so we don't get any clashes
+ spl_autoload_register('__autoload');
+ }
+ // Register ourselves with SPL
+ return spl_autoload_register(['Complex\\Autoloader', 'Load']);
+ }
+
+
+ /**
+ * Autoload a class identified by name
+ *
+ * @param string $pClassName Name of the object to load
+ */
+ public static function Load($pClassName)
+ {
+ if ((class_exists($pClassName, false)) || (strpos($pClassName, 'Complex\\') !== 0)) {
+ // Either already loaded, or not a Complex class request
+ return false;
+ }
+
+ $pClassFilePath = __DIR__ . DIRECTORY_SEPARATOR .
+ 'src' . DIRECTORY_SEPARATOR .
+ str_replace(['Complex\\', '\\'], ['', '/'], $pClassName) .
+ '.php';
+
+ if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
+ // Can't load
+ return false;
+ }
+ require($pClassFilePath);
+ }
+}
diff --git a/vendor/markbaker/complex/classes/Bootstrap.php b/vendor/markbaker/complex/classes/Bootstrap.php
new file mode 100644
index 0000000..e933413
--- /dev/null
+++ b/vendor/markbaker/complex/classes/Bootstrap.php
@@ -0,0 +1,38 @@
+<?php
+
+include_once __DIR__ . '/Autoloader.php';
+
+\Complex\Autoloader::Register();
+
+
+abstract class FilesystemRegexFilter extends RecursiveRegexIterator
+{
+ protected $regex;
+ public function __construct(RecursiveIterator $it, $regex)
+ {
+ $this->regex = $regex;
+ parent::__construct($it, $regex);
+ }
+}
+
+class FilenameFilter extends FilesystemRegexFilter
+{
+ // Filter files against the regex
+ public function accept()
+ {
+ return (!$this->isFile() || preg_match($this->regex, $this->getFilename()));
+ }
+}
+
+
+$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src';
+$srcDirectory = new RecursiveDirectoryIterator($srcFolder);
+
+$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i');
+$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Complex|Exception)\.php).*$/i');
+
+foreach (new RecursiveIteratorIterator($filteredFileList) as $file) {
+ if ($file->isFile()) {
+ include_once $file;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/Complex.php b/vendor/markbaker/complex/classes/src/Complex.php
new file mode 100644
index 0000000..3666486
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/Complex.php
@@ -0,0 +1,390 @@
+<?php
+
+/**
+ *
+ * Class for the management of Complex numbers
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Complex Number object.
+ *
+ * @package Complex
+ *
+ * @method float abs()
+ * @method Complex acos()
+ * @method Complex acosh()
+ * @method Complex acot()
+ * @method Complex acoth()
+ * @method Complex acsc()
+ * @method Complex acsch()
+ * @method float argument()
+ * @method Complex asec()
+ * @method Complex asech()
+ * @method Complex asin()
+ * @method Complex asinh()
+ * @method Complex atan()
+ * @method Complex atanh()
+ * @method Complex conjugate()
+ * @method Complex cos()
+ * @method Complex cosh()
+ * @method Complex cot()
+ * @method Complex coth()
+ * @method Complex csc()
+ * @method Complex csch()
+ * @method Complex exp()
+ * @method Complex inverse()
+ * @method Complex ln()
+ * @method Complex log2()
+ * @method Complex log10()
+ * @method Complex negative()
+ * @method Complex pow(int|float $power)
+ * @method float rho()
+ * @method Complex sec()
+ * @method Complex sech()
+ * @method Complex sin()
+ * @method Complex sinh()
+ * @method Complex sqrt()
+ * @method Complex tan()
+ * @method Complex tanh()
+ * @method float theta()
+ * @method Complex add(...$complexValues)
+ * @method Complex subtract(...$complexValues)
+ * @method Complex multiply(...$complexValues)
+ * @method Complex divideby(...$complexValues)
+ * @method Complex divideinto(...$complexValues)
+ */
+class Complex
+{
+ /**
+ * @constant Euler's Number.
+ */
+ const EULER = 2.7182818284590452353602874713526624977572;
+
+ /**
+ * @constant Regexp to split an input string into real and imaginary components and suffix
+ */
+ const NUMBER_SPLIT_REGEXP =
+ '` ^
+ ( # Real part
+ [-+]?(\d+\.?\d*|\d*\.?\d+) # Real value (integer or float)
+ ([Ee][-+]?[0-2]?\d{1,3})? # Optional real exponent for scientific format
+ )
+ ( # Imaginary part
+ [-+]?(\d+\.?\d*|\d*\.?\d+) # Imaginary value (integer or float)
+ ([Ee][-+]?[0-2]?\d{1,3})? # Optional imaginary exponent for scientific format
+ )?
+ ( # Imaginary part is optional
+ ([-+]?) # Imaginary (implicit 1 or -1) only
+ ([ij]?) # Imaginary i or j - depending on whether mathematical or engineering
+ )
+ $`uix';
+
+ /**
+ * @var float $realPart The value of of this complex number on the real plane.
+ */
+ protected $realPart = 0.0;
+
+ /**
+ * @var float $imaginaryPart The value of of this complex number on the imaginary plane.
+ */
+ protected $imaginaryPart = 0.0;
+
+ /**
+ * @var string $suffix The suffix for this complex number (i or j).
+ */
+ protected $suffix;
+
+
+ /**
+ * Validates whether the argument is a valid complex number, converting scalar or array values if possible
+ *
+ * @param mixed $complexNumber The value to parse
+ * @return array
+ * @throws Exception If the argument isn't a Complex number or cannot be converted to one
+ */
+ private static function parseComplex($complexNumber)
+ {
+ // Test for real number, with no imaginary part
+ if (is_numeric($complexNumber)) {
+ return [$complexNumber, 0, null];
+ }
+
+ // Fix silly human errors
+ $complexNumber = str_replace(
+ ['+-', '-+', '++', '--'],
+ ['-', '-', '+', '+'],
+ $complexNumber
+ );
+
+ // Basic validation of string, to parse out real and imaginary parts, and any suffix
+ $validComplex = preg_match(
+ self::NUMBER_SPLIT_REGEXP,
+ $complexNumber,
+ $complexParts
+ );
+
+ if (!$validComplex) {
+ // Neither real nor imaginary part, so test to see if we actually have a suffix
+ $validComplex = preg_match('/^([\-\+]?)([ij])$/ui', $complexNumber, $complexParts);
+ if (!$validComplex) {
+ throw new Exception('Invalid complex number');
+ }
+ // We have a suffix, so set the real to 0, the imaginary to either 1 or -1 (as defined by the sign)
+ $imaginary = 1;
+ if ($complexParts[1] === '-') {
+ $imaginary = 0 - $imaginary;
+ }
+ return [0, $imaginary, $complexParts[2]];
+ }
+
+ // If we don't have an imaginary part, identify whether it should be +1 or -1...
+ if (($complexParts[4] === '') && ($complexParts[9] !== '')) {
+ if ($complexParts[7] !== $complexParts[9]) {
+ $complexParts[4] = 1;
+ if ($complexParts[8] === '-') {
+ $complexParts[4] = -1;
+ }
+ } else {
+ // ... or if we have only the real and no imaginary part
+ // (in which case our real should be the imaginary)
+ $complexParts[4] = $complexParts[1];
+ $complexParts[1] = 0;
+ }
+ }
+
+ // Return real and imaginary parts and suffix as an array, and set a default suffix if user input lazily
+ return [
+ $complexParts[1],
+ $complexParts[4],
+ !empty($complexParts[9]) ? $complexParts[9] : 'i'
+ ];
+ }
+
+
+ public function __construct($realPart = 0.0, $imaginaryPart = null, $suffix = 'i')
+ {
+ if ($imaginaryPart === null) {
+ if (is_array($realPart)) {
+ // We have an array of (potentially) real and imaginary parts, and any suffix
+ list ($realPart, $imaginaryPart, $suffix) = array_values($realPart) + [0.0, 0.0, 'i'];
+ } elseif ((is_string($realPart)) || (is_numeric($realPart))) {
+ // We've been given a string to parse to extract the real and imaginary parts, and any suffix
+ list($realPart, $imaginaryPart, $suffix) = self::parseComplex($realPart);
+ }
+ }
+
+ if ($imaginaryPart != 0.0 && empty($suffix)) {
+ $suffix = 'i';
+ } elseif ($imaginaryPart == 0.0 && !empty($suffix)) {
+ $suffix = '';
+ }
+
+ // Set parsed values in our properties
+ $this->realPart = (float) $realPart;
+ $this->imaginaryPart = (float) $imaginaryPart;
+ $this->suffix = strtolower($suffix ?? '');
+ }
+
+ /**
+ * Gets the real part of this complex number
+ *
+ * @return Float
+ */
+ public function getReal(): float
+ {
+ return $this->realPart;
+ }
+
+ /**
+ * Gets the imaginary part of this complex number
+ *
+ * @return Float
+ */
+ public function getImaginary(): float
+ {
+ return $this->imaginaryPart;
+ }
+
+ /**
+ * Gets the suffix of this complex number
+ *
+ * @return String
+ */
+ public function getSuffix(): string
+ {
+ return $this->suffix;
+ }
+
+ /**
+ * Returns true if this is a real value, false if a complex value
+ *
+ * @return Bool
+ */
+ public function isReal(): bool
+ {
+ return $this->imaginaryPart == 0.0;
+ }
+
+ /**
+ * Returns true if this is a complex value, false if a real value
+ *
+ * @return Bool
+ */
+ public function isComplex(): bool
+ {
+ return !$this->isReal();
+ }
+
+ public function format(): string
+ {
+ $str = "";
+ if ($this->imaginaryPart != 0.0) {
+ if (\abs($this->imaginaryPart) != 1.0) {
+ $str .= $this->imaginaryPart . $this->suffix;
+ } else {
+ $str .= (($this->imaginaryPart < 0.0) ? '-' : '') . $this->suffix;
+ }
+ }
+ if ($this->realPart != 0.0) {
+ if (($str) && ($this->imaginaryPart > 0.0)) {
+ $str = "+" . $str;
+ }
+ $str = $this->realPart . $str;
+ }
+ if (!$str) {
+ $str = "0.0";
+ }
+
+ return $str;
+ }
+
+ public function __toString(): string
+ {
+ return $this->format();
+ }
+
+ /**
+ * Validates whether the argument is a valid complex number, converting scalar or array values if possible
+ *
+ * @param mixed $complex The value to validate
+ * @return Complex
+ * @throws Exception If the argument isn't a Complex number or cannot be converted to one
+ */
+ public static function validateComplexArgument($complex): Complex
+ {
+ if (is_scalar($complex) || is_array($complex)) {
+ $complex = new Complex($complex);
+ } elseif (!is_object($complex) || !($complex instanceof Complex)) {
+ throw new Exception('Value is not a valid complex number');
+ }
+
+ return $complex;
+ }
+
+ /**
+ * Returns the reverse of this complex number
+ *
+ * @return Complex
+ */
+ public function reverse(): Complex
+ {
+ return new Complex(
+ $this->imaginaryPart,
+ $this->realPart,
+ ($this->realPart == 0.0) ? null : $this->suffix
+ );
+ }
+
+ public function invertImaginary(): Complex
+ {
+ return new Complex(
+ $this->realPart,
+ $this->imaginaryPart * -1,
+ ($this->imaginaryPart == 0.0) ? null : $this->suffix
+ );
+ }
+
+ public function invertReal(): Complex
+ {
+ return new Complex(
+ $this->realPart * -1,
+ $this->imaginaryPart,
+ ($this->imaginaryPart == 0.0) ? null : $this->suffix
+ );
+ }
+
+ protected static $functions = [
+ 'abs',
+ 'acos',
+ 'acosh',
+ 'acot',
+ 'acoth',
+ 'acsc',
+ 'acsch',
+ 'argument',
+ 'asec',
+ 'asech',
+ 'asin',
+ 'asinh',
+ 'atan',
+ 'atanh',
+ 'conjugate',
+ 'cos',
+ 'cosh',
+ 'cot',
+ 'coth',
+ 'csc',
+ 'csch',
+ 'exp',
+ 'inverse',
+ 'ln',
+ 'log2',
+ 'log10',
+ 'negative',
+ 'pow',
+ 'rho',
+ 'sec',
+ 'sech',
+ 'sin',
+ 'sinh',
+ 'sqrt',
+ 'tan',
+ 'tanh',
+ 'theta',
+ ];
+
+ protected static $operations = [
+ 'add',
+ 'subtract',
+ 'multiply',
+ 'divideby',
+ 'divideinto',
+ ];
+
+ /**
+ * Returns the result of the function call or operation
+ *
+ * @return Complex|float
+ * @throws Exception|\InvalidArgumentException
+ */
+ public function __call($functionName, $arguments)
+ {
+ $functionName = strtolower(str_replace('_', '', $functionName));
+
+ // Test for function calls
+ if (in_array($functionName, self::$functions, true)) {
+ $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}";
+ return $functionName($this, ...$arguments);
+ }
+ // Test for operation calls
+ if (in_array($functionName, self::$operations, true)) {
+ $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}";
+ return $functionName($this, ...$arguments);
+ }
+ throw new Exception('Complex Function or Operation does not exist');
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/Exception.php b/vendor/markbaker/complex/classes/src/Exception.php
new file mode 100644
index 0000000..14dd545
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/Exception.php
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * Exception.
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+class Exception extends \Exception
+{
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/abs.php b/vendor/markbaker/complex/classes/src/functions/abs.php
new file mode 100644
index 0000000..400cb2a
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/abs.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex abs() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the absolute value (modulus) of a complex number.
+ * Also known as the rho of the complex number, i.e. the distance/radius
+ * from the centrepoint to the representation of the number in polar coordinates.
+ *
+ * This function is a synonym for rho()
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return float The absolute (or rho) value of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ *
+ * @see rho
+ *
+ */
+if (!function_exists(__NAMESPACE__ . '\\abs')) {
+ function abs($complex): float
+ {
+ return rho($complex);
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acos.php b/vendor/markbaker/complex/classes/src/functions/acos.php
new file mode 100644
index 0000000..378a1a9
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acos.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acos() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse cosine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse cosine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\acos')) {
+ function acos($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ $square = clone $complex;
+ $square = multiply($square, $complex);
+ $invsqrt = new Complex(1.0);
+ $invsqrt = subtract($invsqrt, $square);
+ $invsqrt = sqrt($invsqrt);
+ $adjust = new Complex(
+ $complex->getReal() - $invsqrt->getImaginary(),
+ $complex->getImaginary() + $invsqrt->getReal()
+ );
+ $log = ln($adjust);
+
+ return new Complex(
+ $log->getImaginary(),
+ -1 * $log->getReal()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acosh.php b/vendor/markbaker/complex/classes/src/functions/acosh.php
new file mode 100644
index 0000000..37e604c
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acosh.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acosh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic cosine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic cosine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\acosh')) {
+ function acosh($complex)
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal() && ($complex->getReal() > 1)) {
+ return new Complex(\acosh($complex->getReal()));
+ }
+
+ $acosh = acos($complex)
+ ->reverse();
+ if ($acosh->getReal() < 0.0) {
+ $acosh = $acosh->invertReal();
+ }
+
+ return $acosh;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acot.php b/vendor/markbaker/complex/classes/src/functions/acot.php
new file mode 100644
index 0000000..bc77379
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acot.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acot() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse cotangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse cotangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\acot')) {
+ function acot($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return atan(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acoth.php b/vendor/markbaker/complex/classes/src/functions/acoth.php
new file mode 100644
index 0000000..80fbffd
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acoth.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acoth() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic cotangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic cotangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\acoth')) {
+ function acoth($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return atanh(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acsc.php b/vendor/markbaker/complex/classes/src/functions/acsc.php
new file mode 100644
index 0000000..8c18db9
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acsc.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acsc() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse cosecant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse cosecant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\acsc')) {
+ function acsc($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return asin(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/acsch.php b/vendor/markbaker/complex/classes/src/functions/acsch.php
new file mode 100644
index 0000000..fb909c2
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/acsch.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex acsch() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic cosecant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic cosecant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\acsch')) {
+ function acsch($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return asinh(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/argument.php b/vendor/markbaker/complex/classes/src/functions/argument.php
new file mode 100644
index 0000000..17e6ecb
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/argument.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ *
+ * Function code for the complex argument() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the argument of a complex number.
+ * Also known as the theta of the complex number, i.e. the angle in radians
+ * from the real axis to the representation of the number in polar coordinates.
+ *
+ * This function is a synonym for theta()
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return float The argument (or theta) value of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ *
+ * @see theta
+ */
+if (!function_exists(__NAMESPACE__ . '\\argument')) {
+ function argument($complex): float
+ {
+ return theta($complex);
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/asec.php b/vendor/markbaker/complex/classes/src/functions/asec.php
new file mode 100644
index 0000000..4ad69fc
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/asec.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex asec() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse secant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse secant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\asec')) {
+ function asec($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return acos(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/asech.php b/vendor/markbaker/complex/classes/src/functions/asech.php
new file mode 100644
index 0000000..a1571a1
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/asech.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex asech() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic secant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic secant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\asech')) {
+ function asech($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return acosh(inverse($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/asin.php b/vendor/markbaker/complex/classes/src/functions/asin.php
new file mode 100644
index 0000000..05790ff
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/asin.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ *
+ * Function code for the complex asin() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse sine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse sine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\asin')) {
+ function asin($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ $square = multiply($complex, $complex);
+ $invsqrt = new Complex(1.0);
+ $invsqrt = subtract($invsqrt, $square);
+ $invsqrt = sqrt($invsqrt);
+ $adjust = new Complex(
+ $invsqrt->getReal() - $complex->getImaginary(),
+ $invsqrt->getImaginary() + $complex->getReal()
+ );
+ $log = ln($adjust);
+
+ return new Complex(
+ $log->getImaginary(),
+ -1 * $log->getReal()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/asinh.php b/vendor/markbaker/complex/classes/src/functions/asinh.php
new file mode 100644
index 0000000..cee7610
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/asinh.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ *
+ * Function code for the complex asinh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic sine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic sine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\asinh')) {
+ function asinh($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal() && ($complex->getReal() > 1)) {
+ return new Complex(\asinh($complex->getReal()));
+ }
+
+ $asinh = clone $complex;
+ $asinh = $asinh->reverse()
+ ->invertReal();
+ $asinh = asin($asinh);
+ return $asinh->reverse()
+ ->invertImaginary();
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/atan.php b/vendor/markbaker/complex/classes/src/functions/atan.php
new file mode 100644
index 0000000..e026e7a
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/atan.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ *
+ * Function code for the complex atan() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+//include_once 'Math/Complex.php';
+//include_once 'Math/ComplexOp.php';
+
+/**
+ * Returns the inverse tangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse tangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\atan')) {
+ function atan($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\atan($complex->getReal()));
+ }
+
+ $t1Value = new Complex(-1 * $complex->getImaginary(), $complex->getReal());
+ $uValue = new Complex(1, 0);
+
+ $d1Value = clone $uValue;
+ $d1Value = subtract($d1Value, $t1Value);
+ $d2Value = add($t1Value, $uValue);
+ $uResult = $d1Value->divideBy($d2Value);
+ $uResult = ln($uResult);
+
+ return new Complex(
+ (($uResult->getImaginary() == M_PI) ? -M_PI : $uResult->getImaginary()) * -0.5,
+ $uResult->getReal() * 0.5,
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/atanh.php b/vendor/markbaker/complex/classes/src/functions/atanh.php
new file mode 100644
index 0000000..d1e60e6
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/atanh.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ *
+ * Function code for the complex atanh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse hyperbolic tangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse hyperbolic tangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\atanh')) {
+ function atanh($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ $real = $complex->getReal();
+ if ($real >= -1.0 && $real <= 1.0) {
+ return new Complex(\atanh($real));
+ } else {
+ return new Complex(\atanh(1 / $real), (($real < 0.0) ? M_PI_2 : -1 * M_PI_2));
+ }
+ }
+
+ $iComplex = clone $complex;
+ $iComplex = $iComplex->invertImaginary()
+ ->reverse();
+ return atan($iComplex)
+ ->invertReal()
+ ->reverse();
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/conjugate.php b/vendor/markbaker/complex/classes/src/functions/conjugate.php
new file mode 100644
index 0000000..d394ab5
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/conjugate.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ *
+ * Function code for the complex conjugate() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the complex conjugate of a complex number
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The conjugate of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\conjugate')) {
+ function conjugate($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return new Complex(
+ $complex->getReal(),
+ -1 * $complex->getImaginary(),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/cos.php b/vendor/markbaker/complex/classes/src/functions/cos.php
new file mode 100644
index 0000000..84fd51f
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/cos.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ *
+ * Function code for the complex cos() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the cosine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The cosine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\cos')) {
+ function cos($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\cos($complex->getReal()));
+ }
+
+ return conjugate(
+ new Complex(
+ \cos($complex->getReal()) * \cosh($complex->getImaginary()),
+ \sin($complex->getReal()) * \sinh($complex->getImaginary()),
+ $complex->getSuffix()
+ )
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/cosh.php b/vendor/markbaker/complex/classes/src/functions/cosh.php
new file mode 100644
index 0000000..531ae52
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/cosh.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * Function code for the complex cosh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic cosine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic cosine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\cosh')) {
+ function cosh($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\cosh($complex->getReal()));
+ }
+
+ return new Complex(
+ \cosh($complex->getReal()) * \cos($complex->getImaginary()),
+ \sinh($complex->getReal()) * \sin($complex->getImaginary()),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/cot.php b/vendor/markbaker/complex/classes/src/functions/cot.php
new file mode 100644
index 0000000..b775458
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/cot.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex cot() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the cotangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The cotangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\cot')) {
+ function cot($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return inverse(tan($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/coth.php b/vendor/markbaker/complex/classes/src/functions/coth.php
new file mode 100644
index 0000000..6944d77
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/coth.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ *
+ * Function code for the complex coth() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic cotangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic cotangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\coth')) {
+ function coth($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+ return inverse(tanh($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/csc.php b/vendor/markbaker/complex/classes/src/functions/csc.php
new file mode 100644
index 0000000..a2782a8
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/csc.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex csc() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the cosecant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The cosecant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\csc')) {
+ function csc($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return inverse(sin($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/csch.php b/vendor/markbaker/complex/classes/src/functions/csch.php
new file mode 100644
index 0000000..e714caa
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/csch.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex csch() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic cosecant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic cosecant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\csch')) {
+ function csch($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ return new Complex(INF);
+ }
+
+ return inverse(sinh($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/exp.php b/vendor/markbaker/complex/classes/src/functions/exp.php
new file mode 100644
index 0000000..cbc37e5
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/exp.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ *
+ * Function code for the complex exp() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the exponential of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The exponential of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\exp')) {
+ function exp($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if (($complex->getReal() == 0.0) && (\abs($complex->getImaginary()) == M_PI)) {
+ return new Complex(-1.0, 0.0);
+ }
+
+ $rho = \exp($complex->getReal());
+
+ return new Complex(
+ $rho * \cos($complex->getImaginary()),
+ $rho * \sin($complex->getImaginary()),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/inverse.php b/vendor/markbaker/complex/classes/src/functions/inverse.php
new file mode 100644
index 0000000..9e879e7
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/inverse.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex inverse() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the inverse of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The inverse of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\inverse')) {
+ function inverse($complex): Complex
+ {
+ $complex = clone Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ throw new \InvalidArgumentException('Division by zero');
+ }
+
+ return $complex->divideInto(1.0);
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/ln.php b/vendor/markbaker/complex/classes/src/functions/ln.php
new file mode 100644
index 0000000..e011519
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/ln.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ *
+ * Function code for the complex ln() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the natural logarithm of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The natural logarithm of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If the real and the imaginary parts are both zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\ln')) {
+ function ln($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if (($complex->getReal() == 0.0) && ($complex->getImaginary() == 0.0)) {
+ throw new \InvalidArgumentException();
+ }
+
+ return new Complex(
+ \log(rho($complex)),
+ theta($complex),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/log10.php b/vendor/markbaker/complex/classes/src/functions/log10.php
new file mode 100644
index 0000000..2efdc30
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/log10.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * Function code for the complex log10() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the common logarithm (base 10) of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The common logarithm (base 10) of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If the real and the imaginary parts are both zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\log10')) {
+ function log10($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if (($complex->getReal() == 0.0) && ($complex->getImaginary() == 0.0)) {
+ throw new \InvalidArgumentException();
+ } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) {
+ return new Complex(\log10($complex->getReal()), 0.0, $complex->getSuffix());
+ }
+
+ return ln($complex)
+ ->multiply(\log10(Complex::EULER));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/log2.php b/vendor/markbaker/complex/classes/src/functions/log2.php
new file mode 100644
index 0000000..1b114bc
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/log2.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * Function code for the complex log2() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the base-2 logarithm of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The base-2 logarithm of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If the real and the imaginary parts are both zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\log2')) {
+ function log2($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if (($complex->getReal() == 0.0) && ($complex->getImaginary() == 0.0)) {
+ throw new \InvalidArgumentException();
+ } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) {
+ return new Complex(\log($complex->getReal(), 2), 0.0, $complex->getSuffix());
+ }
+
+ return ln($complex)
+ ->multiply(\log(Complex::EULER, 2));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/negative.php b/vendor/markbaker/complex/classes/src/functions/negative.php
new file mode 100644
index 0000000..24e3ad7
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/negative.php
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ *
+ * Function code for the complex negative() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the negative of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The negative value of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ *
+ * @see rho
+ *
+ */
+if (!function_exists(__NAMESPACE__ . '\\negative')) {
+ function negative($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return new Complex(
+ -1 * $complex->getReal(),
+ -1 * $complex->getImaginary(),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/pow.php b/vendor/markbaker/complex/classes/src/functions/pow.php
new file mode 100644
index 0000000..326a41c
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/pow.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ *
+ * Function code for the complex pow() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns a complex number raised to a power.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @param float|integer $power The power to raise this value to
+ * @return Complex The complex argument raised to the real power.
+ * @throws Exception If the power argument isn't a valid real
+ */
+if (!function_exists(__NAMESPACE__ . '\\pow')) {
+ function pow($complex, $power): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if (!is_numeric($power)) {
+ throw new Exception('Power argument must be a real number');
+ }
+
+ if ($complex->getImaginary() == 0.0 && $complex->getReal() >= 0.0) {
+ return new Complex(\pow($complex->getReal(), $power));
+ }
+
+ $rValue = \sqrt(($complex->getReal() * $complex->getReal()) + ($complex->getImaginary() * $complex->getImaginary()));
+ $rPower = \pow($rValue, $power);
+ $theta = $complex->argument() * $power;
+ if ($theta == 0) {
+ return new Complex(1);
+ }
+
+ return new Complex($rPower * \cos($theta), $rPower * \sin($theta), $complex->getSuffix());
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/rho.php b/vendor/markbaker/complex/classes/src/functions/rho.php
new file mode 100644
index 0000000..dfc4049
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/rho.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ *
+ * Function code for the complex rho() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the rho of a complex number.
+ * This is the distance/radius from the centrepoint to the representation of the number in polar coordinates.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return float The rho value of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\rho')) {
+ function rho($complex): float
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return \sqrt(
+ ($complex->getReal() * $complex->getReal()) +
+ ($complex->getImaginary() * $complex->getImaginary())
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/sec.php b/vendor/markbaker/complex/classes/src/functions/sec.php
new file mode 100644
index 0000000..e1a0b13
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/sec.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ *
+ * Function code for the complex sec() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the secant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The secant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\sec')) {
+ function sec($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return inverse(cos($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/sech.php b/vendor/markbaker/complex/classes/src/functions/sech.php
new file mode 100644
index 0000000..ae98514
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/sech.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ *
+ * Function code for the complex sech() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic secant of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic secant of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\sech')) {
+ function sech($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ return inverse(cosh($complex));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/sin.php b/vendor/markbaker/complex/classes/src/functions/sin.php
new file mode 100644
index 0000000..6b8ec2f
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/sin.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * Function code for the complex sin() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the sine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The sine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\sin')) {
+ function sin($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\sin($complex->getReal()));
+ }
+
+ return new Complex(
+ \sin($complex->getReal()) * \cosh($complex->getImaginary()),
+ \cos($complex->getReal()) * \sinh($complex->getImaginary()),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/sinh.php b/vendor/markbaker/complex/classes/src/functions/sinh.php
new file mode 100644
index 0000000..6563422
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/sinh.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * Function code for the complex sinh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic sine of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic sine of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\sinh')) {
+ function sinh($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\sinh($complex->getReal()));
+ }
+
+ return new Complex(
+ \sinh($complex->getReal()) * \cos($complex->getImaginary()),
+ \cosh($complex->getReal()) * \sin($complex->getImaginary()),
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/sqrt.php b/vendor/markbaker/complex/classes/src/functions/sqrt.php
new file mode 100644
index 0000000..5753a86
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/sqrt.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ *
+ * Function code for the complex sqrt() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the square root of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The Square root of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\sqrt')) {
+ function sqrt($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ $theta = theta($complex);
+ $delta1 = \cos($theta / 2);
+ $delta2 = \sin($theta / 2);
+ $rho = \sqrt(rho($complex));
+
+ return new Complex($delta1 * $rho, $delta2 * $rho, $complex->getSuffix());
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/tan.php b/vendor/markbaker/complex/classes/src/functions/tan.php
new file mode 100644
index 0000000..a6f9610
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/tan.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ *
+ * Function code for the complex tan() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the tangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The tangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\tan')) {
+ function tan($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->isReal()) {
+ return new Complex(\tan($complex->getReal()));
+ }
+
+ $real = $complex->getReal();
+ $imaginary = $complex->getImaginary();
+ $divisor = 1 + \pow(\tan($real), 2) * \pow(\tanh($imaginary), 2);
+ if ($divisor == 0.0) {
+ throw new \InvalidArgumentException('Division by zero');
+ }
+
+ return new Complex(
+ \pow(sech($imaginary)->getReal(), 2) * \tan($real) / $divisor,
+ \pow(sec($real)->getReal(), 2) * \tanh($imaginary) / $divisor,
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/tanh.php b/vendor/markbaker/complex/classes/src/functions/tanh.php
new file mode 100644
index 0000000..8a8ccdc
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/tanh.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ *
+ * Function code for the complex tanh() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the hyperbolic tangent of a complex number.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return Complex The hyperbolic tangent of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ * @throws \InvalidArgumentException If function would result in a division by zero
+ */
+if (!function_exists(__NAMESPACE__ . '\\tanh')) {
+ function tanh($complex): Complex
+ {
+ $complex = Complex::validateComplexArgument($complex);
+ $real = $complex->getReal();
+ $imaginary = $complex->getImaginary();
+ $divisor = \cos($imaginary) * \cos($imaginary) + \sinh($real) * \sinh($real);
+ if ($divisor == 0.0) {
+ throw new \InvalidArgumentException('Division by zero');
+ }
+
+ return new Complex(
+ \sinh($real) * \cosh($real) / $divisor,
+ 0.5 * \sin(2 * $imaginary) / $divisor,
+ $complex->getSuffix()
+ );
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/functions/theta.php b/vendor/markbaker/complex/classes/src/functions/theta.php
new file mode 100644
index 0000000..cdba45e
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/functions/theta.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ *
+ * Function code for the complex theta() function
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Returns the theta of a complex number.
+ * This is the angle in radians from the real axis to the representation of the number in polar coordinates.
+ *
+ * @param Complex|mixed $complex Complex number or a numeric value.
+ * @return float The theta value of the complex argument.
+ * @throws Exception If argument isn't a valid real or complex number.
+ */
+if (!function_exists(__NAMESPACE__ . '\\theta')) {
+ function theta($complex): float
+ {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($complex->getReal() == 0.0) {
+ if ($complex->isReal()) {
+ return 0.0;
+ } elseif ($complex->getImaginary() < 0.0) {
+ return M_PI / -2;
+ }
+ return M_PI / 2;
+ } elseif ($complex->getReal() > 0.0) {
+ return \atan($complex->getImaginary() / $complex->getReal());
+ } elseif ($complex->getImaginary() < 0.0) {
+ return -(M_PI - \atan(\abs($complex->getImaginary()) / \abs($complex->getReal())));
+ }
+
+ return M_PI - \atan($complex->getImaginary() / \abs($complex->getReal()));
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/operations/add.php b/vendor/markbaker/complex/classes/src/operations/add.php
new file mode 100644
index 0000000..1c726be
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/operations/add.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ *
+ * Function code for the complex addition operation
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Adds two or more complex numbers
+ *
+ * @param array of string|integer|float|Complex $complexValues The numbers to add
+ * @return Complex
+ */
+if (!function_exists(__NAMESPACE__ . '\\add')) {
+ function add(...$complexValues): Complex
+ {
+ if (count($complexValues) < 2) {
+ throw new \Exception('This function requires at least 2 arguments');
+ }
+
+ $base = array_shift($complexValues);
+ $result = clone Complex::validateComplexArgument($base);
+
+ foreach ($complexValues as $complex) {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($result->isComplex() && $complex->isComplex() &&
+ $result->getSuffix() !== $complex->getSuffix()) {
+ throw new Exception('Suffix Mismatch');
+ }
+
+ $real = $result->getReal() + $complex->getReal();
+ $imaginary = $result->getImaginary() + $complex->getImaginary();
+
+ $result = new Complex(
+ $real,
+ $imaginary,
+ ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix())
+ );
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/operations/divideby.php b/vendor/markbaker/complex/classes/src/operations/divideby.php
new file mode 100644
index 0000000..8c84a88
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/operations/divideby.php
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ *
+ * Function code for the complex division operation
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Divides two or more complex numbers
+ *
+ * @param array of string|integer|float|Complex $complexValues The numbers to divide
+ * @return Complex
+ */
+if (!function_exists(__NAMESPACE__ . '\\divideby')) {
+ function divideby(...$complexValues): Complex
+ {
+ if (count($complexValues) < 2) {
+ throw new \Exception('This function requires at least 2 arguments');
+ }
+
+ $base = array_shift($complexValues);
+ $result = clone Complex::validateComplexArgument($base);
+
+ foreach ($complexValues as $complex) {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($result->isComplex() && $complex->isComplex() &&
+ $result->getSuffix() !== $complex->getSuffix()) {
+ throw new Exception('Suffix Mismatch');
+ }
+ if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) {
+ throw new \InvalidArgumentException('Division by zero');
+ }
+
+ $delta1 = ($result->getReal() * $complex->getReal()) +
+ ($result->getImaginary() * $complex->getImaginary());
+ $delta2 = ($result->getImaginary() * $complex->getReal()) -
+ ($result->getReal() * $complex->getImaginary());
+ $delta3 = ($complex->getReal() * $complex->getReal()) +
+ ($complex->getImaginary() * $complex->getImaginary());
+
+ $real = $delta1 / $delta3;
+ $imaginary = $delta2 / $delta3;
+
+ $result = new Complex(
+ $real,
+ $imaginary,
+ ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix())
+ );
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/operations/divideinto.php b/vendor/markbaker/complex/classes/src/operations/divideinto.php
new file mode 100644
index 0000000..dff2174
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/operations/divideinto.php
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ *
+ * Function code for the complex division operation
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Divides two or more complex numbers
+ *
+ * @param array of string|integer|float|Complex $complexValues The numbers to divide
+ * @return Complex
+ */
+if (!function_exists(__NAMESPACE__ . '\\divideinto')) {
+ function divideinto(...$complexValues): Complex
+ {
+ if (count($complexValues) < 2) {
+ throw new \Exception('This function requires at least 2 arguments');
+ }
+
+ $base = array_shift($complexValues);
+ $result = clone Complex::validateComplexArgument($base);
+
+ foreach ($complexValues as $complex) {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($result->isComplex() && $complex->isComplex() &&
+ $result->getSuffix() !== $complex->getSuffix()) {
+ throw new Exception('Suffix Mismatch');
+ }
+ if ($result->getReal() == 0.0 && $result->getImaginary() == 0.0) {
+ throw new \InvalidArgumentException('Division by zero');
+ }
+
+ $delta1 = ($complex->getReal() * $result->getReal()) +
+ ($complex->getImaginary() * $result->getImaginary());
+ $delta2 = ($complex->getImaginary() * $result->getReal()) -
+ ($complex->getReal() * $result->getImaginary());
+ $delta3 = ($result->getReal() * $result->getReal()) +
+ ($result->getImaginary() * $result->getImaginary());
+
+ $real = $delta1 / $delta3;
+ $imaginary = $delta2 / $delta3;
+
+ $result = new Complex(
+ $real,
+ $imaginary,
+ ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix())
+ );
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/operations/multiply.php b/vendor/markbaker/complex/classes/src/operations/multiply.php
new file mode 100644
index 0000000..60de4ce
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/operations/multiply.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ *
+ * Function code for the complex multiplication operation
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Multiplies two or more complex numbers
+ *
+ * @param array of string|integer|float|Complex $complexValues The numbers to multiply
+ * @return Complex
+ */
+if (!function_exists(__NAMESPACE__ . '\\multiply')) {
+ function multiply(...$complexValues): Complex
+ {
+ if (count($complexValues) < 2) {
+ throw new \Exception('This function requires at least 2 arguments');
+ }
+
+ $base = array_shift($complexValues);
+ $result = clone Complex::validateComplexArgument($base);
+
+ foreach ($complexValues as $complex) {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($result->isComplex() && $complex->isComplex() &&
+ $result->getSuffix() !== $complex->getSuffix()) {
+ throw new Exception('Suffix Mismatch');
+ }
+
+ $real = ($result->getReal() * $complex->getReal()) -
+ ($result->getImaginary() * $complex->getImaginary());
+ $imaginary = ($result->getReal() * $complex->getImaginary()) +
+ ($result->getImaginary() * $complex->getReal());
+
+ $result = new Complex(
+ $real,
+ $imaginary,
+ ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix())
+ );
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/markbaker/complex/classes/src/operations/subtract.php b/vendor/markbaker/complex/classes/src/operations/subtract.php
new file mode 100644
index 0000000..79427b5
--- /dev/null
+++ b/vendor/markbaker/complex/classes/src/operations/subtract.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ *
+ * Function code for the complex subtraction operation
+ *
+ * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
+ * @license https://opensource.org/licenses/MIT MIT
+ */
+namespace Complex;
+
+/**
+ * Subtracts two or more complex numbers
+ *
+ * @param array of string|integer|float|Complex $complexValues The numbers to subtract
+ * @return Complex
+ */
+if (!function_exists(__NAMESPACE__ . '\\subtract')) {
+ function subtract(...$complexValues): Complex
+ {
+ if (count($complexValues) < 2) {
+ throw new \Exception('This function requires at least 2 arguments');
+ }
+
+ $base = array_shift($complexValues);
+ $result = clone Complex::validateComplexArgument($base);
+
+ foreach ($complexValues as $complex) {
+ $complex = Complex::validateComplexArgument($complex);
+
+ if ($result->isComplex() && $complex->isComplex() &&
+ $result->getSuffix() !== $complex->getSuffix()) {
+ throw new Exception('Suffix Mismatch');
+ }
+
+ $real = $result->getReal() - $complex->getReal();
+ $imaginary = $result->getImaginary() - $complex->getImaginary();
+
+ $result = new Complex(
+ $real,
+ $imaginary,
+ ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix())
+ );
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/markbaker/complex/composer.json b/vendor/markbaker/complex/composer.json
new file mode 100644
index 0000000..adc24dc
--- /dev/null
+++ b/vendor/markbaker/complex/composer.json
@@ -0,0 +1,77 @@
+{
+ "name": "markbaker/complex",
+ "type": "library",
+ "description": "PHP Class for working with complex numbers",
+ "keywords": ["complex", "mathematics"],
+ "homepage": "https://github.com/MarkBaker/PHPComplex",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Mark Baker",
+ "email": "mark@lange.demon.co.uk"
+ }
+ ],
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
+ "squizlabs/php_codesniffer": "^3.4",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Complex\\": "classes/src/"
+ },
+ "files": [
+ "classes/src/functions/abs.php",
+ "classes/src/functions/acos.php",
+ "classes/src/functions/acosh.php",
+ "classes/src/functions/acot.php",
+ "classes/src/functions/acoth.php",
+ "classes/src/functions/acsc.php",
+ "classes/src/functions/acsch.php",
+ "classes/src/functions/argument.php",
+ "classes/src/functions/asec.php",
+ "classes/src/functions/asech.php",
+ "classes/src/functions/asin.php",
+ "classes/src/functions/asinh.php",
+ "classes/src/functions/atan.php",
+ "classes/src/functions/atanh.php",
+ "classes/src/functions/conjugate.php",
+ "classes/src/functions/cos.php",
+ "classes/src/functions/cosh.php",
+ "classes/src/functions/cot.php",
+ "classes/src/functions/coth.php",
+ "classes/src/functions/csc.php",
+ "classes/src/functions/csch.php",
+ "classes/src/functions/exp.php",
+ "classes/src/functions/inverse.php",
+ "classes/src/functions/ln.php",
+ "classes/src/functions/log2.php",
+ "classes/src/functions/log10.php",
+ "classes/src/functions/negative.php",
+ "classes/src/functions/pow.php",
+ "classes/src/functions/rho.php",
+ "classes/src/functions/sec.php",
+ "classes/src/functions/sech.php",
+ "classes/src/functions/sin.php",
+ "classes/src/functions/sinh.php",
+ "classes/src/functions/sqrt.php",
+ "classes/src/functions/tan.php",
+ "classes/src/functions/tanh.php",
+ "classes/src/functions/theta.php",
+ "classes/src/operations/add.php",
+ "classes/src/operations/subtract.php",
+ "classes/src/operations/multiply.php",
+ "classes/src/operations/divideby.php",
+ "classes/src/operations/divideinto.php"
+ ]
+ },
+ "scripts": {
+ "style": "phpcs --report-width=200 --standard=PSR2 --report=summary,full classes/src/ unitTests/classes/src -n",
+ "versions": "phpcs --report-width=200 --standard=PHPCompatibility --report=summary,full classes/src/ --runtime-set testVersion 7.2- -n"
+ },
+ "minimum-stability": "dev"
+}
diff --git a/vendor/markbaker/complex/examples/complexTest.php b/vendor/markbaker/complex/examples/complexTest.php
new file mode 100644
index 0000000..d8aed62
--- /dev/null
+++ b/vendor/markbaker/complex/examples/complexTest.php
@@ -0,0 +1,154 @@
+<?php
+
+use Complex\Complex as Complex;
+
+include('../classes/Bootstrap.php');
+
+echo 'Create', PHP_EOL;
+
+$x = new Complex(123);
+echo $x, PHP_EOL;
+
+$x = new Complex(123, 456);
+echo $x, PHP_EOL;
+
+$x = new Complex(array(123,456,'j'));
+echo $x, PHP_EOL;
+
+$x = new Complex('1.23e-4--2.34e-5i');
+echo $x, PHP_EOL;
+
+
+echo PHP_EOL, 'Add', PHP_EOL;
+
+$x = new Complex(123);
+$x->add(456);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456);
+$x->add(789.012);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->add(new Complex(-987.654, -32.1));
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->add(-987.654);
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->add(new Complex(0, 1));
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->add(new Complex(0, -1));
+echo $x, PHP_EOL;
+
+
+echo PHP_EOL, 'Subtract', PHP_EOL;
+
+$x = new Complex(123);
+$x->subtract(456);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456);
+$x->subtract(789.012);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->subtract(new Complex(-987.654, -32.1));
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->subtract(-987.654);
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->subtract(new Complex(0, 1));
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->subtract(new Complex(0, -1));
+echo $x, PHP_EOL;
+
+
+echo PHP_EOL, 'Multiply', PHP_EOL;
+
+$x = new Complex(123);
+$x->multiply(456);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456);
+$x->multiply(789.012);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->multiply(new Complex(-987.654, -32.1));
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->multiply(-987.654);
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->multiply(new Complex(0, 1));
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->multiply(new Complex(0, -1));
+echo $x, PHP_EOL;
+
+
+echo PHP_EOL, 'Divide By', PHP_EOL;
+
+$x = new Complex(123);
+$x->divideBy(456);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456);
+$x->divideBy(789.012);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->divideBy(new Complex(-987.654, -32.1));
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->divideBy(-987.654);
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->divideBy(new Complex(0, 1));
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->divideBy(new Complex(0, -1));
+echo $x, PHP_EOL;
+
+
+echo PHP_EOL, 'Divide Into', PHP_EOL;
+
+$x = new Complex(123);
+$x->divideInto(456);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456);
+$x->divideInto(789.012);
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->divideInto(new Complex(-987.654, -32.1));
+echo $x, PHP_EOL;
+
+$x = new Complex(123.456, 78.90);
+$x->divideInto(-987.654);
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->divideInto(new Complex(0, 1));
+echo $x, PHP_EOL;
+
+$x = new Complex(-987.654, -32.1);
+$x->divideInto(new Complex(0, -1));
+echo $x, PHP_EOL;
diff --git a/vendor/markbaker/complex/examples/testFunctions.php b/vendor/markbaker/complex/examples/testFunctions.php
new file mode 100644
index 0000000..69cc7dc
--- /dev/null
+++ b/vendor/markbaker/complex/examples/testFunctions.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace Complex;
+
+include('../classes/Bootstrap.php');
+
+echo 'Function Examples', PHP_EOL;
+
+$functions = array(
+ 'abs',
+ 'acos',
+ 'acosh',
+ 'acsc',
+ 'acsch',
+ 'argument',
+ 'asec',
+ 'asech',
+ 'asin',
+ 'asinh',
+ 'conjugate',
+ 'cos',
+ 'cosh',
+ 'csc',
+ 'csch',
+ 'exp',
+ 'inverse',
+ 'ln',
+ 'log2',
+ 'log10',
+ 'rho',
+ 'sec',
+ 'sech',
+ 'sin',
+ 'sinh',
+ 'sqrt',
+ 'theta'
+);
+
+for ($real = -3.5; $real <= 3.5; $real += 0.5) {
+ for ($imaginary = -3.5; $imaginary <= 3.5; $imaginary += 0.5) {
+ foreach ($functions as $function) {
+ $complexFunction = __NAMESPACE__ . '\\' . $function;
+ $complex = new Complex($real, $imaginary);
+ try {
+ echo $function, '(', $complex, ') = ', $complexFunction($complex), PHP_EOL;
+ } catch (\Exception $e) {
+ echo $function, '(', $complex, ') ERROR: ', $e->getMessage(), PHP_EOL;
+ }
+ }
+ echo PHP_EOL;
+ }
+}
diff --git a/vendor/markbaker/complex/examples/testOperations.php b/vendor/markbaker/complex/examples/testOperations.php
new file mode 100644
index 0000000..ee5699d
--- /dev/null
+++ b/vendor/markbaker/complex/examples/testOperations.php
@@ -0,0 +1,34 @@
+<?php
+
+use Complex\Complex as Complex;
+
+include('../classes/Bootstrap.php');
+
+$values = [
+ new Complex(123),
+ new Complex(456, 123),
+ new Complex(0.0, 456),
+];
+
+foreach ($values as $value) {
+ echo $value, PHP_EOL;
+}
+
+echo 'Addition', PHP_EOL;
+
+$result = \Complex\add(...$values);
+echo '=> ', $result, PHP_EOL;
+
+echo PHP_EOL;
+
+echo 'Subtraction', PHP_EOL;
+
+$result = \Complex\subtract(...$values);
+echo '=> ', $result, PHP_EOL;
+
+echo PHP_EOL;
+
+echo 'Multiplication', PHP_EOL;
+
+$result = \Complex\multiply(...$values);
+echo '=> ', $result, PHP_EOL;
diff --git a/vendor/markbaker/complex/license.md b/vendor/markbaker/complex/license.md
new file mode 100644
index 0000000..e123c90
--- /dev/null
+++ b/vendor/markbaker/complex/license.md
@@ -0,0 +1,25 @@
+The MIT License (MIT)
+=====================
+
+Copyright © `2017` `Mark Baker`
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the “Software”), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file