Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: imposing side conditions on Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24038] Re: [mg24029] imposing side conditions on Solve
  • From: Andrzej Kozlowski <andrzej at bekkoame.ne.jp>
  • Date: Wed, 21 Jun 2000 02:20:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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
nad equations as follows:


In[9]:=
eqs = And @@ Join[Thread[Greater[theta1, 0]], Thread[omega1 == omega2]]

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 &&
    ps3 == pp3 && ps4 == pp4 ||
  e1 == 1 && e2 == 1 && e3 == 1 && e4 == 1 && ps1 == pp1 && ps2 == pp2 &&
    ps3 == pp3 && ps4 == pp4

As you can see you get solutions only when the e's have these values. This
may seem strange, for The Mathematica book says that Solve gives generic
solutions and ignores those which are valid only for specific parameters. So
at first sight it would seem that Mathematica should have said that there
were no solutions because the solutions exist only for a specific values of
parameters. However, as is fairly often the case with the Mathematica Book,
the situation is more subtle than you realize on first reading.  In fact,
whether you get a solution or not depends  on the way the values of
parameters gets "forced" on them. To see this consider the following
examples.

In[13]:=
Solve[{x + y == 2, x == a, y == a}, {x, y}]
Out[13]=
{}

We get no answer because the only solution forces a specific value of the
parameter, namely a=1. This is in accordance with the Mathematica Book. As
explained in the Mathematica Book Reduce will give you all the answers:

In[14]:=
Reduce[{x + y == 2, x == a, y == a}, {x, y}]

Out[14]=
a == 1 && x == 1 && y == 1

But now consider a slightly different case:

In[15]:=
Solve[{x + y == 2, x == a, y == a, a == 1}, {x, y}]

Out[15]=
{{x -> 1, y -> 1}}

We get an answer, even though again it only holds for a specific value of
the parameter. The difference is that the value a=1 is forced explicitely
(without using x and y) rahter than "implicitely", as in the first example.
If you now look carefully at your equations you can also see that the values
of the e's are forced explicitely, so you do get an answer.


Andrzej


-- 
Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>




  • Prev by Date: Re: Gradient in FindMininum
  • Next by Date: parallel computing toolkit
  • Previous by thread: Re: imposing side conditions on Solve
  • Next by thread: Re: imposing side conditions on Solve