PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.2
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / vendor / markbaker / complex / examples / complexTest.php

complexTest.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.3.2, at vendor/markbaker/complex/examples/complexTest.php

155 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Complex\Complex as Complex;
4
5 include('../classes/Bootstrap.php');
6
7 echo 'Create', PHP_EOL;
8
9 $x = new Complex(123);
10 echo $x, PHP_EOL;
11
12 $x = new Complex(123, 456);
13 echo $x, PHP_EOL;
14
15 $x = new Complex(array(123,456,'j'));
16 echo $x, PHP_EOL;
17
18 $x = new Complex('1.23e-4--2.34e-5i');
19 echo $x, PHP_EOL;
20
21
22 echo PHP_EOL, 'Add', PHP_EOL;
23
24 $x = new Complex(123);
25 $x->add(456);
26 echo $x, PHP_EOL;
27
28 $x = new Complex(123.456);
29 $x->add(789.012);
30 echo $x, PHP_EOL;
31
32 $x = new Complex(123.456, 78.90);
33 $x->add(new Complex(-987.654, -32.1));
34 echo $x, PHP_EOL;
35
36 $x = new Complex(123.456, 78.90);
37 $x->add(-987.654);
38 echo $x, PHP_EOL;
39
40 $x = new Complex(-987.654, -32.1);
41 $x->add(new Complex(0, 1));
42 echo $x, PHP_EOL;
43
44 $x = new Complex(-987.654, -32.1);
45 $x->add(new Complex(0, -1));
46 echo $x, PHP_EOL;
47
48
49 echo PHP_EOL, 'Subtract', PHP_EOL;
50
51 $x = new Complex(123);
52 $x->subtract(456);
53 echo $x, PHP_EOL;
54
55 $x = new Complex(123.456);
56 $x->subtract(789.012);
57 echo $x, PHP_EOL;
58
59 $x = new Complex(123.456, 78.90);
60 $x->subtract(new Complex(-987.654, -32.1));
61 echo $x, PHP_EOL;
62
63 $x = new Complex(123.456, 78.90);
64 $x->subtract(-987.654);
65 echo $x, PHP_EOL;
66
67 $x = new Complex(-987.654, -32.1);
68 $x->subtract(new Complex(0, 1));
69 echo $x, PHP_EOL;
70
71 $x = new Complex(-987.654, -32.1);
72 $x->subtract(new Complex(0, -1));
73 echo $x, PHP_EOL;
74
75
76 echo PHP_EOL, 'Multiply', PHP_EOL;
77
78 $x = new Complex(123);
79 $x->multiply(456);
80 echo $x, PHP_EOL;
81
82 $x = new Complex(123.456);
83 $x->multiply(789.012);
84 echo $x, PHP_EOL;
85
86 $x = new Complex(123.456, 78.90);
87 $x->multiply(new Complex(-987.654, -32.1));
88 echo $x, PHP_EOL;
89
90 $x = new Complex(123.456, 78.90);
91 $x->multiply(-987.654);
92 echo $x, PHP_EOL;
93
94 $x = new Complex(-987.654, -32.1);
95 $x->multiply(new Complex(0, 1));
96 echo $x, PHP_EOL;
97
98 $x = new Complex(-987.654, -32.1);
99 $x->multiply(new Complex(0, -1));
100 echo $x, PHP_EOL;
101
102
103 echo PHP_EOL, 'Divide By', PHP_EOL;
104
105 $x = new Complex(123);
106 $x->divideBy(456);
107 echo $x, PHP_EOL;
108
109 $x = new Complex(123.456);
110 $x->divideBy(789.012);
111 echo $x, PHP_EOL;
112
113 $x = new Complex(123.456, 78.90);
114 $x->divideBy(new Complex(-987.654, -32.1));
115 echo $x, PHP_EOL;
116
117 $x = new Complex(123.456, 78.90);
118 $x->divideBy(-987.654);
119 echo $x, PHP_EOL;
120
121 $x = new Complex(-987.654, -32.1);
122 $x->divideBy(new Complex(0, 1));
123 echo $x, PHP_EOL;
124
125 $x = new Complex(-987.654, -32.1);
126 $x->divideBy(new Complex(0, -1));
127 echo $x, PHP_EOL;
128
129
130 echo PHP_EOL, 'Divide Into', PHP_EOL;
131
132 $x = new Complex(123);
133 $x->divideInto(456);
134 echo $x, PHP_EOL;
135
136 $x = new Complex(123.456);
137 $x->divideInto(789.012);
138 echo $x, PHP_EOL;
139
140 $x = new Complex(123.456, 78.90);
141 $x->divideInto(new Complex(-987.654, -32.1));
142 echo $x, PHP_EOL;
143
144 $x = new Complex(123.456, 78.90);
145 $x->divideInto(-987.654);
146 echo $x, PHP_EOL;
147
148 $x = new Complex(-987.654, -32.1);
149 $x->divideInto(new Complex(0, 1));
150 echo $x, PHP_EOL;
151
152 $x = new Complex(-987.654, -32.1);
153 $x->divideInto(new Complex(0, -1));
154 echo $x, PHP_EOL;
155