Re: Re: Signing with Inequality Constraints
- To: mathgroup at smc.vnet.net
- Subject: [mg22551] Re: [mg22490] Re: [mg22479] Signing with Inequality Constraints
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Thu, 9 Mar 2000 03:24:34 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
on 3/8/00 8:22 AM, Vazzana at vazzana at kyblue.com wrote: > Bob, > > I tried what you suggested and it seems to work. However, if I want to > continue to assume a>b and ask mathematica b-1>a or Sign[a-b] it is unable > to evaluate that. > > In[1]:= > Unprotect[Greater, Less]; Clear[a, b, Greater, Less]; > a /: (a > b) = True; > a /: (b < a) = True; > (b-a < 0) = True; > (0 > b-a) = True; > Protect[Greater, Less]; > {b-a < 0, 0 > b-a, a > b, b < a} > > Out[7]= > {True,True,True,True} > > In[8]:= > b-1<a > > Out[8]= > -1+b<a > > In[9]:= > Sign[b-a] > > Out[9]= > Sign[-a+b] > > Actually my real problem is a little more complex, and perhaps my attempt > to keep it simple was faulty. I am trying to determine whether the > following is positive > > ((a b^3 + 3 b^3 c - a b^2 g + b^2 c g - a b^2 r + a b g r - 2 b c g r + a > b^2 t - b^2 c t + a b g t + b c g t - a b r t + 2 b c r t - a g r t - > 2 a b t^2 - 4 b c t^2 + 2 a r t^2 - 4 b^3 w + b^2 r w + b g r w - 2 b g t > w - b r t w + g r t w + 6 b t^2 w - 2 r t^2 w))/ ((2 b ((3 b^2 - g r + > g t + r t - 4 t^2)))) > > given > > b>t>0 > b>r>0 > g>t > a>c>w>0 > > ---------- >> From: BobHanlon at aol.com To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net >> To: vazzana at kyblue.com; mathgroup at smc.vnet.net >> Subject: [mg22551] [mg22490] Re: [mg22479] Signing with Inequality Constraints >> Date: Saturday, March 04, 2000 12:55 PM >> >> Using 3.0: >> >> Unprotect[Greater, Less]; Clear[a, b, Greater, Less]; >> >> a /: (a > b) = True; >> a /: (b < a) = True; >> (b-a < 0) = True; >> (0 > b-a) = True; >> >> Protect[Greater, Less]; >> >> {b-a < 0, 0 > b-a, a > b, b < a} >> >> {True, True, True, True} >> >> Bob Hanlon >> >> In a message dated 3/4/2000 3:46:17 AM, vazzana at kyblue.com writes: >> >>> Using 3.0, I know that I can define >>> In:= a :/ Sign[a]=-1 >>> in order to say a<0. . >>> >>> Is there an analogous way to tell Mathematica that b-a<0. >>> > > It seems that the answer to your problem is that your expression is not always positive. However the way to deal with such a problem is quite different from the one you have been trying to use. If you have Mathematica 4.0 you can use the function Experimental`CylindricalAlgebraicDecomposition (for Mathematica 3.0 see below). You do this as follows. First let's set up the problem. In[1]:= expr1 = 1/(2*b*(3*b^2 + (r - 4*t)*t + g*(-r + t)))*(a*(b - r)*(b - t)*(b - g + 2*t) + b^3*(3*c - 4*w) + r*(g - 2*t)*t*w + b^2*(c*(g - t) + r*w) + b*(c*(2*(r - 2*t)*t + g*(-2*r + t)) + (g*(r - 2*t) + t*(-r + 6*t))*w)) < 0; In[2]:= expr2 = {b > t > 0, b > r > 0, g > t, a > c > w > 0}; In[3]:= expr = Prepend[expr2, expr1]; vars = {b, t, r, g, a, c, w}; Now you simply try In[4]:= Experimental`CylindricalAlgebraicDecomposition[expr, vars] After a farily long time you will obtain a long answer which I am omitting. You will see from it that the inequalities do have a solution which means that the expression is negative. If you are using Mathematica 3.0 you can't use CylindricalAlgebraicDecomposition directly. But you can do essentially the same things, if you load in the Algebra`AlgebraicInequalities` package. This package contains the function SemialgebraicComponents which can be used to solve basically the same problems as CylindricalAlgebraicDecomposition (actually a subset of these problems). Unfortunately it is more restrictive in the sort of input it accepts, so you have to re-write your problem a little. First, it can only accept inequalities defined by polynomials and not rational functions. In your case this is easily solved by replacing the expression expr1, which is a quotient of two polynomials by their product. Note that if p*q<0 then p/q<0 so we won't loose anything. Thus after loading the package: In[1]:= << "Algebra`AlgebraicInequalities`" we define In[2]:= expr1 = 2*b*(3*b^2 + (r - 4*t)*t + g*(-r + t))*(a*(b - r)*(b - t)*(b - g + 2*t) + b^3*(3*c - 4*w) + r*(g - 2*t)*t*w + b^2*(c*(g - t) + r*w) + b*(c*(2*(r - 2*t)*t + g*(-2*r + t)) + (g*(r - 2*t) + t*(-r + 6*t))*w)) < 0 We also have to re-write expr2 as : In[3]:= expr2 = {b > t, t > 0, b > r, r > 0, g > t, a > c, c > w, w > 0}; As before In[4]:= expr = Prepend[expr2, expr1]; vars = {b, t, r, g, a, c, w}; Now we try: In[5]:= SemialgebraicComponents[expr, vars] Out[5]= {{1, 111/128, 6/7, 3, 1, 1/1024, 1/8192}, {1, 111/128, 6/7, 3, 1, 15/16, 28799/30720}, {1, 111/128, 13/14, 3, 1, 1/1024, 1/8192}, {1, 111/128, 13/14, 3, 1, 15/16, 28799/30720}, {1, 111/128, 13/14, 14, 1, 15/16, 13/14}, {1, 111/128, 14/15, 12, 1, 1/128, 1/1024}, {1, 111/128, 14/15, 12, 1, 15/16, 14/15}, {1, 111/128, 14/15, 13, 1, 15/16, 13/14}, {1, 111/128, 239/240, 13/2, 1, 1/128, 1/1024}, {1, 111/128, 239/240, 13/2, 1, 15/16, 3599/3840}, {1, 111/128, 239/240, 34/5, 1, 15/16, 8/9}} This tells us all the components of the 7-dimensional space defined by the parameters of your expression in which the expresion is strictly negative. As you can see this set is not empty, so your expression is not always non-negative. Thus we know that the answe to your question is no.