Skip to content

Commit 428ae50

Browse files
committed
ReadMe summary
1 parent 0fd4d68 commit 428ae50

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,79 @@ global static default value.
3535

3636
- [Complex on GitHub](https://GitHub.com/GoToLoop/Complex)
3737
- [Documentation](https://GoToLoop.GitHub.io/Complex)
38+
39+
# Complex
40+
## Summary
41+
The code defines a class called `Complex` that represents complex numbers.
42+
It provides various mathematical operations and utility methods
43+
for working with complex numbers.
44+
45+
## Example Usage
46+
```javascript
47+
// Create a complex number
48+
const z = new Complex(2, 3);
49+
50+
// Perform mathematical operations
51+
const sum = z.add(new Complex(1, 1));
52+
const product = z.mult(2);
53+
const abs = z.abs();
54+
55+
// Print the complex number
56+
console.log(z.toString());
57+
```
58+
59+
## Code Analysis
60+
### Main functionalities
61+
- Represents complex numbers with real and imaginary parts
62+
- Provides mathematical operations such as addition, subtraction,
63+
multiplication, division, exponentiation, etc.
64+
- Supports trigonometric and hyperbolic functions for complex numbers
65+
- Allows conversion between polar and rectangular coordinates
66+
- Provides methods for comparing complex numbers and finding roots
67+
___
68+
### Methods
69+
- `abs()`: Calculates the absolute value (modulus) of the complex number
70+
- `add(n)`: Adds another complex number or a real number to the complex number
71+
- `acos()`: Calculates the inverse cosine of the complex number
72+
- `arg()`: Calculates the argument (phase) of the complex number in radians
73+
- `asin()`: Calculates the inverse sine of the complex number
74+
- `atan()`: Calculates the inverse tangent of the complex number
75+
- `cbrt()`: Calculates the cube root of the complex number
76+
- `clone()`: Creates a copy of the complex number
77+
- `conj()`: Calculates the conjugate of the complex number
78+
- `cos()`: Calculates the cosine of the complex number
79+
- `cosec()`: Calculates the cosecant of the complex number
80+
- `cosech()`: Calculates the hyperbolic cosecant of the complex number
81+
- `cosh()`: Calculates the hyperbolic cosine of the complex number
82+
- `cot()`: Calculates the cotangent of the complex number
83+
- `coth()`: Calculates the hyperbolic cotangent of the complex number
84+
- `cubed()`: Calculates the cube of the complex number
85+
- `div(n)`: Divides the complex number by another complex number or a scalar
86+
- `equals(z, epsilon)`: Checks if the complex number is equal to another
87+
complex number within a given tolerance
88+
- `exp()`: Calculates the exponential of the complex number
89+
- `hashCode(hash)`: Generates a hashcode for the complex number
90+
- `isReal(epsilon)`: Checks if complex number is real within a given tolerance
91+
- `isZero(epsilon)`: Checks if complex number is zero within a given tolerance
92+
- `log()`: Calculates the natural logarithm of the complex number
93+
- `mult(n)`: Multiplies the complex number by another complex number or a scalar
94+
- `negate()`: Returns the negation of the complex number
95+
- `norm()`: Returns the normalization of the complex number
96+
- `pow(n)`: Returns the complex number raised to a given exponent
97+
- `roots(n)`: Returns the nth roots of the complex number
98+
- `sin()`: Calculates the sine of the complex number
99+
- `sinh()`: Calculates the hyperbolic sine of the complex number
100+
- `squared()`: Returns the square of the complex number
101+
- `sqrt()`: Returns the square root of the complex number
102+
- `sub(n)`: Subtracts another complex number or real number from complex number
103+
- `tan()`: Returns the tangent of the complex number
104+
- `tanh()`: Returns the hyperbolic tangent of the complex number
105+
- `print(precision)`: Prints the complex number to the console
106+
- `$(precision, $)`: Returns a string representation of the complex number
107+
___
108+
### Fields
109+
- `real`: The real part of the complex number
110+
- `imag`: The imaginary part of the complex number
111+
- `#hashCode`: The cached hashcode for the complex number
112+
- `#$`: The cached string representation for the complex number
113+
___

0 commit comments

Comments
 (0)