Ask Your Question

# Cauchy's profile - activity

 2018-08-27 11:17:49 +0100 received badge ● Student (source) 2018-08-27 08:55:03 +0100 asked a question Check if Hessian is Postive Semi-Definite 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) in () ----> 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? 2018-08-27 08:55:03 +0100 asked a question Determine if hessian is positive semi-definite 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) in () ----> 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?