How would you specifically do this dozens of variables? I can see how to do it with two variables, perhaps 3 or maybe even 10. I tried
hessian[Function[Table[x[[k]], {k, 1, 2}], x[[1]]^3 + x[[2]]^6],
Table[x[[k]], {k, 1, 2}]]
And the 2 is something I want to allow to be higher than 20.
What am I doing wrong?