PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 4.1.1
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v4.1.1
4.1.1 3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / vendor / markbaker / complex / README.md
wp-all-import / vendor / markbaker / complex Last commit date
.github 1 year ago classes 1 year ago examples 1 year ago README.md 1 year ago composer.json 1 year ago license.md 1 year ago
README.md
174 lines
1 PHPComplex
2 ==========
3
4 ---
5
6 PHP Class Library for working with Complex numbers
7
8 [](https://github.com/MarkBaker/PHPComplex/actions![Build Status](https://github.com/MarkBaker/PHPComplex/workflows/main/badge.svg)](https://github.com/MarkBaker/PHPComplex/actions](https://github.com/MarkBaker/PHPComplex/actions)
9 [](https://packagist.org/packages/markbaker/complex![Total Downloads](https://img.shields.io/packagist/dt/markbaker/complex)](https://packagist.org/packages/markbaker/complex](https://packagist.org/packages/markbaker/complex)
10 [](https://packagist.org/packages/markbaker/complex![Latest Stable Version](https://img.shields.io/github/v/release/MarkBaker/PHPComplex)](https://packagist.org/packages/markbaker/complex](https://packagist.org/packages/markbaker/complex)
11 [](https://packagist.org/packages/markbaker/complex![License](https://img.shields.io/github/license/MarkBaker/PHPComplex)](https://packagist.org/packages/markbaker/complex](https://packagist.org/packages/markbaker/complex)
12
13
14 [](https://xkcd.com/2028/![Complex Numbers](https://imgs.xkcd.com/comics/complex_numbers_2x.png)](https://xkcd.com/2028/](https://xkcd.com/2028/)
15
16 ---
17
18 The library currently provides the following operations:
19
20 - addition
21 - subtraction
22 - multiplication
23 - division
24 - division by
25 - division into
26
27 together with functions for
28
29 - theta (polar theta angle)
30 - rho (polar distance/radius)
31 - conjugate
32 * negative
33 - inverse (1 / complex)
34 - cos (cosine)
35 - acos (inverse cosine)
36 - cosh (hyperbolic cosine)
37 - acosh (inverse hyperbolic cosine)
38 - sin (sine)
39 - asin (inverse sine)
40 - sinh (hyperbolic sine)
41 - asinh (inverse hyperbolic sine)
42 - sec (secant)
43 - asec (inverse secant)
44 - sech (hyperbolic secant)
45 - asech (inverse hyperbolic secant)
46 - csc (cosecant)
47 - acsc (inverse cosecant)
48 - csch (hyperbolic secant)
49 - acsch (inverse hyperbolic secant)
50 - tan (tangent)
51 - atan (inverse tangent)
52 - tanh (hyperbolic tangent)
53 - atanh (inverse hyperbolic tangent)
54 - cot (cotangent)
55 - acot (inverse cotangent)
56 - coth (hyperbolic cotangent)
57 - acoth (inverse hyperbolic cotangent)
58 - sqrt (square root)
59 - exp (exponential)
60 - ln (natural log)
61 - log10 (base-10 log)
62 - log2 (base-2 log)
63 - pow (raised to the power of a real number)
64
65
66 ---
67
68 # Installation
69
70 ```shell
71 composer require markbaker/complex:^1.0
72 ```
73
74 # Important BC Note
75
76 If you've previously been using procedural calls to functions and operations using this library, then from version 3.0 you should use [](https://github.com/MarkBaker/PHPComplexFunctionsMarkBaker/PHPComplexFunctions](https://github.com/MarkBaker/PHPComplexFunctions](https://github.com/MarkBaker/PHPComplexFunctions) instead (available on packagist as [](https://packagist.org/packages/markbaker/complex-functionsmarkbaker/complex-functions](https://packagist.org/packages/markbaker/complex-functions](https://packagist.org/packages/markbaker/complex-functions)).
77
78 You'll need to replace `markbaker/complex`in your `composer.json` file with the new library, but otherwise there should be no difference in the namespacing, or in the way that you have called the Complex functions in the past, so no actual code changes are required.
79
80 ```shell
81 composer require markbaker/complex-functions:^3.0
82 ```
83
84 You should not reference this library (`markbaker/complex`) in your `composer.json`, composer wil take care of that for you.
85
86 # Usage
87
88 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
89
90 ```php
91 $real = 1.23;
92 $imaginary = -4.56;
93 $suffix = 'i';
94
95 $complexObject = new Complex\Complex($real, $imaginary, $suffix);
96 ```
97 or as an array
98 ```php
99 $real = 1.23;
100 $imaginary = -4.56;
101 $suffix = 'i';
102
103 $arguments = [$real, $imaginary, $suffix];
104
105 $complexObject = new Complex\Complex($arguments);
106 ```
107 or as a string
108 ```php
109 $complexString = '1.23-4.56i';
110
111 $complexObject = new Complex\Complex($complexString);
112 ```
113
114 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.
115 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).
116
117 ## Performing Mathematical Operations
118
119 To perform mathematical operations with Complex values, you can call the appropriate method against a complex value, passing other values as arguments
120
121 ```php
122 $complexString1 = '1.23-4.56i';
123 $complexString2 = '2.34+5.67i';
124
125 $complexObject = new Complex\Complex($complexString1);
126 echo $complexObject->add($complexString2);
127 ```
128
129 or use the static Operation methods
130 ```php
131 $complexString1 = '1.23-4.56i';
132 $complexString2 = '2.34+5.67i';
133
134 echo Complex\Operations::add($complexString1, $complexString2);
135 ```
136 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.
137
138 You can pass these arguments as Complex objects, or as an array, or string that will parse to a complex object.
139
140 ## Using functions
141
142 When calling any of the available functions for a complex value, you can either call the relevant method for the Complex object
143 ```php
144 $complexString = '1.23-4.56i';
145
146 $complexObject = new Complex\Complex($complexString);
147 echo $complexObject->sinh();
148 ```
149
150 or use the static Functions methods
151 ```php
152 $complexString = '1.23-4.56i';
153
154 echo Complex\Functions::sinh($complexString);
155 ```
156 As with operations, you can pass these arguments as Complex objects, or as an array or string that will parse to a complex object.
157
158
159 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
160
161 ```php
162 $complexString = '1.23-4.56i';
163
164 $complexObject = new Complex\Complex($complexString);
165 echo Complex\Functions::pow($complexObject, 2);
166 ```
167 or pass the additional argument when calling the method
168 ```php
169 $complexString = '1.23-4.56i';
170
171 $complexObject = new Complex\Complex($complexString);
172 echo $complexObject->pow(2);
173 ```
174