Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Bug in fixed_point?!

Reply
Thread Tools

Bug in fixed_point?!

 
 
C Barrington-Leigh
Guest
Posts: n/a
 
      12-21-2010
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
 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      12-21-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

 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      12-21-2010
On 12/20/10 10:03 PM, C Barrington-Leigh wrote:
> 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

 
Reply With Quote
 
C Barrington-Leigh
Guest
Posts: n/a
 
      12-22-2010
On Dec 21, 9:36*am, Robert Kern <(E-Mail Removed)> wrote:
> 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
------------------
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
In [1]: run tmp.py
0.332058 solves fixed point, ie f(0.33205=0.257364 ?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments