hessian



-----maxima-bounces at math.utexas.edu wrote: -----

>Another possible definition is
>
>hessian (f, v) := if listp(v) then funmake
>(matrix, outermap (lambda
>([a, b], diff (f, a, 1, b, 1)), v, v)) else
>'hessian (f, v);

The only difference I know of between these two
definitions of hessian is illustrated by:

(%i7) hessian_bw(f,v) := if listp(v) then funmake('matrix,
 makelist(diff(makelist(
 diff(f,vi),vi,v),vj),vj,v)) else funmake('hessian,[f,v])$

(%i8) hessian_rd (f, v) := if listp(v) then funmake (matrix, outermap
(lambda
([a, b], diff (f, a, 1, b, 1)), v, v)) else 'hessian (f, v)$

(%i9) hessian_bw(x*y,[[x],[y]]);
Non-variable 2nd argument to diff: [x]

(%i10) hessian_rd(x*y,[[x],[y]]);
(%o10) matrix([[[0],[1]]],[[[1],[0]]])

And just for fun:

(%i11) hessian_rd(x*y,[matrix([x,y])]);
(%o11) matrix(matrix([[matrix([0,1])],[matrix([1,0])]]))
(%i12) hessian_bw(x*y,[matrix([x,y])]);
(%o12) matrix([0])

Barton