fofopausiomiava

2022-10-07

I am trying to program this but I need to verify if the equations I have are correct
$f\left(x\right)=||x|{|}^{3}+\frac{m}{2}×||x|{|}^{2}$

if this understanding is correct.
And I start with x in ${\mathbb{R}}^{5}$ i.e. a $5×1$ vector, when I solve for hessian using equation 3, I don't get a matrix. I only get a row vector ($1×5$)
||x|| implies Euclidean norm, m is a scalar (but I have been making m a $1×5$ vector to match dimensions of x in my code)

seppegettde

I think that you should start to compute derivative in a single element manner.
$f\left(\mathbf{x}\right)={\left[{x}_{1}^{2}+\dots +{x}_{N}^{2}\right]}^{3/2}+\frac{m}{2}\left[{x}_{1}^{2}+\dots +{x}_{N}^{2}\right]$
Thus using chain rule for the first term
$\frac{\mathrm{\partial }f}{\mathrm{\partial }{x}_{n}}=\frac{3}{2}\cdot \left(2{x}_{n}\right){\left[{x}_{1}^{2}+\dots +{x}_{N}^{2}\right]}^{1/2}+m{x}_{n}=3‖\mathbf{x}‖{x}_{n}+m{x}_{n}$
Arranging the gradient in a column vector,
$\mathbf{g}=\frac{\mathrm{\partial }f}{\mathrm{\partial }\mathbf{x}}=\left(3‖\mathbf{x}‖+m\right)\mathbf{x}$
Repeat for the Hessian by computing ${H}_{mn}=\frac{\mathrm{\partial }{g}_{m}}{\mathrm{\partial }{x}_{n}}$

Do you have a similar question?