7

In 2014, where do I get Clojure trigonometry functions like sin and atan2 ?

I see some of contrib.math is now in https://clojure.github.io/math.numeric-tower/ but that doesn't seem to have these functions.

interstar
  • 26,048
  • 36
  • 112
  • 180

2 Answers2

24

You can call functions in the Java Math class from Clojure.

Java: Math.sin(x)

Clojure: (Math/sin x)

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
  • Is math.numeric-tower just a wrapper around Java Math? And if so, any idea why it doesn't support all the Java Math functions? – interstar Apr 30 '14 at 22:54
2

The Incanter statistical package for Clojure includes acos, asin, atan, atan2, cos, sin, and tan, along with many other potentially useful mathematical functions.

Mars
  • 8,689
  • 2
  • 42
  • 70