Catastrophic Cancellation

Sergei Steshenko sergstesh at yahoo.com
Fri Jul 4 01:15:14 CDT 2008



Applications From Scratch: http://appsfromscratch.berlios.de/


--- On Thu, 7/3/08, Rob Mahurin <rob at utk.edu> wrote:

> From: Rob Mahurin <rob at utk.edu>
> Subject: Re: Catastrophic Cancellation
> To: help-octave at octave.org
> Date: Thursday, July 3, 2008, 3:24 PM
> On Jul 3, 2008, at 8:50 AM, Sergei Steshenko wrote:
> > octave:1> (0.3 - 0.2 - 0.1)/1e-16
> > ans = -0.27756
> >
> > - I do not understand what you wanted to say by your
> reply.
> >
> > I.e. I do not understand what/where the problem is.
> 
> 
> There have been a few questions on this list in the past
> couple weeks  
> phrased as "how can I get more precision from
> Octave," but actually  
> problems of floating-point truncation in numerical
> analysis.  One was  
> a question about a p-value like 1 - (1e-30).  One was
> perhaps an  
> arbitrary precision question?  This seemed to prompt AK to
> post his  
> example of the difference between the three expressions
> 
> 	(1-cos(x)) ./ x.^2;
> 	1./ x.^2 - cos(x) ./ x.^2; and
> 	(.5 - x.^2 / 24)
> 
> as computed by octave (or anything else) on the interval
> between 0  
> and 1e-7.  It really is a pretty example of the sorts of
> things you  
> see when you hit a truncation error problem.  But it's
> only Octave- 
> specific in the sense that Octave is the first introduction
> to  
> numerical analysis for many people.
> 
> Cheers,
> Rob
> 
> -- 
> Rob Mahurin
> Dept. of Physics & Astronomy
> University of Tennessee 	phone: 865 207 2594
> Knoxville, TN 37996     	email: rob at utk.edu
> 
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www.cae.wisc.edu/mailman/listinfo/help-octave


Thanks for the clarifications.

Perhaps 'octave' documentation should contain links to web pages explaining
the basics/pitfalls of computer arithmetic.

Luckily (?) for me I was first taught numerical methods of computation and
only after that programming - probably it's not the case anymore in modern
world.

Regards,
  Sergei.


      


More information about the Help-octave mailing list