A lightweight mathematical library that allows a comfortable handling of complex numbers in Kotlin Installation The Maven artifact is available in the Maven Central repository: The sources are hosted on GitHub. Examples import org.kotlinmath.* The complex number 4+3i can be […]
Complex Numbers
3 posts
Let’s compare the following Kotlin snippet performing 40 million complex operations: with the equivalent in Python: And the winner is ……Kotlin with an approximately ten times faster execution time! Kotlin:Result: 1.0E7+1.0E7iExecution time: 258 msec Python:Result: (10000000+10000000j)Execution time: 2.7665789127349854 sec
The Mandelbrot set (black) is a subset of the complex plane (s. Wikipedia for more details). The Kotlin source code of this calculation can be found here.