The old round off problem?

Paul Rubin http
Sat Mar 4 22:33:26 CET 2006


"sam" <samschul at pacbell.net> writes:
> Hello all, I am taking a class in scientific programming at the local
> college. My problem is that the following difference produces round off
> errors as the value of x increases. For x >= 19 the diference goes to
> zero.I understand the problem, but am curious as to whether their
> exists a solution.   [f(x)  = cosh^2(x) - sinh^2(x)  = 1]

The usual way is to notice that the difference goes to zero because
the lowest order terms of the Taylor series for cosh^2 and sinh^2 are
equal and cancel each other out.  The solution is to write down the
series for (cosh^2(x) - sinh^2(x)) and add up a few non-cancelled terms.
All these series should converge very fast.



More information about the Python-list mailing list