Re: Solve Feature?
- To: mathgroup at smc.vnet.net
- Subject: [mg52796] Re: Solve Feature?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 13 Dec 2004 04:23:10 -0500 (EST)
- References: <200412100123.UAA18967@smc.vnet.net> <opsir6lsn2iz9bcq@monster.ma.dl.cox.net> <002401c4dfb5$809b6a00$1802a8c0@Pentium4> <opsiu9j4nmiz9bcq@monster.ma.dl.cox.net> <opsiu90xstiz9bcq@monster.ma.dl.cox.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
>
- References:
- Solve bug?
- From: paul@selfreferral.com
- Solve bug?