ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
atan.php
Go to the documentation of this file.
1<?php
2
10namespace Complex;
11
12//include_once 'Math/Complex.php';
13//include_once 'Math/ComplexOp.php';
14
23if (!function_exists(__NAMESPACE__ . '\\atan')) {
24 function atan($complex): Complex
25 {
26 $complex = Complex::validateComplexArgument($complex);
27
28 if ($complex->isReal()) {
29 return new Complex(\atan($complex->getReal()));
30 }
31
32 $t1Value = new Complex(-1 * $complex->getImaginary(), $complex->getReal());
33 $uValue = new Complex(1, 0);
34
35 $d1Value = clone $uValue;
36 $d1Value = subtract($d1Value, $t1Value);
37 $d2Value = add($t1Value, $uValue);
38 $uResult = $d1Value->divideBy($d2Value);
39 $uResult = ln($uResult);
40
41 return new Complex(
42 (($uResult->getImaginary() == M_PI) ? -M_PI : $uResult->getImaginary()) * -0.5,
43 $uResult->getReal() * 0.5,
44 $complex->getSuffix()
45 );
46 }
47}
An exception for terminatinating execution or to throw for unit testing.
add()
Definition: add.php:2