Bug in fixed_point?!
Terry Reedy
tjreedy at udel.edu
Tue Dec 21 01:03:10 EST 2010
On 12/20/2010 10:03 PM, C Barrington-Leigh wrote:
> I cannot figure out what I'm doing wrong. The following does not
> return a fixed point:
What did it do? For nearly all such questions, cut and paste actual
output or traceback.
> from scipy import optimize
> xxroot= optimize.fixed_point(lambda xx: exp(-2.0*xx)/2.0, 1.0,
> args=(), xtol=1e-12, maxiter=500)
> print ' %f solves fixed point, ie f(%f)=%f ?'%
> (xxroot,xxroot,exp(-2.0*xxroot)/2.0)
from math import exp
x = 1.0
for i in range(70):
print(repr(x))
x = exp(-2.0*x)/2.0
converges to 0.2835716452048919
Did you cut and paste what you actually ran?
--
Terry Jan Reedy
More information about the Python-list
mailing list