Check if Hessian is Postive Semi-Definite [closed]

asked 2018-08-26 20:47:33 -0600

anonymous user

Anonymous

I have a log-likelihood function, and I am trying to determine if it is convex or concave to see if I can use standard optimization techniques. So I am trying to determine if the hessian is positive (or negative) semi-definite. This is what I have done:

from sage.symbolic.constants import Constant
var('E,a,k')
assume(k != 0)
assume(a > 0)
assume(E,'real')
Constant('x')
f(E,a,k) = -log(a - k * (x - E))
g(E,a,k) = -(log(1-k*(x-E)/a))^2/(2*k^2*s^2)
l(E,a,k) = f + g
solve(l.hessian() >= 0, [E,a,k])

However, I am getting this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-90-f091cf87ab45> in <module>()
----> 1 solve(l.hessian() >= Integer(0), [E,a,k])
      2 
      3 
      4 

/usr/lib64/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
    816 
    817     if not isinstance(f, (list, tuple)):
--> 818         raise TypeError("The first argument must be a symbolic expression or a list of symbolic expressions.")
    819 
    820     if len(f)==1:

TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.

How can I fix this so I can get what I want? Is there a better way to do this?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tmonteil
close date 2018-08-27 12:30:29.092468

Comments

Iguananaut gravatar imageIguananaut ( 2018-08-27 03:05:15 -0600 )edit