Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

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[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=
}}

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[2] - x[0]) == c (y[2] - y[0]),
   a (y[1] - y[0]) == b (x[1] - x[0])}], {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