HI Minh Nguyen"! > I got this far: > > ---------------------------------------------------------------------- > | Sage Version 4.1, Release Date: 2009-07-09 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > sage: import numpy as np > sage: import scipy.optimize > sage: x = np.arange(0, 3.0, 0.25) > sage: y = np.array([0.0, 0.3066, 1.2263, 2.7591, 4.9050, 7.6641, > 11.0363, 15.0216, 19.6200, 24.8316, 30.6562, 37.0941], dtype=float) > sage: def residuals(p, x, y): > ....: k, degree = p > ....: err = y -(k*(x^degree)) > ....: return err > ....: > sage: pinit = [4.0, 3] > sage: scipy.optimize.leastsq(residuals, pinit, args=(x,y)) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > > /home/mvngu/.sage/temp/sage.math.washington.edu/28595/_home_mvngu__sage_init_sage_0.py > in <module>() > > /usr/local/sage/local/lib/python2.6/site-packages/scipy/optimize/minpack.pyc > in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, > gtol, maxfev, epsfcn, factor, diag, warning) > 268 if (maxfev == 0): > 269 maxfev = 200*(n+1) > --> 270 retval = > _minpack._lmdif(func,x0,args,full_output,ftol,xtol,gtol,maxfev,epsfcn,factor,diag) > 271 else: > 272 if col_deriv: > > TypeError: array cannot be safely cast to required type > > As mentioned at the thread > > http://groups.google.com/group/sage-devel/browse_thread/thread/fd1414514c5d83b2 > > the problem is that at the moment there is little support for > automatic data conversion between NumPy and Sage. Here are some > tickets to make this happen: > > #6497 > http://trac.sagemath.org/sage_trac/ticket/6497 > > #5081 > http://trac.sagemath.org/sage_trac/ticket/5081 > > #6506 > http://trac.sagemath.org/sage_trac/ticket/6506 > >
ok, I got it, I will have a look to that. I guess this might be a good occasion to contribute to the Sage code. I will have a look to the developers guide. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
