https://kotlinlang.org logo
#science
Title
# science
f

Felix Fehse

10/18/2020, 1:03 AM
Hi all, I'm just throwing in here that I'm actually using Kotlin in my research (quantum physics, quantum computer). I basically rewrote the Qutip package (Python) in Kotlin to solve the von Neuman equation including noise. Initially I wrote it in Python but the performance was abysmal. Since I know Java and Kotlin well, I rewrote it there (using the Hipparchus math labrary; former Apache Math). Enormous performance gain, very easy multi-threading (using coroutines) - all I wanted. Unfortunately Hipparchus is missing a lot of complex functions, and some real-valued functions (Fresnel integrals e.g.) so I hit a roadblock just a few days ago and I had to resort to - guess what - Mathematica (offered by the university) 😞 Just sayin, Kotlin for science is awesome!
👍 5
a

altavir

10/18/2020, 5:51 AM
Thank you very much for sharing you experience. It is a first time I've heard of Hipparchus, but I will study it. It would help a lot if you could write here what specific features are you missing so we can add them to kmath aggregator.
Actually, Fresten integrals are quite easy to implement. We've done it for some optimcs simulations some time ago. I can add it quite fast if you still need it.
f

Felix Fehse

10/18/2020, 12:55 PM
@altavir hipparchus is a forked continuation of apache commons math, check it out. I have not yet looked deeply into kmath, but I hope it has a bit less of an oo approach than Java. Sometimes it's just easier to pass in a function argument instead of an object with an interface... I'm also really missing complex numbers and the continuation of all functions to complex arguments - e. g. I need Erfi(z) =-i Erf(i z) which means the error function has to accept complex arguments. Yes, you can divide all that into the real and imag part with each having real-valued integral (FresnelC, FresnelS), but it would be so much easier to just use complex numbers. Also complex numbers in matrices should be there! And while we're at it, why not extend to quaternions ... But I guess that is not so in demand. Maybe I'll contribute to the kmath project some of my stuff when I have the time 😉
a

altavir

10/18/2020, 12:57 PM
Kmath is currently developed as a modern kotlin wrapper library. It has part on top of commons-math, but not a lot thigs kotlinized so far. The generic special functions are on schedule but are not implemented yet.
7 Views