This is really an mpmath question...
On Wednesday, January 9, 2013 4:25:39 PM UTC-5, Marshall Hampton wrote:
I'm bumping this up since I can't figure it out and I'm talking to Mike at the Sage booth at JMMS. Can anyone answer this?
926 multidimensional = isinstance(fx, (list, tuple, ctx.matrix))
927 except TypeError:
--> 928 fx = f(x0[0])
929 multidimensional = False
930 if 'multidimensional' in kwargs:
TypeError: g() takes exactly 3 arguments (1 given)
So the problem is that we are raising a TypeError and then of course g does *not* take just one argument x0[0] = .57 in this case. Hmm.
try:
fx = f(*x0)
multidimensional = isinstance(fx, (list, tuple, ctx.matrix))
But this assignment should work (and does "by hand"). The only thing that changes x0 is
if isinstance(x0, (list, tuple)):
x0 = [ctx.convert(x) for x in x0]
Got it.
sage: Z = (0.57, 0.85, 0.49)
sage: Z = [mpmath.convert(z) for z in Z]
sage: Z
[mpf('0.56999999999999995'), mpf('0.84999999999999998'), mpf('0.48999999999999999')]
sage: fx = g(*Z)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
TypeError: no canonical coercion from <type 'sage.libs.mpmath.ext_main.mpc'> to Symbolic Ring
So what you need to do is ... tricky. Can someone take it from here? I tried several things (changes to g) to get those mpmath things to behave well (converting back to Sage) but the fact that g is symbolic makes it hard. It should be possible, though!
- kcrisman