Re: Solve's Strange Output

• To: mathgroup at smc.vnet.net
• Subject: [mg89094] Re: Solve's Strange Output
• From: DrMajorBob <drmajorbob at att.net>
• Date: Sun, 25 May 2008 06:26:39 -0400 (EDT)
• References: <23447542.1211696555486.JavaMail.root@m08>

```Bruce,

It's an artifact of using algebraic methods on machine precision numbers.

Here's a rationalized alternative:

{x[0], y[0]} = Rationalize at {10.5, 6.08};
{x[1], y[1]} = Rationalize at {3.23, 14.4};
{x[2], y[2]} = Rationalize@{18, 12.7};
m = Rationalize at 16.1;
soln = Solve[{a + c == 0, b + d == m*g,
d (x[2] - x[0]) == c (y[2] - y[0]),
a (y[1] - y[0]) == b (x[1] - x[0])}, {a, b, c, d}]

{{a -> -((8778525 g)/1105274), b -> (5023200 g)/552637,
c -> (8778525 g)/1105274, d -> (38742557 g)/5526370}}

N@%

{{a -> -7.9424 g, b -> 9.08951 g, c -> 7.9424 g, d -> 7.01049 g}}

The general (completely algebraic) result has all variables divisible by
g*m:

Clear[m, x, y]
{a, b, c, d}/(g m) /.
First@Solve[{a + c == 0, b + d == m*g,
d (x[2] - x[0]) == c (y[2] - y[0]),
a (y[1] - y[0]) == b (x[1] - x[0])}, {a, b, c, d}] //
Simplify // Column

-(((x[0]-x[1]) (x[0]-x[2]))/(x[2] (y[0]-y[1])+x[0] (y[1]-y[2])+x[1]
(-y[0]+y[2])))
-(((x[0]-x[2]) (y[0]-y[1]))/(x[2] (y[0]-y[1])+x[0] (y[1]-y[2])+x[1]
(-y[0]+y[2])))
((x[0]-x[1]) (x[0]-x[2]))/(x[2] (y[0]-y[1])+x[0] (y[1]-y[2])+x[1]
(-y[0]+y[2]))
((x[0]-x[1]) (y[0]-y[2]))/(x[2] (y[0]-y[1])+x[0] (y[1]-y[2])+x[1]
(-y[0]+y[2]))

Bobby

On Sun, 25 May 2008 01:04:20 -0500, Bruce Colletti
<bwcolletti 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[0],y[0]}={10.5,6.08};
> {x[1],y[1]}={3.23,14.4};
> {x[2],y[2]}={18,12.7};
> m=16.1;
>
> Solve[{a+c==0,b+d==m*g,d(x[2]-x[0])==c(y[2]-y[0]),a(y[1]-y[0])==b(x[1]-x[0])},{a,b,c,d}]
>
> Out[11]= {{a->0.-7.9424 g,b->0.+9.08951 g,c->0.+7.9424 g,d->0.+7.01049
> g}}
>
>

--

DrMajorBob at longhorns.com

```

• Prev by Date: Re: Solve's Strange Output
• Next by Date: Re: "Reduce" wierdness (or too slow?)
• Previous by thread: Re: Re: Solve's Strange Output
• Next by thread: NDSolve limits