infection model of numeric coercion in Mathematica [Was: Re: Numerical accuracy/precision - this is a bug or]

*To*: mathgroup at smc.vnet.net*Subject*: [mg120294] infection model of numeric coercion in Mathematica [Was: Re: Numerical accuracy/precision - this is a bug or]*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Sun, 17 Jul 2011 06:03:09 -0400 (EDT)

----- Original Message ----- > From: "Bill Rowe" <readnews at sbcglobal.net> > [...] > >So to my opinion Mathematica does the following: 1) first convert > >all numbers to numbers of the lowest precision found in the > >expression, 2) follow the usual evaluation chain. Am I correct? > > I don't know if this is entirely true. In my experience, > Mathematica converts numbers in any expression containing both > machine precision numbers and higher precision numbers to > machine precision before completing the evaluation. But I have > not ever investigated the behavior when using lower precision > than machine precision. I would guess this characteristic is > intended to improve performance since machine precision > computations are done by hardware and arbitrary precision is > done by Mathematica. That is, reducing the precision of higher > precision numbers to machine precision would allow the > evaluation to take place using the FPU resulting in less time to > complete the evaluation. And if this is the goal, I would guess > Mathematica does not reduce machine precision values to lower > precision since this would make them an arbitrary precision > value and increase execution time. Correct. Indeed, it is the other way around. For those computations where a single precision is used by Mathematica, it is going to be the lowest from amongst operands. In this setting (for purposes of determining "lowest"), machine numbers are ascribed a precision of -infinity, so they are completely infectious. Not all operations/functionality in Mathematica will use this model but many of importance will do so. These include linear algebra, quadrature, and more. A plausible exception (not sure of the extent to which it is implemented) might be numeric root finding or optimization, wherein WorkingPrecision and PrecisionGoal could be set high and machine numbers used as starting points. Daniel Lichtblau Wolfram Research