Bug in fixed_point?!

Discussion in 'Python' started by C Barrington-Leigh, Dec 21, 2010.

  1. 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
    C Barrington-Leigh, Dec 21, 2010
    #1
    1. Advertising

  2. C Barrington-Leigh

    Terry Reedy Guest

    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
    Terry Reedy, Dec 21, 2010
    #2
    1. Advertising

  3. C Barrington-Leigh

    Robert Kern Guest

    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
    Robert Kern, Dec 21, 2010
    #3
  4. On Dec 21, 9:36 am, Robert Kern <> 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.332058)=0.257364 ?
    C Barrington-Leigh, Dec 22, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    Re: BUG? OR NOT A BUG?

    John, Sep 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    544
  2. RedEye
    Replies:
    2
    Views:
    578
    Jason Kester
    Dec 13, 2005
  3. Michel Joly de Lotbiniere

    Bug Parade Bug 4953793

    Michel Joly de Lotbiniere, Nov 30, 2003, in forum: Java
    Replies:
    4
    Views:
    638
    Michel
    Dec 2, 2003
  4. DarkSpy
    Replies:
    4
    Views:
    879
    tom_usenet
    Jun 27, 2003
  5. Steve Holden
    Replies:
    1
    Views:
    392
    Behrang Dadsetan
    Jul 2, 2003
Loading...

Share This Page