Name:

autodiff Computes the first n derivatives of a function at a point or over an interval.

Library name:

sollya_obj_t sollya_lib_autodiff(sollya_obj_t, sollya_obj_t, sollya_obj_t)

Usage:

autodiff(f, n, x0) : (function, integer, constant) -> list autodiff(f, n, I) : (function, integer, range) -> list

Parameters:

Description:

Example 1:

   > L = autodiff(exp(cos(x))+sin(exp(x)), 5, 0);
   > 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

Example 2:

   > f = log(cos(x)+x);
   > 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]

Example 3:

   > L = autodiff(sin(x)/x, 0, [-1,1]);
   > L[0];
   [NaN;NaN]
   > evaluate(sin(x)/x, [-1,1]);
   [0.5403023058681397174009366074429766037323104206179;1]
See also: diff, evaluate
Go back to the list of commands