# Force a gradient value at a degenerate point

**URL:** <https://discourse.julialang.org/t/force-a-gradient-value-at-a-degenerate-point/7418>\
**Category:** Optimization (Mathematical)\
**Created:** [November 30, 2017, 6:25pm UTC](https://discourse.julialang.org/t/force-a-gradient-value-at-a-degenerate-point/7418 "2017-11-30T18:25:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vepiteski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vepiteski/32/3746_2.png) [@vepiteski](https://discourse.julialang.org/u/vepiteski)\
**Post date:** [November 30, 2017, 6:25pm UTC](https://discourse.julialang.org/t/force-a-gradient-value-at-a-degenerate-point/7418/1 "2017-11-30T18:25:23Z")

</div>

I wish to implement Wolfe’s example

```
x0 = [0; 0.25; 0.0]
lb = [0.0; 0.0; 0.0]
ub = [Inf; Inf; 2.0]
@variable(nlp, lb[i] <= x[i = 1:3] <= ub[i], start = x0[i])

@NLobjective(
    nlp,
    Min,
    4/3*(x[1]^2 - x[1] * x[2] + x[2]^2)^(3/4) - x[3]
)

```

The gradient is not defined at x[1]=x[2]=0.0 but one may fill the hole by forcing it to be [0,0,-1], which is the right value when evaluating the limit.  
How may I force JuMP to return [0,0,1] instead of [NaN,NaN,1]

Thx,  
vepiteski

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [December 1, 2017, 1:34am UTC](https://discourse.julialang.org/t/force-a-gradient-value-at-a-degenerate-point/7418/2 "2017-12-01T01:34:55Z")

</div>

> [@vepiteski](#):
>
> How may I force JuMP to return [0,0,1] instead of [NaN,NaN,1]

You cannot, without modifying JuMP’s code for computing derivatives. You could implement your own callbacks for derivatives at the MathProgBase level instead.
