Bug in fixed_point?!

C

C Barrington-Leigh

I cannot figure out what I'm doing wrong. The following does not
return a fixed point:


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)

Chris
 
T

Terry Reedy

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?
 
R

Robert Kern

I cannot figure out what I'm doing wrong. The following does not
return a fixed point:


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)

You will want to ask scipy questions on the scipy-user mailing list:

http://www.scipy.org/Mailing_Lists

When you do, please provide the information that Terry Reedy asked for.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
C

C Barrington-Leigh

When you do, please provide the information that Terry Reedy asked for.

Sorry; quite right. For completeness I'll post here as well as over on
scipy.

Here's the actual code:
---------------------
from scipy import optimize
from math import exp
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)


Here is the output
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top