Re: Applying a condition to a symbolic matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg117628] Re: Applying a condition to a symbolic matrix
- From: Peter Pein <petsie at dordos.net>
- Date: Tue, 29 Mar 2011 06:49:43 -0500 (EST)
- References: <imfaek$iuj$1@smc.vnet.net>
Am 24.03.2011 12:37, schrieb Denis: > Hello everyone, > > I wish to know how to apply a condition to a symbolic matrix for the > purposes of checking if it is positive definite using PositiveDefiniteQ. A > matrix composed of symbolic expressions may not be positive definite for all > values, but it may be positive definite on a certain domain. > > The matrix I wish to check is the Hessian of the function: > > f[x1_, x2_, x3_, x4_, x5_] := e^(x1 x2 x3 x4 x5); > > which I can get using > > ObtainHessian[f_, x_List?VectorQ] := D[f, {x, 2}]; > HessianF = ObtainHessian[f[x1, x2, x3, x4, x5], {x1, x2, x3, x4, x5}]; > > I wish to consider the function and it's Hessian within these constraints: > > x1^2 + x2^2 + x3^2 + x4^2 + x5^2 - 10 == 0; > x2 x3 - 5 x4 x5 == 0; > > I know of one possible method of doing this and one work-around. The > work-around is to use a constrained minimization function such as > FindMinValue for {x1,x2,x3,x4,x5}.HessianF.{x1,x2,x3,x4,x5} subject to the > constraints and a starting point, and see if the minimum value is positive. > > The possible method would be using "/;conditions" to apply the constraints, > but I am not sure where to stick it because it is intended for delayed > evaluations. > > Would anyone know how to condition a symbolic matrix? There may be > particular work-arounds for the specific case of determining if it is > positive definite, but it would be lovely to find a solution that is > generally applicable. > > Many thanks, > Denis Hi Denis, the constraints you tell Mathematica with /; regard Patterns. You can get the region directly. As it seems easier to visualize the area where the matrix is not pos.def. I wrote v.H.v <= 0 in the following: hes = D[Exp[Times @@ (vars = x /@ Range[5])], {vars, 2}]; notposdefregion = Reduce[vars.hes.vars <= 0 && vars.vars == 10 && x[2] x[3] == 5 x[4] x[5], vars[[1 ;; 3]], vars[[4 ;; 5]], Reals]; of course one can try to eliminate any other two variables (if any). RegionPlot3D[ N[notposdefregion] /. HoldPattern[a == b] :> Abs[a - b] < 1/20, ##] & @@ Table[{v, -3.2, 3.2}, {v, vars[[1 ;; 3]]}] well, this needs a while but it seems to work. Peter