diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /vendor/markbaker/complex/examples/testFunctions.php | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to '')
-rw-r--r-- | vendor/markbaker/complex/examples/testFunctions.php | 52 |
1 files changed, 52 insertions, 0 deletions
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;
+ }
+}
|