R / ADR Server



R code differentiated with automatic differentiation. Here you can differentiate R functions interactively. The differentiated codes are shown in the Output textarea above.

With the ADR package you can differentiate R functions automatically:

Then run, for example:

Either command will send the function definition to this server form and then run the resulting differentiated code.

R features and functions supported by ADR

This is the list of R language features and functions that are supported by ADR. The elements listed here may be used in the user code, depending on the AD method, as shown by the letters F, R, H, and D:

Fforward mode with adrDiffFor
Rreverse mode with adrDiffRev
Hforward-over-reverse mode with adrHessRev
Dfinite differences with adrDiffFD or adrHessFD

Language features

ifF R H D incl. if expressions
forF R H D
whileF R H D
breakF R H D
nextF R H D
function callsF R H D incl. recursive
named argumentsF H D
default parametersF H D
function handlesF R H D e.g. after myfun <- sin will differentiate myfun correctly

Data types

numericF R H D
complexF R H D forward and reverse mode may return different imaginary parts, namely the LHS and RHS of the first Cauchy-Riemann equation
arrayF R H D
matrixF R H D
listF R H D not as independent var. or function result


The list of common R functions that can be differentiated with ADR. In most cases you can add support for any missing function f by providing a function df_f in your scope. For the reverse mode, you have to provide rec_f, a_f, and ret_f.

In the remaining cases ADR will deparse the function f and send the code to the ADR server. Hopefully the differentiated code will then be able to provide the correct derivative.

ConjF R H D
absF R H D
acosF R D
acoshF R D
appendF R D
arrayF R D
asinF R D
asinhF R D
atanF R D
atan2F D
atanhF R D
cF R D
cbindF R H D
colnamesF R H D
colnames<-F R H D
cosF R H D
coshF R D
diagF R D
diffF R D
dimF R H D
dim<-F R H D
dimnamesF R H D
dimnames<-F R H D
do.callF R D
expF R D
fftF R D
is.arrayF R H D
is.complexF R H D
is.doubleF R H D
is.functionF R H D
is.listF R H D
is.matrixF R H D
is.nullF R H D
is.numericF R H D
lapplyF R D
lengthF R H D
listF R H D
logF R D
mvfftF D
namesF R H D
names<-F R H D
normF R H D norm(,"2") only
pmaxF D
pminF D
qrF R D
qr.QF R D
qr.RF R D
qr.qtyF D
qr.qyF D
rangeF R D
rbindF R H D
revF R D
rownamesF R H D
rownames<-F R H D
sinF R H D
sinhF R D
solveF R D
sqrtF R H D
sumF R H D
svdF R D Derivative of the singular values only, as of yet
tF R H D
tanF R H D
tanhF R D