On Mon, Mar 30, 2009 at 7:47 AM, Jason Grout <jason-s...@creativetrax.com> wrote: > > David Joyner wrote: >> See >> http://www.sagemath.org/doc/reference/sage/functions/piecewise.html >> For example: >> >> >> sage: f1(x) = x^2 >> sage: f = Piecewise([[(0,3),f1]]) >> sage: f.riemann_sum(6,mode="midpoint") >> Piecewise defined function with 6 parts, [[(0, 1/2), 1/16], [(1/2, 1), >> 9/16], [(1, 3/2), 25/16], [(3/2, 2), 49/16], [(2, 5/2), 81/16], [(5/2, >> 3), 121/16]] >> > > > Interesting; I didn't know about this function. Is there a reason it's > not defined for general single-variable expressions (if we give an > interval, of course)? >
I think the reason is historic, since David Joyner wrote the entire Piecewise package and associated functionality before the sage/calculus directory existed. It used to be that the functions (like f1 above) had to be polynomials or Python functions... -- 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 -~----------~----~----~----~------~----~------~--~---