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]] On Mon, Mar 30, 2009 at 9:51 AM, M.E._Mac <rickcj...@gmail.com> wrote: > > I am taking a Calculus class and we are studying Reimann Sum. I am > trying to plot a function with the boxes drawn in at the right > endpoints, left endpoints, and middle points. For example, f(x)=x^2, > find the area under the curve on the interval [0,3], n=10, with a) > right endpoints, b) left endpoints, and c) middle points. I can do it > mathematically but I can not plot it yet. I have searched through the > tutorial online, but can't seem to find anyway to do it. Any help is > appreciated. Thanks. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---