Re: Re: imposing side conditions on Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg24070] Re: [mg24038] Re: [mg24029] imposing side conditions on Solve
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Thu, 22 Jun 2000 01:02:04 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Once I saw Bob Hanlon's solution I realized what my own approach (which run
out of time) should have been. The right thing to do is first to use Solve,
and only then Experimental`CylidricalDecomposition. This way we can get a
more explicit answer than Bob got. (In fact
Experimental`CylidricalDecomposition does use Solve (or GroebnerBasis) but
clearly the general algorithm it uses is in this case  less efficent than
first applying Solve alone, and then applying ClyindricalDecomposition only
to inequalities involving solutions.)

In[1]:=
omega1 = {l1^2 + ps1, l1*l2, l2^2 + ps2, l1*l3, l2*l3, l3^2 + ps3,
l1*l4, l2*l4, l3*l4,
l4^2 + ps4};

In[2]:=
theta1 = {l1, l2, l3, l4, ps1, ps2, ps3, ps4};

In[3]:=
omega2 = {e1^2*(ll1^2 + pp1), e1*e2*ll1*ll2, e2^2*(ll2^2 + pp2),
e1*e3*ll1*ll3, e2*e3*ll2*ll3,
e3^2*(ll3^2 + pp3), e1*e4*ll1*ll4, e2*e4*ll2*ll4, e3*e4*ll3*ll4,
e4^2*(ll4^2 + pp4)};

In[4]:=
theta2 = {ll1, ll2, ll3, ll4, pp1, pp2, pp3, pp4};

In[5]:=
sol = Solve[omega1 == omega2, theta1];

In[6]:=
v = And @@ Thread[Flatten[theta1 /. sol[[1]]] > 0];

In[7]:=
w = Join[{e1, e2, e3, e4}, theta2];

In[8]:=
Experimental`CylindricalAlgebraicDecomposition[v, w]

Out[8]=
e1 < 0 && (e2 < 0 && (e3 < 0 &&

(e4 < 0 && ll1 > 0 && ll2 > 0 && ll3 > 0 &&

ll4 > 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0 || e4 > 0 && ll1 > 0 && ll2 > 0 &&

ll3 > 0 && ll4 < 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0) ||

e3 > 0 && (e4 < 0 && ll1 > 0 && ll2 > 0 &&

ll3 < 0 && ll4 > 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0 ||

e4 > 0 && ll1 > 0 && ll2 > 0 && ll3 < 0 &&

ll4 < 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0)) ||

e2 > 0 && (e3 < 0 &&

(e4 < 0 && ll1 > 0 && ll2 < 0 && ll3 > 0 &&

ll4 > 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0 || e4 > 0 && ll1 > 0 && ll2 < 0 &&

ll3 > 0 && ll4 < 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0) ||

e3 > 0 && (e4 < 0 && ll1 > 0 && ll2 < 0 &&

ll3 < 0 && ll4 > 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0 ||

e4 > 0 && ll1 > 0 && ll2 < 0 && ll3 < 0 &&

ll4 < 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0))) ||

e1 > 0 && (e2 < 0 && (e3 < 0 &&

(e4 < 0 && ll1 < 0 && ll2 > 0 && ll3 > 0 &&

ll4 > 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0 || e4 > 0 && ll1 < 0 && ll2 > 0 &&

ll3 > 0 && ll4 < 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0) ||

e3 > 0 && (e4 < 0 && ll1 < 0 && ll2 > 0 &&

ll3 < 0 && ll4 > 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0 ||

e4 > 0 && ll1 < 0 && ll2 > 0 && ll3 < 0 &&

ll4 < 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0)) ||

e2 > 0 && (e3 < 0 &&

(e4 < 0 && ll1 < 0 && ll2 < 0 && ll3 > 0 &&

ll4 > 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0 || e4 > 0 && ll1 < 0 && ll2 < 0 &&

ll3 > 0 && ll4 < 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0) ||

e3 > 0 && (e4 < 0 && ll1 < 0 && ll2 < 0 &&

ll3 < 0 && ll4 > 0 && pp1 > 0 && pp2 > 0 &&

pp3 > 0 && pp4 > 0 ||

e4 > 0 && ll1 < 0 && ll2 < 0 && ll3 < 0 &&

ll4 < 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 &&

pp4 > 0)))

Andrzej

on 6/21/00 3:20 PM, Andrzej Kozlowski at andrzej at bekkoame.ne.jp wrote:

> on 6/20/00 4:07 PM, Albert Maydeu-Olivares at amaydeu at tinet.fut.es wrote:
>
>> Hello everyone,
>>
>> I have two questions for the group on using Solve.
>>
>> 1) How do I impose conditions on the solution? Consider the following
>> example
>>
>>
>> omega1 = {l1^2 + ps1, l1*l2, l2^2 + ps2, l1*l3, l2*l3, l3^2 + ps3,
>> l1*l4, l2*l4, l3*l4,
>> l4^2 + ps4};
>> theta1 = {l1, l2, l3, l4, ps1, ps2, ps3, ps4};
>> omega2 = {e1^2*(ll1^2 + pp1), e1*e2*ll1*ll2, e2^2*(ll2^2 + pp2),
>> e1*e3*ll1*ll3, e2*e3*ll2*ll3,
>> e3^2*(ll3^2 + pp3), e1*e4*ll1*ll4, e2*e4*ll2*ll4, e3*e4*ll3*ll4,
>> e4^2*(ll4^2 + pp4)};
>> theta2 = {ll1, ll2, ll3, ll4, pp1, pp2, pp3, pp4};
>>
>> sol = Solve[omega1 == omega2, theta1]
>>
>> omega2 ==Simplify[omega1/.Flatten[sol[[1]]]]
>>
>> So it works. However, how do I impose the condition that all elements of
>> theta1 must be positive?
>>
>> 2) Why Solve fails to say that there is no solution to this problem?
>>
>> omega1={1 + ps1, 1, 1 + ps2, 1, 1, 1 + ps3, 1, 1, 1, 1 + ps4};
>> theta1={ps1, ps2, ps3, ps4};
>> omega2={e1^2*(1 + pp1), e1*e2, e2^2*(1 + pp2), e1*e3, e2*e3, e3^2*(1 +
>> pp3), e1*e4, e2*e4, e3*e4,
>> e4^2*(1 + pp4)};
>> theta2={pp1, pp2, pp3, pp4};
>> sol = Solve[omega1 == omega2, theta1]
>>
>> omega2 == Simplify[omega1/.sol[[1]]]
>>
>> Thank you for your help,
>>
>> Albert
>>
>
>
> 1) In principle you can do this. However, whether you can do it in practice
> is another matter. I tried the "solution" below on my 233 mghz PowerBook G3,
> giving MathKernel 60 megabytes of Ram but gave up when it could not finish
> after 45 minutes and I gave up. If you have a more powerful computer, more
> Ram and more spare time you might succeed, but then, of course, you might
> not.
>
> This is what you can try doing. We first create up a system of inequalities
>
>
> In[9]:=
>
> Out[9]=
> l1 > 0 && l2 > 0 && l3 > 0 && l4 > 0 && ps1 > 0 &&
>
> ps2 > 0 && ps3 > 0 && ps4 > 0 &&
>
> 2            2     2
> l1  + ps1 == e1  (ll1  + pp1) && l1 l2 == e1 e2 ll1 ll2 &&
>
> 2            2     2
> l2  + ps2 == e2  (ll2  + pp2) && l1 l3 == e1 e3 ll1 ll3 &&
>
> 2            2     2
> l2 l3 == e2 e3 ll2 ll3 && l3  + ps3 == e3  (ll3  + pp3) &&
>
> l1 l4 == e1 e4 ll1 ll4 && l2 l4 == e2 e4 ll2 ll4 &&
>
> 2            2     2
> l3 l4 == e3 e4 ll3 ll4 && l4  + ps4 == e4  (ll4  + pp4)
>
> Next, we define a complete set of variables:
>
> In[10]:=
> vars = Join[{e1, e2, e3, e4}, theta2, theta1]
>
> Out[10]=
> {e1, e2, e3, e4, ll1, ll2, ll3, ll4, pp1, pp2, pp3, pp4, l1, l2, l3, l4,
> ps1, ps2, ps3, ps4}
>
> Now we try:
>
> Experimental`CylindricalAlgebraicDecomposition[eqs, vars]
>
> This is of course assuming that everything is real. As I wrote above, I
> could not wait long enough to get an answer, and I have no idea if it would
> ever arrive. But I then tried the same method on a smaller problem, obtained
> by removing a few variables from your equations and reducing the number of
> equations and it worked fine. I do not know of any other method.
>
> 2) The reason is farily subtle, I think. First of all, you can see the full
> solution by using Reduce rather than Solve:
>
> In[6]:=
> Reduce[omega1 == omega2, theta1]
>
> Out[6]=
> e1 == -1 && e2 == -1 && e3 == -1 && e4 == -1 && ps1 == pp1 && ps2 == pp2 &&
>

```

• Prev by Date: Re: imposing side conditions on Solve
• Next by Date: pass to a C program
• Previous by thread: Re: imposing side conditions on Solve
• Next by thread: Re: imposing side conditions on Solve