Thanks for fixing the bugs, Barton.
I should have find them for myself, sorry.
Maybe someone could tell me:
Q2: Is there any advantage in coding hessian in lisp than in maxima?
Or is it a matter of taste or feeling home in the language?
hth Wolfgang
"Barton Willis" <willisb at unk.edu> schrieb:
> I replaced e[i] with e and moved one paren to it's proper location.
> Now it works:
>
> (%i3) hessian1 (e, vars) :=
> block([n:length(vars)],
> genmatrix (lambda([i,j], diff(e,vars[i],1,vars[j],1)), n, n))$
>
> (%i4) hessian1(x^2+y^2,[x,y]);
> (%o4) matrix([2,0],[0,2])
>
> Barton
>
> -----LindnerW at t-online.de (Wolfgang Lindner) wrote: -----
> >;;; Barton's lisp code:
> >(defun $hessian (e vars)
> > (if ($listp vars) (let ((n ($length vars)))
> > ($genmatrix `((lambda) ((mlist) i j) ($diff ,e (nth i ,vars) 1 (nth j
> >,vars) 1)) n n))
> >
> > `(($hessian) ,e ,vars)))
> >
> >My translation:
> >
> >/* my attempt to translate to Maxima */
> >hessian1 (e, vars) :=
> > block([n:length(vars)],
> > genmatrix (lambda([i,j], diff(e[i],vars[i],1,vars[j],1), n, n) );
> > ^^^ ^^^^
> > ? ?
> >Testing it ..
> >
> >(%i87) hessian1(x^2+y^2,[x,y]);
> >(%o87) matrix([0,0],[0,0])