R-based solution for symbolic differentiation. It admits user-defined function as well as function substitution in arguments of functions to be differentiated. Some symbolic simplification is part of the work.
The original version of this software was written in R by Andrew Clausen (clausen at econ.upenn.edu) in 2007.
Mark Reid (mark.reid at anu.edu.au) sent a patch, applied 21/2/2009.
In 2014, Andrew has passed the maintenance to Serguei Sokol (sokol at insa-toulouse.fr). Since then, the software was deeply rewritten and completed.
Main new features include:
param$theta
or x[1]
, x[2]
etc.In R session do:
> library(Deriv)
> f <- function(x, n=2) x^n+sin(n*x) # user defined function to diffierentiate
> (df <- Deriv(f)) # -> c(x = n * x^(n - 1) + n * cos(n * x), n = log(x) * x^n + x * cos(n * x))
> df(2, 3) # -> x n
> Deriv(expression(f(y, 3)), "y") # -> expression(3 * y^2 + 3 * cos(3 * y))
> Deriv(~ f(y, 3), "y") # -> 3 * y^2 + 3 * cos(3 * y)
> y <- 2; eval(Deriv(~ f(y, 3), "y")) # -> 14.88051
For more information and examples:
> ?Deriv
-
) call2009-2-21 Mark Reid's patch
2007 Andrew Clausen has written an original code Deriv.R and Simplify.R distributed on his site https://andrewclausen.net/computing/deriv.html