Robert Dodier wrote: > On Dec 4, 2:04 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > >> sage: f.n() >> >> and get back a floating point number. This is surprisingly not >> implemented in Sage, but it isn't. >> (That's basically because Maxima itself doesn't seem to have such >> functionality.) > > I'm guessing that f.n() just turns on the numer flag for Maxima. > numer causes any literal numbers or symbolic constants > to be replaced by floating point values. However the integrate > function is called as without numer. If you want a numerical > integration, call quad_qags or some other Quadpack function.
FYI, scipy has numerical integration, based on quadpack: http://docs.scipy.org/doc/scipy/reference/integrate.html sage: from scipy.integrate import quad sage: f(x) = 250*cos(pi*x/180)^1.8 + 170.35 sage: from sage.ext.fast_eval import fast_float sage: ff = fast_float(f, 'x') sage: quad(ff,0,18) (7435.2795815640284, 8.2548185859776835e-11) sage: timeit('quad(ff,0,18)') 625 loops, best of 3: 118 µs per loop There are lots of options you can pass. If you want an infinite limit, then, use scipy.integrate.Inf. It sounds like it would be good to use this if we wanted a numerical approximation of an integral. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---