Would it be better to add a method="recursive" option to the current subs method?
To answer your question though, I think the procedure to add anything to Sage is to create a patch and submit it to trac. See the Programming guide for some hints. On Fri, Oct 17, 2008 at 3:23 AM, Stan Schymanski <[EMAIL PROTECTED]> wrote: > > I wrote a function to do the above (subsg(variable), see below), but I > would like to use it as a method notation (e.g. variable.subsg()). > Could anyone tell me how to do this? > > Thanks a lot! > > Stan > > Here is the function: > > def subsg(variable): > """ > Substitutes all definitions in the global name space for the > variables contained in 'variable' and returns the result. > INPUT: > variable -- a symbolic variable > EXAMPLE: > sage: var ('a b c') > a b c > sage: f = a*x > sage: a = 2*b > sage: b = c^2 > sage: subsg(f) > 2*c^2*x > > """ > expr1 = variable > expr2 = variable.subs(globals()) > while expr1 <> expr2: > expr1 = expr2 > expr2 = expr1.subs(globals()) > return expr1 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---