Skip to content

ollierob/scala-maths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-maths

Symbolic maths library, supporting a wide range of arbitrary-precision operations.

Basic numeric operations:

val re:Real = 5
val z:Complex = Complex(1, 2)
val q:Quaternion = Quaternion(2, 3, 4, 5)
re + z + q shouldBe Quaternion(8, 5, 4, 5)

Extensible numeric operations:

val something:MyCustomType = ...?
re + something shouldBe ...? //Works iff you have defined how MyCustomType adds to Reals

Build up expressions in a human-readable manner:

val x = Variable("x")
val ex = (2 * Ln(x)) + x
val df = ex.df(x)
val sin = Sin(df)
val degree = sin.replace(x, Pi).toConstant.get
degree.evaluate(4 decimalPlaces) shouldBe BigDecimal("0.9978")

Large function library:

Differentiate(EulerPolynomial(7)(5 * Ln(x)), Pi) //Polynomials, partial derivatives
Wigner3j((1,1),(2,-1),(3,0)) + SphericalHarmonic(2,0)(theta/2, Exp(phi)) //Spherical harmonic functions

About

Symbolic maths library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages