hessian calculation with division by zero for first derivative

49 Views Asked by At

I am wanting to calculate the hessian from an example dataset that keeps evolving. At one particular data set, one of the parameters (z) does not change, which causes a division by zero for the derivative.

i was wondering strategies for handling this. Is the appropriate response to say 'there is no hessian', even though 2 out of the 3 parameters can calculate their portion of the hessian matrix?

also I was wondering in this case if my ∂x is supposed to be x3-x1, or x2-x1, and if I am calculating these squared derivatives wrong by doing ∂²x = ∂x3-∂²dx2, or if ∂²x should really just be (x2-x1)².

∂²x = (x2-x1)² seems wrong to me since acceleration was always calculated by taking two sequential derivatives, (and not squaring a single derivative which might be constant)

Example data is below

x1 = 1    y1 = 2   z1 = 3   f1 = 9
x2 = 1.5  y2 = 5   z2 = 3   f2 = 11
x3 = 3    y3 = 3   z3 = 3   f3 = 14


∂²f  = 1      = (14-11)-(11-9)

∂x   = 2      = x3-x1
∂y   = 1      = y3-y1
∂z   = 0      = z3-z1

∂²x  = 2      = (x3-x2)-(x2-x1)  = (3-1.5) - (1.5-1)
∂²y  = 1      = (y3-y2)-(y2-y1)  = (3-5)   - (5-2)
∂²z  = 0      = (z3-z2)-(z2-z1)  = (3-3)   - (3-3)

∂x∂y = 2       
∂x∂z = 0      
∂y∂z = 0 

H = [
      ∂²f/∂²x    ∂²f/∂x∂y   ∂²f/∂x∂z
      ∂²f/∂y∂x   ∂²f/∂y²    ∂²f/∂y∂z
      ∂²f/∂z∂x   ∂²f/∂z∂y   ∂²f/∂z²
    ] 

H = [
      1/2      1/2      1/0
      1/2      1/1      1/0
      1/0      1/0      1/0
    ]