There is something very pleasing about _numerically_ calculating that e^iπ=-1.
(defn cadd [[xr xi] [yr yi]]
[(+ xr yr) (+ xi yi)])
(defn cmul [[xr xi] [yr yi]]
[(- (* xr yr) (* xi yi)) (+ (* yr xi) (* xr yi))])
(defn cscale [[xr xi] s]
[(/ xr s) (/ xi s)])
(defn cprn [[xr xi]]
(prn (double xr) '+ (double xi) 'i))
(defn compound [balance rate periods]
(let [period-rate (cadd [1 0] (cscale rate periods))]
(loop [balance [balance 0]
periods periods]
(if (zero? periods)
balance
(recur (cmul balance period-rate) (dec periods))))))
(cprn (compound 1 [0 3.141592653589793] 100000))
-1.0000493492396174 + 1.0335963488293152E-9 i