On Sat, May 23, 2009 at 11:04 AM, Laurent <moky.m...@gmail.com> wrote: > > >> There are two entries on the bug tracker related to this issue: >> >> http://trac.sagemath.org/sage_trac/ticket/2607 >> >> http://trac.sagemath.org/sage_trac/ticket/5960 >> >> I believe this would be a fairly easy fix for someone familiar with >> knowledge of the relevant scipy methods. >> >> > Well ... okay. > > I'm trying to use scipy.optimize.brute instead, as indicated in the bug > report. I got the same kind of bahaviour > > #! /usr/bin/sage -python > # -*- coding: utf8 -*- > > from sage.all import * > import scipy.optimize > > f = lambda x : (x+1)**2 > print scipy.optimize.brute( f, (slice(-1,3),)) <---- (x+1)**2 works > g = lambda x : sin(x) > print scipy.optimize.brute( g, (slice(-1,3),)) <---- sin(x) crashes > > > I can wait for a fix; I'm not in a hurry. > For my purpose, a brute force computation of 200 values of the function > in my interval will be sufficient.
Do you know about _fast_float_? It makes it vastly faster to do brute force evaluation (it'll easily give you a factor of 10 speedup). Ignore the wall time below: sage: f = lambda x : (x+1)**2 sage: g(x) = (x+1)^2 sage: gfast = g._fast_float_(x) sage: time v = [f(i) for i in srange(float(0),float(1),float(0.0001))] Time: CPU 0.10 s, Wall: 3.80 s sage: time v = [gfast(i) for i in srange(float(0),float(1),float(0.0001))] Time: CPU 0.01 s, Wall: 0.55 s William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---