- f is the function to be differentiated.
- n is the order of differentiation.
- x0 is the point at which the function is differentiated.
- I is the interval over which the function is differentiated.

- autodiff computes the first n derivatives of f at point x0. The computation is performed numerically, without symbolically differentiating the expression of f. Yet, the computation is safe since small interval enclosures are produced. More precisely, autodiff returns a list [f_0, ..., f_n] such that, for each i, f_i is a small interval enclosing the exact value of f^(i)(x0).
- Since it does not perform any symbolic differentiation, autodiff is much more efficient than diff and should be preferred when only numerical values are necessary.
- If an interval I is provided instead of a point x0, the list returned by autodiff satisfies: for each i, f^(i)(I) is included in f_i. A particular use is when one wants to know the successive derivatives of a function at a non representable point such as pi. In this case, it suffices to call autodiff with the (almost) point interval I = [pi].
- When I is almost a point interval, the returned enclosures f_i are also almost point intervals. However, when the interval I begins to be fairly large, the enclosures can be deeply overestimated due to the dependency phenomenon present with interval arithmetic.
- As a particular case, f_0 is an enclosure of the image of f over I. However, since the algorithm is not specially designed for this purpose it is not very efficient for this particular task. In particular, it is not able to return a finite enclosure for functions with removable singularities (e.g. sin(x)/x at 0). The command evaluate is much more efficient for computing an accurate enclosure of the image of a function over an interval.

> midpointmode = on!;

> for f_i in L do f_i;

0.3559752813266941742012789792982961497379810154498~2/4~e1

0.5403023058681397174009366074429766037323104206179~0/3~

-0.3019450507398802024611853185539984893647499733880~6/2~e1

-0.252441295442368951995750696489089699886768918239~6/4~e1

0.31227898756481033145214529184139729746320579069~1/3~e1

-0.16634307959006696033484053579339956883955954978~3/1~e2

> L = autodiff(log(cos(x)+x), 5, [2,4]);

> L[0];

[0;1.27643852425465597132446653114905059102580436018893]

> evaluate(f, [2,4]);

[0.45986058925497069206106494332976097408234056912429;1.20787210589964169595901037621103012113048821362855]

> fprime = diff(f);

> L[1];

[2.53086745013099407167484456656211083053393118778677e-2;1.7568024953079282513726390945118290941359128873365]

> evaluate(fprime,[2,4]);

[2.71048755415961996452136364304380881763456815673085e-2;1.1091953066394329083739722578862353140555843127995]

> L[0];

[NaN;NaN]

> evaluate(sin(x)/x, [-1,1]);

[0.5403023058681397174009366074429766037323104206179;1]