This is a simple application for automatic differentiation in Haskell. You will never have to do the differentiation homework again to your maths class.
Supports all basic functions:
Const.. a constantX.. a variable that will be differentiatedSum a b(ora + b) .. a sumMul a b(ora * b) .. a multiplicationPoly x n..x^n,ndoesn't havexinsideExp x..e^xExpCustom a x..a^xLn x.. natural logarithm ofxLog a x.. logarithm ofxto the baseaSin x..sin xCos x..cos x
Install Haskell on your computer, change directory to this folder and run ghci.
Then insert your function and use function derivative to differentiate the
function. You can also use function eval to evaluate your function (or
its derivative) given x of type Double.
Here is an example of creating and differentiating common functions used in machine learning - sigmoid and tanh.
λ> sigmoid = Poly (Sum 1 (Exp (Mul (-1) X))) (-1)
λ> sigmoid
((1.0 + e^(-1.0 * x)))^-1.0
λ> derivative sigmoid
-1.0 * ((1.0 + e^(-1.0 * x)))^(-2.0) * e^(-1.0 * x) * -1.0
λ>
λ>
λ> tanh = 2 * (Poly (Sum 1 (Exp (Mul (-2) X))) (-1)) - 1
λ> derivative tanh
2.0 * -1.0 * ((1.0 + e^(-2.0 * x)))^(-2.0) * e^(-2.0 * x) * -2.0
λ>
λ> eval 1 (derivative sigmoid)
0.19661193324148188
λ>
λ> eval 2.5 tanh
0.9866142981514305