Re: Solve Feature?

• To: mathgroup at smc.vnet.net
• Subject: [mg52806] Re: Solve Feature?
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Mon, 13 Dec 2004 04:23:37 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

And here is yet one more:

NSolve[ls, {x, y}, WorkingPrecision -> 16]

Message: The precision of the argument function  is less than
WorkingPrecision

{{x -> 39.174682452695581775392025675`16.88279887727562,
y ->
43.749999999999977986844531919275246741047519380245`3\
1.698970004336022},
{x -> 60.8253175473044395408900471261`17.07387777738765\
8, y ->
43.75000000000001490772811047982386874357808993329`31\
.698970004336022}}

which is also the right answer. So we are certainly dealing wiht a
weird bug here.

Andrzej

On 12 Dec 2004, at 18:32, Andrzej Kozlowski wrote:

> One more observation:
>
>
> sols = Solve[ls, {x, y}, VerifySolutions -> True]
>
>
> {{x -> 39.17468245269453, y -> 43.74999999999997},
>   {x -> 60.82531754730549, y -> 43.75000000000001}}
>
>
>
> Andrzej
>
>
>
> On 12 Dec 2004, at 10:18, Andrzej Kozlowski wrote:
>
>> The Solve case is indeed very puzzling. The reason why it is puzzling
>> is this.
>>
>> ls = {(-50 + x)^2 + (-50 + y)^2 == 156.25,
>>  (-50.00000000000002 + x)^2 +
>>    (-37.49999999999999 + y)^2 == 156.25}
>>
>> gr = GroebnerBasis[ls /. Equal -> Subtract, {x, y}];
>>
>>
>> sols1 = Solve[gr == 0, {x, y}]
>>
>>
>> {{y -> 43.7499999999999, x -> 39.17468245269449},
>>   {y -> 43.7499999999999, x -> 60.82531754730555}}
>>
>> This is what I have always believed Solve actually does (Daniel ???).
>> But of course it isn't true here:
>>
>> sols = Solve[ls, {x, y}]
>>
>> {{x -> 16., y -> 43.74999999999993},
>>   {x -> 84., y -> 43.75000000000004}}
>>
>> Looks like a bug to me.
>>
>> The answer we get using GroebnerBasis is indeed very close to that
>> given by using Rationalize, but curiously is not quite identical to
>> it.
>>
>>
>> sols = N[Solve[Rationalize[ls], {x, y}]]
>>
>>
>> {{x -> 39.17468245269452, y -> 43.75},
>>   {x -> 60.82531754730548, y -> 43.75}}
>>
>> sols1 and sols are close enough for Mathematica to consider them
>> equal:
>>
>> ({x, y} /. sols1) == ({x, y} /. sols)
>>
>> True
>>
>> However:
>>
>>
>> ls /. sols1
>>
>> Out[6]=
>> {{True, True}, {False, True}}
>>
>> while
>>
>> ls /. sols
>>
>> Out[7]=
>> {{True, True}, {True, True}}
>>
>> This is somewhat unpleasant.
>>
>> All this seems odd. I have beleived the follwoing to be true. Solve
>> uses GroebnerBasis to solve systems of polynomial equations. To use
>> Groebner basis the polynomials have to be rationalized. That suggests
>> that there should be no difference between the above results. What is
>> going on?
>>
>> As for the NSolve example, I am not very surprised. This, as far as I
>> know,  uses numerical Groebner basis which I think is vulnerable to
>> numerical errors.
>>
>> Andrzej
>>
>>
>>
>> On 12 Dec 2004, at 08:25, DrBob wrote:
>>
>>> *This message was transferred with a trial version of
>>> CommuniGate(tm) Pro*
>>> By the way, it gets even worse if I use NSolve:
>>>
>>> solution = NSolve[{c1, c5}]
>>> {c1, c5} /. solution
>>> Apply[Subtract, {c1, c5}, {1}] /. solution
>>>
>>> {{x -> -4.27759132*^8,
>>>    y -> 43.74999927054117},
>>>   {x -> 4.2775924*^8,
>>>    y -> 43.75000072945884}}
>>> {{False, False}, {False, False}}
>>> {{1.82977917785309*^17,
>>>    1.82977917785309*^17},
>>>   {1.8297792462945597*^17,
>>>    1.8297792462945597*^17}}
>>>
>>> These are simple polynomial equations, so this is really puzzling.
>>>
>>> Bobby
>>>
>>> On Sat, 11 Dec 2004 17:15:30 -0600, DrBob <drbob at bigfoot.com> wrote:
>>>
>>>> HELP!! Here are two very simple quadratic equations (circles):
>>>>
>>>> {c1, c5} = {(-50 + x)^2 + (-50 + y)^2 == 156.25,
>>>>   (-50.00000000000002 + x)^2 +
>>>>     (-37.49999999999999 + y)^2 == 156.25};
>>>>
>>>> If we rationalize before solving, we get accurate solutions:
>>>>
>>>> solution = Solve@Rationalize@{c1, c5}
>>>> solution // N
>>>> {c1, c5} /. solution
>>>> Subtract @@@ {c1, c5} /. solution
>>>>
>>>> {{x -> (25/4)*(8 - Sqrt[3]), y -> 175/4},
>>>>      {x -> (25/4)*(8 + Sqrt[3]), y -> 175/4}}
>>>> {{x -> 39.17468245269452, y -> 43.75},
>>>>    {x -> 60.82531754730548,  y -> 43.75}}
>>>> {{True, True}, {True, True}}
>>>> {{-4.263256414560601*^-14, 4.973799150320701*^-13},
>>>>    {-4.263256414560601*^-14, -4.263256414560601*^-13}}
>>>>
>>>> You can check this visually with ImplicitPlot:
>>>>
>>>> ImplicitPlot[{c1, c5}, {x, -40, 70}]
>>>>
>>>> But if we solve without Rationalize, we get wildly inaccurate
>>>> results:
>>>>
>>>> solution = Solve@{c1, c5}
>>>> {c1, c5} /. solution
>>>> Subtract @@@ {c1, c5} /. solution
>>>>
>>>> {{x -> 16., y -> 43.74999999999993},
>>>>    {x -> 84., y -> 43.75000000000004}}
>>>> {{False, False}, {False, False}}
>>>> {{1038.812500000001, 1038.8125000000005},
>>>>   {1038.8124999999995, 1038.8124999999993}}
>>>>
>>>> I'm using version 5.1.
>>>>
>>>> Bobby
>>>
>>>
>>>
>>> --
>>> DrBob at bigfoot.com
>>> www.eclecticdreams.net
>>>
>>
>

• Prev by Date: Re: Partition of multi dimension list
• Next by Date: Re: Solve Feature?
• Previous by thread: Re: Solve Feature?