Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: Multiplication by 0: non-zero in versions 8 and 9

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131219] Re: Multiplication by 0: non-zero in versions 8 and 9
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Mon, 17 Jun 2013 06:32:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <kph7t1$2es$1@smc.vnet.net>

On Jun 15, 3:16 am, Sotirios Bonanos <sbon... at inp.demokritos.gr>
wrote:
> Hello ,
>
> I have noticed that in all Mathematica versions <8, multiplying a real or complex number by the integer 0 gives 0, but in versions 8 and 9
>
> Times[0, 0.567] gives 0.
>
> and
>
> Times[1.23 + I 2.45, 0] gives 0. + 0. I
>
> I don't know what prompted this change but it is definitely wrong: the zero property of multiplication holds for real and complex numbers also (see https://en.wikipedia.org/wiki/Multiplication#Properties) .
>
> Sotirios Bonanoshttp://www.inp.demokritos.gr/~sbonano/

This is a sort of edge case. It is important (especially in say
matrix algebra) to have machine reals and complexes remain in that
class. Hence the importance of this change which, I agree, can be
disconcerting. But it allows the possibility to avoid unpacking
packed arrays just to handle some elements that have become
exact zeros.

In contrast, higher precision arithmetic behaves as you would expect.

In[7]:= 0*N[1, 20]

Out[7]= 0

What this is, really, is a balancing act in terms of maintaining type
(exact vs approximate), respecting the math (where exact zero times
most things usually does give exact zero), and not doing things that
would needlessly have a bad impact on speed and memory consumption.

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Calculation of a not so simple integral
  • Next by Date: Re: Unable to generate any initial points with NMaximize (or NMinimize)
  • Previous by thread: Re: Multiplication by 0: non-zero in versions 8 and 9
  • Next by thread: fit curve on to an imported graph