ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
testFunctions.php
Go to the documentation of this file.
1<?php
2
3namespace Complex;
4
5include('../classes/Bootstrap.php');
6
7echo 'Function Examples', PHP_EOL;
8
9$functions = array(
10 'abs',
11 'acos',
12 'acosh',
13 'acsc',
14 'acsch',
15 'argument',
16 'asec',
17 'asech',
18 'asin',
19 'asinh',
20 'conjugate',
21 'cos',
22 'cosh',
23 'csc',
24 'csch',
25 'exp',
26 'inverse',
27 'ln',
28 'log2',
29 'log10',
30 'rho',
31 'sec',
32 'sech',
33 'sin',
34 'sinh',
35 'sqrt',
36 'theta'
37);
38
39for ($real = -3.5; $real <= 3.5; $real += 0.5) {
40 for ($imaginary = -3.5; $imaginary <= 3.5; $imaginary += 0.5) {
41 foreach ($functions as $function) {
42 $complexFunction = __NAMESPACE__ . '\\' . $function;
43 $complex = new Complex($real, $imaginary);
44 try {
45 echo $function, '(', $complex, ') = ', $complexFunction($complex), PHP_EOL;
46 } catch (\Exception $e) {
47 echo $function, '(', $complex, ') ERROR: ', $e->getMessage(), PHP_EOL;
48 }
49 }
50 echo PHP_EOL;
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
PHP_EOL
Definition: complexTest.php:7