Skip to content

Wrong hessian calculation #276

@gencsimihaly

Description

@gencsimihaly

Good afternoon,

We tested the following function to compute the Hessian matrix over a vector of intervals, but we encountered an issue.
The resulting Hessian from ReverseDiff differs from those obtained using Intlab and ForwardDiff, and it is not even symmetric as expected.

Here is the code we used:

using IntervalArithmetic
using ReverseDiff
using ForwardDiff

Y = [interval(-10.0, 10.0), interval(-10.0, 10.0)]
function f(x)
   return (sin( 3.0*pi*x[1] ))^2 + ( (x[1] - 1.0)^2 * (1.0 + (sin( 3.0*pi*x[2] ))^2 ) ) +  ( (x[2] - 1.0)^2 * (1.0 + (sin( 2.0*pi*x[2] ))^2 ) ) 
end

h1 = ReverseDiff.hessian( f, Y) #Interval{Float64}[[2.0, 4.0]_com_NG [0.0, 0.0]_com_NG; [-414.691, 414.691]_com_NG [-274.461, 280.461]_com_NG]

h2 = ForwardDiff.hessian(f, Y) #Interval{Float64}[[-353.306, 359.306]_com_NG [-414.691, 414.691]_com_NG; [-414.691, 414.691]_com_NG [-62650.5, 62656.5]_com_NG]
println(h1)
println(h2) 

Thank you in advance for your answer.

Best regards,
M.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions