[Date Index]
[Thread Index]
[Author Index]
Re: imposing side conditions on Solve
*To*: mathgroup at smc.vnet.net
*Subject*: [mg24073] Re: [mg24029] imposing side conditions on Solve
*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>
*Date*: Fri, 23 Jun 2000 02:26:42 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Allan,
The first example,
In[9]:=
Solve[{x + y == 2, x == a, y == a}, {x, y, a}]
Out[9]=
{{x -> 1, y -> 1, a -> 1}}
is just a system of three equations in three unknowns, without parameters.
Solve gives the expected unique solution.
In[10]:=
Solve[{x + y == 2, x == a, y == a}, {x, y}, {a}]
Out[10]=
{{x -> 1, y -> 1}}
In the next one Mathematica was instructed to solve the equations by first
eliminating a. Mathematica first eliminates a, getting a system of two
equations
In[21]:=
Eliminate[{x + y == 2, x == a, y == a}, {a}]
Out[21]=
x == y && y == 1
and then solves these two. So the question of non-genericity does not arise.
Finally
In[25]:=
Solve[{x + y == 2, x == a, y == a}]
Out[25]=
{{a -> 1, x -> 1, y -> 1}}
This is really just the same as the first case since when you do not
explicitly specify the variables Mathematica tries to solve for all the
implied variables.
I think the order in which you enter your variables is in fact significant.
If you do not enter them explicitly Mathematica uses canonical ordering.
Solve makes use of GroebnerBasis and in that case just changing the order of
variables can make a big difference to the time taken to complete the
computation. I think this should also be true for Solve, but do not have an
example at hand. That is something Dan Lichtblau certainly knows!
Andrzej
on 6/21/00 5:09 PM, Allan Hayes at hay at haystack.demon.co.uk wrote:
> Andrzej
> You give the following examples and explanations
>
>> 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.
>
> SNIP
>
>> 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.
>
> Here are three more variants:
>
> Solve[{x + y == 2, x == a, y == a}, {x, y, a}]
>
> {{x -> 1, y -> 1, a -> 1}}
>
> Solve[{x + y == 2, x == a, y == a}, {x, y}, {a}]
>
> {{x -> 1, y -> 1}}
>
> Solve[{x + y == 2, x == a, y == a}]
>
> {{a -> 1, x -> 1, y -> 1}}
>
> Any suggestions?
> --
> Allan
> ---------------------
> Allan Hayes
> Mathematica Training and Consulting
> Leicester UK
> www.haystack.demon.co.uk
> hay at haystack.demon.co.uk
> Voice: +44 (0)116 271 4198
> Fax: +44 (0)870 164 0565
>
> "Andrzej Kozlowski" <andrzej at bekkoame.ne.jp> wrote in message
> news:8ipn8l$anb at smc.vnet.net...
>> 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: Re: Conversion of Orderless functions to non Orderless one**
Next by Date:
**Re: Conversion of Orderless functions to non Orderless one**
Previous by thread:
**Re: Re: imposing side conditions on Solve**
Next by thread:
**Gradient in FindMininum**
| |