Re: DiffMaps package
- To: mathgroup at smc.vnet.net
- Subject: [mg89544] Re: DiffMaps package
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 12 Jun 2008 02:59:46 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g2nu6o$ei2$1@smc.vnet.net>
Modeler wrote: > Hi everybody, > > I need to determine the critical points of a 3D surface parameterized by a function f[x,y]. I was told there is a package called diffMaps (apparently not installed by default) which allows one to easily compute local minima and maxima as well as saddle points. Does anyone know how to get it or else can give any ideas about computation of critical points? Thanks a lot. Say that the function we want to study is the following: f[x_, y_] := 3*x*y - x^3 - y^3 We compute the first derivatives of f w.r.t. to x and y: D[f[x, y], {{x, y}, 1}] {-3 x^2 + 3 y, 3 x - 3 y^2} We equate each derivative to zero and solve for x and y: Solve[% == 0] {{x -> 0, y -> 0}, {x -> 1, y -> 1}, {x -> -(-1)^(1/3), y -> (-1)^(2/3)}, {x -> (-1)^(2/3), y -> -(-1)^(1/3)}} We want only the real points, so we discard the complex solutions: pts = Cases[%, {x -> vx_, y -> vy_} /; Im[vx] == 0 && Im[vy] == 0] {{x -> 0, y -> 0}, {x -> 1, y -> 1}} So we have two critical points: (0, 0) and (1, 1). Now, we compute the Hessian matrix, D[f[x, y], {{x, y}, 2}] {{-6 x, 3}, {3, -6 y}} and take its determinant: % // Det -9 + 36 x y Then we compute the values of the Hessian determinant at the critical points: % /. pts {-9, 27} Since the Hessian is negative at the point (0, 0), we conclude that this is a saddle point. Since the Hessian is positive at the point (1, 1), we conclude that this is a local maximum. We can "check" (or anticipate) these results by plotting the function: Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, PlotRange -> All] ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, ColorFunction -> "SunsetColors"] Regards, -- Jean-Marc