Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Re: FindRoot cannot find obvious solution


On 17 May 2004, at 16:21, Maxim wrote:

> Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote in message  
> news:<c83qlt$li3$1 at smc.vnet.net>...
>> On 14 May 2004, at 13:12, Maxim wrote:
>>
>>> In other words, using true interval arithmetic with low precision
>>> numbers is safe? But that was exactly what I did in the examples with
>>> Interval:
>>>
>>> IntervalMemberQ[Interval[1`2],0]
>>> IntervalMemberQ[Sin[Interval[1`2]],0]
>>>
>>> How does your explanation clarify this inconsistency?
>>
>>
>> You are not actually using "Interval arithmetic" here. At best,you are
>> using a mixture of Interval arithmetic and significance arithmetic.  
>> You
>> can certainly make accurate error estimates using interval arithmetic
>> with exact numbers.
>>
>>
>> IntervalMemberQ[Interval[{1-1/100,1+1/100}],0]
>> False
>>   and so on.
>>
>> I have already answered the other question in another posting. This
>> happens because Sin increases Precision (and by the way, it's not yet
>> another "paradox"). No inconsistency.
>>
>
> But nobody says that Interval[Sin[1`2]] and Sin[Interval[1`2]] should
> be identical; it's no surprise that Sin[Interval[{0,Pi}]] is not
> Interval[{Sin[0],Sin[Pi]}].
>
> Here's what the question was about (it seems that I have to start with
> that). We create Interval[1`2]; numbers -0.29 and 2.2 belong to the
> interval, therefore taking Sin of the interval we must obtain an
> interval which includes at least the range from -0.28 to 1.0;
> otherwise it would be like squaring Interval[{0,2}] and still getting
> Interval[{0,2}] as the answer.
>
> Instead, Sin[Interval[1`2]] returns an interval which includes (by
> IntervalMemberQ) only numbers from 0.12 to 1.0.
>
> It's quite plausible that, while the interval bounds are rounded
> outwards as they should be, the increased precision 'eats up' this
> rounding and in the end we get an interval which is narrower than
> necessary. But to say that there is no inconsistency in the strict
> mathematical sense is incorrect.
>
>>>  As to Equal,
>>> let's count digits:
>>>
>>> In[1]:=
>>> RealDigits[1`2, 2, 8, 1]
>>> RealDigits[1`2, 2, 9, 1]
>>>
>>> Out[1]=
>>> {{0,1,0,0,0,0,0,0},2}
>>>
>>> Out[2]=
>>> {{0,1,0,0,0,0,0,0,0},2}
>>>
>>> There's some uncertainty as to how many digits to take: by default
>>> RealDigits returns 7 digits, but we can ask it to give us 8 digits;
>>> all the next ones will be Indeterminate. I added leading zero just  
>>> for
>>> alignment with RealDigits[2.2,2] and RealDigits[2.3,2], which give
>>>
>>> In[3]:=
>>> RealDigits[2.2,2]
>>> RealDigits[2.3,2]
>>>
>>> Out[3]=
>>> {{1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1 
>>> ,0
>>> ,0,1,
>>>     1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0},2}
>>>
>>> Out[4]=
>>> {{1,0,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0 
>>> ,1
>>> ,1,0,
>>>     0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0},2}
>>>
>>> If the eight-digits rule applies here, 1`2 is either equal to  
>>> anything
>>> (eight digits is all we know) or unequal both to 2.2 and 2.3 by the
>>> leading digit. Perhaps some more 'careful reading of documentation'  
>>> is
>>> required?
>>>
>>> Maxim Rytin
>>> m.r at prontomail.com
>>
>>
>> As I wrote in my other posting, the actual rule is probably based on
>> Precision and not exactly the number of digits, which only roughly
>> corresponds to it. The exact rule for identifying "close" approximate
>> numbers is not given because nobody needs it.
>> In any case, as I wrote before,  significance arithmetic does not work
>> well with low precision numbers and that is the price one pays for it
>> being manageable fast. If you need error estimates for low precision
>> computations use(exact!) interval arithmetic.
>
> We've been through that before: if equality is determined by the
> precision of the number (that would be explanation #4 or so by now?),
> then only numbers in the range from 1-0.01 to 1+0.01 should be
> considered as equal to 1`2.
>
> Maxim Rytin
> m.r at prontomail.com
>
>
>
This is argument is clearly not getting anywhere, and as it concerns  
matters of so little significance that nobody else is likely to pay  
attention to it, this is defintely my last response.

  I never wrote that if equality is determined by the precision of the  
number in the sense of interval arithmetic, because significance  
arithemtic only approximates interval arithmetic. And by interval  
arithmetic I mean what everybody except you means by interval  
arithmetic: exact interval arithemtic. I do not know what the hybrid  
one inplemented in Matheamtica is for, it seems ot me just a byproduct  
of something.

The actual situation is this:

1. Mathematica has a fully implemented exact interval arithemtic. It is  
fully logically self-consistent (barring bugs) and the fact that such  
arithmetic must be in certian ways quite unlike ordinary arithmetic .  
It is in fact "pessimistic" in the sense I described in another thread  
that you started by claiming that a perfectly sensible answer was  
wrong. (Since you seem to know very little about these matters I  
suggest looking at 97 of "Structure and Interpretation of Computer  
Programs"  by Abelson and Sussman and solving problem 2.16. I would  
certainly be interested in seeing your solution.) In any case, exact  
interval arithmetic can be used to give bounds on errors when working  
with low precision numbers. Fortunately most normal people do not do  
this very often so the slowness is not a terrible problem.

2. Mathematica has also significance arithmetic, which is an  
approximation to interval arithmetic. It is fast and works well in the  
sort of situations that most people most of the time find themselves  
in. It achieves this speed by "bending corners", in such a way that  
computations with low precision numbers are generally very unreliable  
and can give paradoxical results. In particular it produces the effect  
you have re-discovered. (If you bothered to check the archives you  
would have discovered that exactly the same discussion, including the  
example with 1`2  was held here already a few years ago). I believe  
that what i have written roughly corresponds to what actually happens  
but in any case it does not matter at all.  The reason why it does not  
mater is that
1. You have been told that significance arithmetic is unreliable in  
such cases
2. As Richard Fateman pointed out the last time this issue was  
discussed (at least in my memory) question like:

1`2 == 2

do not make  sense and there is never any reason to ask them.

3. If you can devise a system of arithmetic that has the advantages of  
significance arithmetic without its defects than I am sure everyone  
will be impressed and maybe even Wolfram will want to hire you.



Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Uniform design
  • Next by Date: Tree and Lists
  • Previous by thread: Re: FindRoot cannot find obvious solution
  • Next by thread: packges for boolean stuff...