--
-- This file has been auto-generated by egison-translator.
--

assertEqual "d/d - case 1" (d/d (x ^ 2) x) (2 * x)

assertEqual "d/d - case 2" (d/d (a ^ (x ^ 2)) x) (2 * a ^ (x ^ 2) * log a * x)

assertEqual "d/d - case 3" (d/d (cos x * sin x) x) ((- (sin x ^ 2)) + cos x ^ 2)

assertEqual
  "d/d - case 4"
  (d/d (sigmoid z) z)
  (exp (- z) / (1 + 2 * exp (- z) + exp (- z) ^ 2))

assertEqual "d/d - case 5" (d/d (d/d (log x) x) x) ((-1) / x ^ 2)

assertEqual
  "tailor-expansion - case 1"
  (take 4 (taylorExpansion (e ^ (i * x)) x 0))
  [1, i * x, -1 * x ^ 2 / 2, -1 * i * x ^ 3 / 6]

assertEqual
  "multivariate-tailor-expansion - case 1"
  (take 3 (multivariateTaylorExpansion (f x y) [|x, y|] [|0, 0|]))
  [ f 0 0
  , x * f|1 0 0 + y * f|2 0 0
  , (x ^ 2 * f|1|1 0 0 + x * y * f|1|2 0 0 + x * y * f|2|1 0 0 + y ^ 2 * f|2|2
                                                                           0
                                                                           0) / 2 ]

assertEqual
  "function expr"
  (let f := function (x, y)
    in d/d f y)
  (let f := function (x, y)
    in userRefs f [y])
