pong wrote: > Here is my script > > def shaded_area_plot(f,g,c,d,a,b): > step = 0.01
from sage.ext.fast_eval import fast_float f = fast_float(f) g = fast_float(g) > vf = [(x,f(x)) for x in srange(a, (b+step), step)] > vg = [(x,g(x)) for x in srange(b, (a-step), -step)] > sha = polygon(vf + vg, rgbcolor='grey') > return(plot(f, (c,d)) + plot(g, (c,d), rgbcolor='red') + sha) > > Most likely that's not well-written but I hope that's at least clear. > > for example, then shaded_area_plot(sin(x), lambda x:0, 0, pi, 1, 2) > give me the shaded area between the sine curve and the x-axis over > [0,pi] > > I hope there is a better solution to my problem. > put those three lines in where indicated and it will be orders of magnitude faster for most cases, plus will handle constants, lambda functions, etc., automatically. fast_float is one of Sage's coolest "secrets". Thanks, 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 -~----------~----~----~----~------~----~------~--~---