Table of contents
CompxCLib is a library targeted at everyone that needs to work with complex numbers in a straightforward and elegant manner, utilizing the features of the Kotlin language to make it accessible and simple.
but why not use one of the many libraries out there? compxclib has unique features that make using complex numbers a breeze.
Here are some of the unique features that Compxclib has:
- Main intuitive complex number class, with plenty of operator extensions and
infix pow
function (kotlin exclusive) - Number operator extensions
- Trig, exp, and other kinds of operations that are well optimized
- An expression parser to quickly evaluate mathematical expressions that use complex numbers.
The reason I started working on this library was that I'm in love with complex algebra and I wanted to have a simple-to-use tool in order to create interesting and aesthetically pleasing simulations.
These were some of the tools I used to build this project (except processing, that was used to make the graphics in this document)
Maven
pom.xml |
<dependency>
<groupId>dev.kaytea</groupId>
<artifactId>compxclib</artifactId>
<version>1.2</version>
</dependency> |
Gradle
build.gradle |
dependencies {
//other dependencies...
implementation 'dev.kaytea:compxclib:1.2'
} |
Gradle kotlin
build.gradle.kts |
dependencies {
//other dependencies...
implementation("dev.kaytea:compxclib:1.2")
} |
parsing user input to a complex number |
import compxclib.ComplexNumber;
import compxclib.parser.Parser;
import java.util.Scanner;
public class App{
private static final Scanner scanner = new Scanner(System.in);
private static void calculate() {
String input = scanner.nextLine();
Parser parser = new Parser(input);
ComplexNumber result = parser.parse();
System.out.println(input +" = "+ result);
}
public static void main(String[] args) {
System.out.println("Introduce an expression");
calculate();
}
} |
run multiple operations efficiently |
import compxclib.ComplexNumber
import compxclib.functions.sin
fun main() {
val (width, height) = Pair(1920, 1080)
val results = Array(height) { Array(width) { ComplexNumber(0,0) } }
for (i in 0 ..< height) {
for (j in 0 ..< width){
val currentNumber = ComplexNumber(height, width)
val sinOfCurrentNumber = sin(currentNumber)
results[i][j] = sinOfCurrentNumber
}
}
println(results)
}
|
- Adding a fully functioning complex number class
- Handling typical functions such as
exp(x)
orlog(x)
- Refractor codebase and optimize
- Handling extra functions
- Trig functions
- Hyperbolic functions
- Adding a parser
- Parser returns values
- Parser returns functions
- Examples inside the documentation
Contributing is what makes open source projects so magical, and it unites the community. if you want to suggest a feature then you could either
- Create a new issue with the "Suggestion tag"
- Create a pull request:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
You can contact me with the name "Katherine"
- Email:
katherine@kaytea.dev
- Repo:
https://github.com/KatieUmbra/compxclib