       Re: Solve's Strange Output

• To: mathgroup at smc.vnet.net
• Subject: [mg89096] Re: Solve's Strange Output
• From: Szabolcs <szhorvat at gmail.com>
• Date: Sun, 25 May 2008 06:27:02 -0400 (EDT)
• References: <g1avr4\$fev\$1@smc.vnet.net>

```On May 25, 9:09 am, Bruce Colletti <bwcolle... at verizon.net> wrote:
> Re 6.0.2 under WinXP.
>
> This code's output is strange:  what does 0.-7.9424 g mean?  Ditto for=
all values returned by Solve.
>
> Thankx.
>
> Bruce
>
> {x,y}={10.5,6.08};
> {x,y}={3.23,14.4};
> {x,y}={18,12.7};
> m=16.1;
>
> Solve[{a+c==0,b+d==m*g,d(x-x)==c(y-y),a(y-y)=
==b(x-x)},{a,b,c,d}]
>
> Out= {{a->0.-7.9424 g,b->0.+9.08951 g,c->0.+7.9424 g,d->0.+7.01049 g=
}}

It has been mentioned many times that using Solve with inexact numbers
invites trouble.  Though in this specific case nothing bad happens, it
is better to Rationalize the numbers before solving:

Solve[Rationalize[{a + c == 0, b + d == m*g,
d (x - x) == c (y - y),
a (y - y) == b (x - x)}], {a, b, c, d}]

0 is not the same as 0.0.  The latter is an inexact zero (we only know
that it is closer to 0 than \$MinMachineNumber), so Mathematica does
not simplify 0. + g.

```

• Prev by Date: Re: Symbols in expression
• Next by Date: Re: Solve's Strange Output
• Previous by thread: Solve's Strange Output
• Next by thread: Re: Re: Solve's Strange Output