Skip to content

CompaJ Math

Danila Rassokhin edited this page Mar 23, 2023 · 1 revision

CompaJ uses Apache Commons Math library for math operations.

Constants

CompaJ has some global math constants, which can be used everywhere in your code:

  • $pi represents PI number
  • $i represents imaginary unit
  • $e represents exponent

Operations on List and Range

CompaJ extends standard Math functions with List and Range compatible versions

Example

//Use ranges
t = (0..10)
sin(t) //[0, ...]
cos(t) //[1, ...]

// Use lists
sin([0, 1, 2]) //[0, ...]

// Use var args
cost(0, 1, 2) //[1, ...]
Clone this wiki locally