ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 10 Apr 2011 14:52:57 -0500Using Sage Symbolic Functions in Scipy fsolvehttp://ask.sagemath.org/question/8069/using-sage-symbolic-functions-in-scipy-fsolve/I need to find the roots of a system of multivariate non-linear (algebraic) functions and Sage's ``solve`` function is running indefinitely. (Where "indefinitely" means "more than 30 mins".) I only require numerical solutions so I was hoping to use Scipy's ``fsolve`` function instead. However, the functions that I'm generating are Sage symbolic functions, which have been mightly convenient to work with, and I'm having trouble getting them into a format that ``fsolve`` will understand. Does anyone have any suggestions?
The documentation for Scipy's ``fsolve`` can be found [here](http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html#scipy.optimize.fsolve). It looks like a Python function is sufficient.
As a toy example, I've tried the following:
sage: from scipy.optimize import fsolve
sage: var('x,y')
sage: f = x^2 + y^2
sage: def ff(v):
return f(x=v[0],y=v[0])
sage: fsolve(ff,[1,1])
It seems like the naive approach but I'm receiving the error ``TypeError: no canonical coercion from <type 'numpy.int64'> to Symbolic Ring``. Perhaps this is an issue with Sage properly dealing with Numpy/Scipy data types?cswierczSun, 10 Apr 2011 14:52:57 -0500http://ask.sagemath.org/question/8069/