f[x_,y_,z_]:=x*E^-(x^2.+y^2.+z^2.);
grad[x_,y_,z_]:=D[f[s,t,u],{{s,t,u}}]/.{s->x,t->y,u->z};
hessian[x_,y_,z_]:={{D[f[s,t,u],{s,2}],D[f[s,t,u],s,t],D[f[s,t,u],s,u]},{D[f[s,t,u],t,s],D[f[s,t,u],{t,2}],D[f[s,t,u],t,u]},{D[f[s,t,u],u,s],D[f[s,t,u],u,t],D[f[s,t,u],{u,2}]}}/.{s->x,t->y,u->z};
guess={-.5,.3,.3};
nearness=(10^(-3));
iterlimit=100;

(*The following is for postprocessing*)
record={guess};
roof=f[guess[[1]],guess[[2]],guess[[3]]];

For[i=1,i<iterlimit,i++,
old=guess;
(*path is the direction we're traveling*)
path[t_]:=guess-grad[guess[[1]],guess[[2]],guess[[3]]]*t;
(*comp is f composed with γ in the notes; function evaluated over the path*)
comp[t_]:=f[path[t][[1]],path[t][[2]],path[t][[3]]];
(*diff is the first derivative of f composed with γ*)
diff=D[comp[t],t];
(*travel the path until we are at an extrema*)
t0=FindRoot[diff,{t,0}][[1,2]];
(*our new guess is at this extrema*)
guess=path[t0];
(*post-processing: record our travel*)
record=Append[record,guess];

(*exit conditions*)
If[Norm[old-guess]<nearness,
Print["Nearness Achieved: possible minima at ",guess];
Break[];
];
If[f[guess[[1]],guess[[2]]]>roof,
Print["Wrong-way error: use a different initial guess"];
Break[];
];
]
(*POST PROCESSING*)
Show[ContourPlot3D[f[x,y,z],{x,-.8,-.4},{y,-.5,.5},{z,-.5,.5},Contours->10,PerformanceGoal->"Speed",Mesh->None,ContourStyle->Opacity[.08]],Graphics3D[{Black,Arrowheads[0],Arrow[Tube[record]]}],Graphics3D[{PointSize[Large],Point[record]}]]

For[i=1,i<iterlimit,i++,
old=guess;
(*path is the direction we're traveling*)
path[t_]:=guess+Inverse[hessian[guess[[1]],guess[[2]],guess[[3]]]].grad[guess[[1]],guess[[2]],guess[[3]]]*t;
(*comp is the function composed with path; f composed with γ in the notes*)
comp[t_]:=f[path[t][[1]],path[t][[2]],path[t][[3]]];
(*diff is the first derivative of the composition*)
diff=D[comp[t],t];
(*t0 is the travel time to the extrema*)
t0=FindRoot[diff,{t,0}][[1,2]];
(*travel to the extrema; this is our new guess*)
guess=path[t0];
(*post processing: record our travels*)
record=Append[record,guess];

(*exit conditions*)
If[Norm[old-guess]<nearness,
Print["Nearness Achieved: possible minima at ",guess];
Break[];
];
If[f[guess[[1]],guess[[2]]]>roof,
Print["Wrong-way error: use a different initial guess"];
Break[];
];
]
(*POST PROCESSING*)
Show[ContourPlot3D[f[x,y,z],{x,-.8,-.4},{y,-.5,.5},{z,-.5,.5},Contours->10,PerformanceGoal->"Speed",Mesh->None,ContourStyle->Opacity[.08]],Graphics3D[{Black,Arrowheads[0],Arrow[Tube[record]]}],Graphics3D[{PointSize[Large],Point[record]}]]