[GiNaC-list] Bug Report

Jens Vollinga jens.vollinga at googlemail.com
Wed Jul 20 20:52:32 CEST 2011


Hi Jon,

On 19.07.2011 22:05, Jon Graves wrote:
> Sample version of program attached.  Program generates Hermite
> polynomial to high degree.  It then subs into it a series of numbers.
> The output RANDOMLY generates an incorrect answer.  No answer after a
> substitution should ever be zero, yet zeros inevitably appear.  The
> problem occurs once out of every 3 executions, on average.

to me it looks like a numerical instability caused by the low precision 
of your Z[i]. If you multiply Z[i] by something like 
numeric("1.00000000001") for example you suddenly get a very different 
answer, e.g. something*10^1200 (BIG!!).

The solution seems to be either to rearrange your terms to avoid 
numerical instable cancellations between your terms, or just to increase 
the precision of Z[i] (more digits by maybe using a numeric instead of a 
double?!). I don't know what these Z[i] are, so I don't know whether the 
second option is viable for you.

Regards,
Jens





More information about the GiNaC-list mailing list