Re: RE: [Q] Equation solving?

• To: mathgroup at smc.vnet.net
• Subject: [mg23348] Re: [mg23318] RE: [mg23282] [Q] Equation solving?
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Thu, 4 May 2000 02:59:15 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```I wrote the message below in a hurry and did not express it very well. Here
is another go. We can get the answer slightly faster if we do the following:

In[1]:=
eqns = {Q1 == (2*z + 1 - 1)^2 + 4*1*1,
k1 == 1/Sqrt[Q1]*(v*z - 3/2*(2*z + 1 + 1 -
Sqrt[Q1])), Q2 == (2*z + 1 - 1)^2 + 4*1*1,
k2 == 1/Sqrt[Q2]*((6.1 - v)*z -
2/2*(2*z + 1 + 1 - Sqrt[Q2])),
3/2*(2*z + 1 + 1) + (k1 - 3/2)*Sqrt[Q1] ==
6.1*z - (2/2*(2*z + 1 + 1) + (k2 - 2/2)*Sqrt[Q2])};
In[2]:=
sols = Solve[eqns, {k1, k2, z}, {Q1, Q2, w}]
Out[2]=
{{k1 -> 0., k2 -> 0., z -> 0.}, {k1 -> 0., k2 -> 2., z -> 0.}, {k1 -> 3.,
k2 -> 0., z -> 0.}, {k1 -> 3., k2 -> 2., z -> 0.}}

However, only the first solution is genuine, the rest are spurious (or
parasites). To see this:

In[3]:=
checks = eqns /. sols // FullSimplify
Out[3]=
2.                        2.
{{Q1 == 4., 1. == --------, Q2 == 4., 1. == --------,
Sqrt[Q1]                  Sqrt[Q2]

5. == 1.5 Sqrt[Q1] + 1. Sqrt[Q2]},

2.                       2.
{Q1 == 4., 1. == --------, Q2 == 4., 1. + -------- == 0,
Sqrt[Q1]                 Sqrt[Q2]

5. + 1. Sqrt[Q2] == 1.5 Sqrt[Q1]},

2.                             2.
{Q1 == 4., 1. + -------- == 0, Q2 == 4., 1. == --------,
Sqrt[Q1]                       Sqrt[Q2]

5. + 1.5 Sqrt[Q1] == 1. Sqrt[Q2]},

2.
{Q1 == 4., 1. + -------- == 0, Q2 == 4.,
Sqrt[Q1]

2.
1. + -------- == 0, 5. + 1.5 Sqrt[Q1] + 1. Sqrt[Q2] == 0}}
Sqrt[Q2]
In[4]:=
Map[Solve[#, {Q1, Q2}] &, checks]
Out[4]=
{{{Q1 -> 4., Q2 -> 4.}}, {}, {}, {}}

Andrzej

on 5/2/00 4:33 PM, Andrzej Kozlowski at andrzej at tuins.ac.jp wrote:

> David,
>
>
> In[1]:=
> eqns = {Q1 == (2*z + 1 - 1)^2 + 4*1*1,
> k1 == 1/Sqrt[Q1]*(v*z - 3/2*(2*z + 1 + 1 -
> Sqrt[Q1])), Q2 == (2*z + 1 - 1)^2 + 4*1*1,
> k2 == 1/Sqrt[Q2]*((6.1 - v)*z -
> 2/2*(2*z + 1 + 1 - Sqrt[Q2])),
> 3/2*(2*z + 1 + 1) + (k1 - 3/2)*Sqrt[Q1] ==
> 6.1*z - (2/2*(2*z + 1 + 1) + (k2 - 2/2)*Sqrt[Q2])};
>
> In[2]:=
> eqns2 = Eliminate[eqns, {Q1, Q2}];
> In[3]:=
> ans = Solve[eqns2, {k1, k2, z}]
> Out[3]=
> {{z -> 0., k1 -> 0., k2 -> 0.}, {z -> 0., k1 -> 0., k2 -> 2.}, {z -> 0.,
> k1 -> 3., k2 -> 0.}, {z -> 0., k1 -> 3., k2 -> 2.}}
>
> However, this is not the end of the story! Now let's try to verify the answer.
>
> In[4]:=
> eqns /. ans // FullSimplify
> Out[4]=
> 2.                        2.
> {{Q1 == 4., 1. == --------, Q2 == 4., 1. == --------,
> Sqrt[Q1]                  Sqrt[Q2]
>
> 5. == 1.5 Sqrt[Q1] + 1. Sqrt[Q2]},
>
> 2.                       2.
> {Q1 == 4., 1. == --------, Q2 == 4., 1. + -------- == 0,
> Sqrt[Q1]                 Sqrt[Q2]
>
> 5. + 1. Sqrt[Q2] == 1.5 Sqrt[Q1]},
>
> 2.                             2.
> {Q1 == 4., 1. + -------- == 0, Q2 == 4., 1. == --------,
> Sqrt[Q1]                       Sqrt[Q2]
>
> 5. + 1.5 Sqrt[Q1] == 1. Sqrt[Q2]},
>
> 2.
> {Q1 == 4., 1. + -------- == 0, Q2 == 4.,
> Sqrt[Q1]
>
> 2.
> 1. + -------- == 0, 5. + 1.5 Sqrt[Q1] + 1. Sqrt[Q2] == 0}}
> Sqrt[Q2]
>
> Just look at the last equation: 5. + 1.5 Sqrt[Q1] + 1. Sqrt[Q2] == 0 . Clearly
> this is not possible. In general you can't rely on any solutions Mathematica
> gives you to equations of this sort. This is not a bug: spurious solutions
> naturally arise as part of the slving process and since (in general) it is
> impossible for Mathematica to verify their correctness (in equations with
> parameters) it does not even try to do so.
>
>
> Andrzej Kozlowski
>
>
> on 5/2/00 7:00 AM, David Park at djmp at earthlink.net wrote:
>
>>
>>
>>> From: James [mailto:research at proton.csl.uiuc.edu]
To: mathgroup at smc.vnet.net
>> To: mathgroup at smc.vnet.net
>>> Hello!
>>>
>>> I'm a newbie to Mathematica
>>> and have a question about what's wrong in the following
>>> expression.
>>> (The parameters are generated by the program,
>>> so there're some terms that can be cancelled out.)
>>>
>>> Solve[{ Q1==(2*z+1-1)^2+4*1*1 ,
>>> k1==(1/Sqrt[Q1])*(v*z-(3/2)*(2*z+1+1-Sqrt[Q1])) ,
>>> Q2==(2*z+1-1)^2+4*1*1 ,
>>> k2==(1/Sqrt[Q2])*((6.10-v)* z-(2/2)*(2*z+1+1-Sqrt[Q2])) ,
>>> (3/2)*(2*z+1+1)+(k1-(3/2))*Sqrt[Q1] ==
>>> 6.10*z-((2/2)*(2*z+1+1)+(k2-(2/2))*Sqrt[Q2])}, {z,v}]
>>>
>>> I want to solve the above equations according to 'z',
>>> and I tried several ways in expressing {z,v} or z, {v}, etc
>>> to get an answer(s), but all in vain.
>>>
>>> Is there anyone who can tell me how to express the equations?
>>> Sorry about the question, if this is trivial.
>>> Thank you.
>>>
>>>
>>> James.
>>>
>>
>> This seems to work:
>>
>> eqns = {Q1 == (2*z + 1 - 1)^2 + 4*1*1,
>> k1 == 1/Sqrt[Q1]*(v*z - 3/2*(2*z + 1 + 1 -
>> Sqrt[Q1])), Q2 == (2*z + 1 - 1)^2 + 4*1*1,
>> k2 == 1/Sqrt[Q2]*((6.1 - v)*z -
>> 2/2*(2*z + 1 + 1 - Sqrt[Q2])),
>> 3/2*(2*z + 1 + 1) + (k1 - 3/2)*Sqrt[Q1] ==
>> 6.1*z - (2/2*(2*z + 1 + 1) + (k2 - 2/2)*Sqrt[Q2])};
>>
>> Eliminate[eqns, {Q1, Q2}]
>> Solve[%, {k1, k2, z}]
>>
>> -3.*k1 + k1^2 == 0. && -2.*k2 + k2^2 == 0. && z == 0.
>>
>> {{z -> 0., k1 -> 0., k2 -> 0.}, {z -> 0., k1 -> 0.,
>> k2 -> 2.}, {z -> 0., k1 -> 3., k2 -> 0.},
>> {z -> 0., k1 -> 3., k2 -> 2.}}
>>
>> Or...
>>
>> Eliminate[eqns, {k1, k2}]
>> Solve[%, {Q1, Q2, z}]
>>
>> Q1 == 4. && Q2 == 4. && z == 0. && Q1 != 0. && Q2 != 0.
>>
>> {{Q1 -> 4., Q2 -> 4., z -> 0.}}
>>
>> It appears that v drops out of the equations.
>>
>> David Park
>>

--
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp

```

• Prev by Date: RE: avoid spurious vertical segment in step function plot
• Next by Date: Re: Gif file?
• Previous by thread: Re: RE: [Q] Equation solving?
• Next by thread: avoid spurious vertical segment in step function plot