[SciPy-User] scipy.optimize.fixed_point -- TypeError: can't multiply sequence by non-int of type 'float'
Ted To
rainexpected@theo...
Tue Sep 4 14:06:18 CDT 2012
Hi,
I'm having trouble figuring out what I'm doing wrong here. I have a
function br(p,q) defined where p and q are lists of length 2 and I'm
trying to compute the fixed point of br for a given q. E.g.,
fixed_point(br,x0=p,args=(q,)). The problem is that I get a TypeError
(the Traceback at the end of this message). I don't know if this could
be the cause or not but br is defined as the argmin of another function
which I've defined (the code is currently pretty ugly but you can find
it at http://pastebin.com/rEc6cKfd).
Any help or suggestions will be much appreciated.
Thanks,
Ted To
TypeError Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in
execfile(fname, *where)
176 else:
177 filename = fname
--> 178 __builtin__.execfile(filename, *where)
/home/ted/texfiles/smoking/quality-computations/quality-provision-equilibrium.py
in <module>()
66 return fixed_point(br,x0=p,args=(q,))
67
---> 68 print eqP(p,q)
69
70 def gstar(q):
/home/ted/texfiles/smoking/quality-computations/quality-provision-equilibrium.py
in eqP(p, q)
63
64 def eqP(p,q):
---> 65 print fixed_point(br,x0=p,args=(q,))
66 return fixed_point(br,x0=p,args=(q,))
67
/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.pyc in
fixed_point(func, x0, args, xtol, maxiter)
509 p1 = func(p0, *args)
510 p2 = func(p1, *args)
--> 511 d = p2 - 2.0 * p1 + p0
512 p = where(d == 0, p2, p0 - (p1 - p0)*(p1 - p0) / d)
513 relerr = where(p0 == 0, p, (p-p0)/p0)
TypeError: can't multiply sequence by non-int of type 'float'
More information about the SciPy-User
mailing list