https://github.com/katieumbra/compxclib
Complex Complete Library, a feature rich complex numbers library for Kotlin and Java
https://github.com/katieumbra/compxclib
advanced-mathematics complex-numbers fun java kotlin library math
Last synced: about 2 months ago
JSON representation
Complex Complete Library, a feature rich complex numbers library for Kotlin and Java
- Host: GitHub
- URL: https://github.com/katieumbra/compxclib
- Owner: KatieUmbra
- License: mit
- Created: 2022-12-08T23:54:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T05:00:36.000Z (over 1 year ago)
- Last Synced: 2025-01-15T07:11:36.943Z (over 1 year ago)
- Topics: advanced-mathematics, complex-numbers, fun, java, kotlin, library, math
- Language: Kotlin
- Homepage: https://katieumbra.github.io/CompxCLib/
- Size: 2.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
CompxCLib
Complex Complete Library
A complete library for all of your complex needs!
[![contributors][Contributors]][Contributors-url]
[![forks][Forks]][Forks-url]
[![stars][Stars]][Stars-url]
[![issues][Issues]][Issues-url]
[![license][License]][License-url]
[![pull requests][PullRequests]][PullRequests-url]
Table of contents
---
## About

> these images were generated using [Processing].
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.
### Inspiration
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.
### Tools used
These were some of the tools I used to build this project (except processing, that was used to make the graphics in this document)
- [![Gradle Logo][GradleIMG]][Gradle]
- [![Processing Logo][ProcessingIMG]][Processing]
- [![IntelliJ IDEA logo][IntelliJIMG]][Idea]
- [![ShadowJar on Github][ShadowJarIMG]][ShadowJar]
- [![Kotlin Logo][KotlinIMG]][Kotlin]
## Getting Started
### Installation
[![repository][MavenCentral]][MavenCentral-url]
Maven
pom.xml
```xml
dev.kaytea
compxclib
1.2
```
Gradle
build.gradle
```gradle
dependencies {
//other dependencies...
implementation 'dev.kaytea:compxclib:1.2'
}
```
Gradle kotlin
build.gradle.kts
```kotlin
dependencies {
//other dependencies...
implementation("dev.kaytea:compxclib:1.2")
}
```
## Examples
parsing user input to a complex number
```java
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
```kotlin
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)
}
```
## Roadmap
- [X] Adding a fully functioning complex number class
- [X] Handling typical functions such as `exp(x)` or `log(x)`
- [ ] Refractor codebase and optimize
- [ ] Handling extra functions
- [X] Trig functions
- [ ] Hyperbolic functions
- [ ] Adding a parser
- [x] Parser returns values
- [ ] Parser returns functions
- [ ] Examples inside the documentation
## Contributing
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:
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## License
Distributed under the MIT License. See `LICENSE` for more information.
## Contact
You can contact me with the name "Katherine"
- Email: `contact@kaytea.dev`
- Repo: `https://github.com/KatieUmbra/compxclib`
## Acknowledgements
- [This readme is heavily inspired on this][README-inspiration]
- [Processing framework used for the images][Processing]
[Contributors]: https://img.shields.io/github/contributors/KatieUmbra/compxclib?color=blue&style=for-the-badge
[Forks]: https://img.shields.io/github/forks/KatieUmbra/compxclib?style=for-the-badge
[Stars]: https://img.shields.io/github/stars/KatieUmbra/compxclib?style=for-the-badge
[Issues]: https://img.shields.io/github/issues/KatieUmbra/compxclib?style=for-the-badge
[License]: https://img.shields.io/github/license/KatieUmbra/compxclib?style=for-the-badge
[PullRequests]: https://img.shields.io/github/issues-pr/KatieUmbra/compxclib?style=for-the-badge
[MavenCentral]: https://img.shields.io/maven-central/v/dev.kaytea/compxclib?style=for-the-badge
[Contributors-url]: https://github.com/KatieUmbra/compxclib/graphs/contributors
[Forks-url]: https://github.com/KatieUmbra/compxclib/network/members
[Stars-url]: https://github.com/KatieUmbra/compxclib
[Issues-url]: https://github.com/KatieUmbra/compxclib/issues
[License-url]: https://mit-license.org/
[PullRequests-url]: https://github.com/KatieUmbra/compxclib/pulls
[MavenCentral-url]: https://repo1.maven.org/maven2/dev/kaytea/compxclib/
[README-inspiration]: https://github.com/othneildrew/Best-README-Template
[Gradle]: https://gradle.org/
[Processing]: https://processing.org/
[Idea]: https://www.jetbrains.com/idea/
[ShadowJar]: https://github.com/johnrengelman/shadow
[Kotlin]: https://kotlinlang.org/
[GradleIMG]: https://img.shields.io/static/v1?label=&message=Gradle&color=lightgray&logo=Gradle&style=flat-square
[ProcessingIMG]: https://img.shields.io/static/v1?label=&message=Processing&color=4d4d4d&logo=ProcessingFoundation&style=flat-square
[IntelliJIMG]: https://img.shields.io/static/v1?label=&message=IntelliJIDEA&color=000000&logo=IntelliJIDEA&style=flat-square
[ShadowJarIMG]: https://img.shields.io/static/v1?label=&message=ShadowJar&color=gray&logo=GitHub&style=flat-square
[KotlinIMG]:https://img.shields.io/static/v1?label=&message=Kotlin&color=FF3850&logo=kotlin&style=flat-square