Re: Changed order of multiplication in Times[a, b, c] in version
- To: mathgroup at smc.vnet.net
- Subject: [mg77621] Re: Changed order of multiplication in Times[a, b, c] in version
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 14 Jun 2007 05:17:39 -0400 (EDT)
- References: <f4okvs$6sk$1@smc.vnet.net>
Hi,
with machine precission numbers you will always get
wrong aswers .. some aswers where wronger than others
but wrong is wrong -- anyway.
Use the exact arithmetic in Mathematica and you will get
the right aswer.
Regards
Jens
Andrew Moylan wrote:
> I think the order in which the pairwise multiplication in Times[a, b,
> c] has changed between version 5.2 and version 6! Can anyone comment
> on this?
>
> Example:
>
> Here are three exact numbers whose product is Sqrt[-1]:
>
> Times[(1 + I)*10^2000, (1 + I)*1/2*10^-2000, 1]
>
> Here are those numbers in approximate form, labelled a, b, and c:
>
> {a, b, c} =
> {
> 1.`15.954589770191005*^2000*(1 + I),
> 5.`15.954589770191005*^-2001*(1 + I),
> 1. + 0.*I
> };
>
> Here are their various pairwise products:
>
> Inputting:
> {
> a*b,
> b*c,
> a*c
> }
> yields the output:
> {
> 0``15.653559774527023 + 1.`15.653559774527023*I,
> 0. + 0.*I,
> 1.`15.954589770191005*^2000 + 1.`15.954589770191005*^2000*I
> }
>
> So far, all these results are identical between versions 5.2 and 6.
>
> Now consider a*b*c. Here is what is given version 5.2:
>
> 0``15.653559774526984 + 1.`15.653559774526984*I
>
> This happens to be the right answer, because it has done the
> multiplication in the order (a*b)*c.
>
> Here is what is given for a*b*c in version 6:
>
> 0. + 0.*I
>
> This happens to be the wrong answer, because it has done the
> multiplication in the order a*(b*c).
>
>