# [Ipopt] Many zeros in derivative checker

Stefan Vigerske stefan at math.hu-berlin.de
Thu Dec 6 04:58:47 EST 2018

```Hi,

the zeros in the second column essentially mean that the objective
function value returned by eval_f was the same when all but one of the
0th-6th variable changed its value. You might just want to check whether
that is normal for the points in which your objective function is evaluated.

You can use some options to influence the derivative checker, e.g.,
increase
https://www.coin-or.org/Ipopt/documentation/node54.html#opt:derivative_test_perturbation

Stefan

On 12/5/18 12:20 AM, R zu wrote:
> Hi.
>
> I tried the derivative check. Frequently, I see lots of zeros in the finite
> difference estimations of Ipopt.
>
> Is that normal?
>
> When the first derivative is incorrect, I also don't get result for 2nd
> derivative check.
>
> The first derivatives shouldn't have that many zeros unless I am horribly
> wrong.
>
> When I see the error for the first time, I thought I made mistakes.  I
> wrote my own finite difference checker to check all routines. Re-derived
> all equations for several times with pencil and paper and later
> Mathematica. The finite difference checker that I wrote would use a smaller
> and smaller difference (half of last iteration) until the check is correct
> for 3 consecutive iterations.
>
> Starting derivative checker for first derivatives.
>
> * grad_f[          0] =  1.1842907632351778e+01    ~
> 0.0000000000000000e+00  [ 1.184e+01]
> * grad_f[          1] =  1.2460424906788026e-01    ~
> 0.0000000000000000e+00  [ 1.246e-01]
> * grad_f[          2] =  1.0472805499858380e+00    ~
> 0.0000000000000000e+00  [ 1.047e+00]
> * grad_f[          3] =  6.9931703730830419e-01    ~
> 0.0000000000000000e+00  [ 6.993e-01]
> * grad_f[          4] =  2.4718739239530851e-01    ~
> 0.0000000000000000e+00  [ 2.472e-01]
> * grad_f[          5] =  1.5221697258770076e+01    ~
> 0.0000000000000000e+00  [ 1.522e+01]
> * grad_f[          6] =  2.5724843958348642e+00    ~
> 0.0000000000000000e+00  [ 2.572e+00]
> * grad_f[          7] =  1.5711814169401492e+01    ~
> 4.7683715820312500e+01  [ 6.705e-01]
> * grad_f[          8] = -1.9468098702340781e+00    ~
> 0.0000000000000000e+00  [ 1.947e+00]
> * grad_f[         12] =  1.5052015333215602e+04    ~
> 1.5020370483398438e+04  [ 2.107e-03]
> * grad_f[         13] =  9.0539372794162846e+03    ~
> 9.0599060058593750e+03  [ 6.588e-04]
> * grad_f[         14] =  2.0330803745533816e+04    ~
> 2.0313262939453125e+04  [ 8.635e-04]
> * grad_f[         30] = -2.2537556863763431e+04    ~
> -2.2554397583007812e+04  [ 7.467e-04]
> * grad_f[         31] =  9.3473397836600474e+04    ~
> 9.3460083007812500e+04  [ 1.425e-04]
> * grad_f[         32] =  2.4648223780746073e+04    ~
> 2.4652481079101562e+04  [ 1.727e-04]
> Starting derivative checker for second derivatives.
>
>
> Derivative checker detected 15 error(s).
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/ipopt
>

```