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: [mg24063] Re: [mg24029] imposing side conditions on Solve
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 22 Jun 2000 01:01:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

on 6/21/00 6:46 PM, Alberto Maydeu Olivares at amaydeu at nil.fut.es wrote:

> My first problem
> 
> 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]
> 
> has 2 generic solutions, namely,
> 
> 
> {{ps1 -> e1^2*pp1, ps2 -> e2^2*pp2, ps3 -> e3^2*pp3, ps4 -> e4^2*pp4,
> l1 -> -(e1*ll1), l2 -> -(e2*ll2), l3 -> -(e3*ll3), l4 -> -(e4*ll4)},
> 
> {ps1 -> e1^2*pp1, ps2 -> e2^2*pp2, ps3 -> e3^2*pp3, ps4 -> e4^2*pp4, l1 ->
> e1*ll1, l2 -> e2*ll2, l3 -> e3*ll3, l4 -> e4*ll4}}
> 
> What I would like to do is to let Mathematica know that l1,..., l4 can not
> be positive real numbers, and that ll1,..., ll4 can only be positive real
> numbers so that it only gives me the second solution.


But this is not enough! You also need to assume something about the e's! For
example, let's assume that the e's are positive. Then we can do this:

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] /. Rule -> Equal

Out[5]=
           2               2               2
{{ps1 == e1  pp1, ps2 == e2  pp2, ps3 == e3  pp3,
 
            2
   ps4 == e4  pp4, l1 == -e1 ll1, l2 == -e2 ll2,
 
   l3 == -e3 ll3, l4 == -e4 ll4},
 
            2               2               2
  {ps1 == e1  pp1, ps2 == e2  pp2, ps3 == e3  pp3,
 
            2
   ps4 == e4  pp4, l1 == e1 ll1, l2 == e2 ll2, l3 == e3 ll3,
 
   l4 == e4 ll4}}

In[6]:=
cond1 = Thread[Take[theta1, 4] < 0]

Out[6]=
{l1 < 0, l2 < 0, l3 < 0, l4 < 0}

In[7]:=
cond2 = Thread[Take[theta2, 4] > 0]

Out[7]=
{ll1 > 0, ll2 > 0, ll3 > 0, ll4 > 0}

In[8]:=
cond3 = Thread[{e1, e2, e3, e4} > 0]

Out[8]=
{e1 > 0, e2 > 0, e3 > 0, e4 > 0}

In[9]:=
Experimental`CylindricalAlgebraicDecomposition[
  And @@ Join[sol[[1]], cond1, cond2, cond3],
  Join[{e1, e2, e3, e4}, theta2, theta1]]

Out[9]=
e1 > 0 && e2 > 0 && e3 > 0 && e4 > 0 && ll1 > 0 &&
 
  ll2 > 0 && ll3 > 0 && ll4 > 0 && l1 == -e1 ll1 &&
 
  l2 == -e2 ll2 && l3 == -e3 ll3 && l4 == -e4 ll4 &&
 
           2                 2                 2
  ps1 == e1  pp1 && ps2 == e2  pp2 && ps3 == e3  pp3 &&
 
           2
  ps4 == e4  pp4

In[10]:=
Experimental`CylindricalAlgebraicDecomposition[
  And @@ Join[sol[[2]], cond1, cond2, cond3],
  Join[{e1, e2, e3, e4}, theta2, theta1]]

Out[10]=
False




This shows that the first solution is the correct one, as I think you
wanted.

> 
> What I was thinking of was to define these symbols as positive, e.g.
> l1/;l1>0 from the onset, then apply Solve. That is, l1 only exists as a
> positive real number. Don't look for the negative solution. That should be
> computationally more effective than anything else.

It can't be done. Solve uses algorithms which work over algebraically closed
fields (complex numbers). The information that certain variables are
positive (and in particular real) can only be used after the complex roots
have been found. This extra information in general makes the problem harder,
not easier. Remember, you are taking about solving equations algebraically,
not numerically. Think of a simple case, like a single polynomial equation,
say of degree 2. In general, you can find the roots immediately, just by
using the formula one learns in school. Now suppose you are also told that
all all the roots and the coefficients of the equation are positive. This
indeed determines the root (its the one with the plus sign before the square
root) but it does not make the problem of finding the roots any simpler, you
still have to use the formula.

> 
> Actually, all I really want to know is whether a solution exists or not.
> This leads me to the second part of my previous message. As both of you
> have pointed out, the 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]
> 
> has two solutions. This can be seen using Reduce. However, it has no
> generic solution which is what Solve in theory should yield. Hence, Solve
> fails in this case. Do you see any way to force Solve to report that there
> is no generic solution?

This is a case in which the parameters e1,e2,e3,e4 can be eliminated from
the equation. This means that if there was a "generic solution", that is one
that was not valid just for some particular values of the parameters
{e1,e2,e3,e4}, than it would have to be valid for all such values. But you
can see that this is not possible by using:

In[17]:=
SolveAlways[omega1 == omega2, {e1, e2, e3, e4}]

Out[17]=
{}


> 
> This question arises because I thought of writing some code to teach my
> students how Mathematica can EASILY verify whether a covariance structure
> is or is not invariant under a linear transformation. I see now that
> Mathematica can't easily do that. E.g., I can't use Solve to report 'False'
> in the second case, which is a rather trivial one. Uhm...
> 
I might be misunderstanding you here, but it seems to me that this is just
the job for SolveAlways (?)


Andrzej



-- 
Andrzej Kozlowski
Toyama International University, JAPAN

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




  • Prev by Date: Re: Precision example
  • Next by Date: Re: Re: imposing side conditions on Solve
  • Previous by thread: Re: imposing side conditions on Solve
  • Next by thread: Re: Re: imposing side conditions on Solve