On Thu, Sep 18, 2008 at 4:54 PM, Alex Raichev <[EMAIL PROTECTED]> wrote: > > Now, with the above in mind, how do you write a function to evaluate > that sine limit given a variable from the user? We know the following > does not work. > > sage: var('x') > x > sage: def limmy(w): > ....: return limit(sin(w)/w,w=0) > sage: limmy(x) > sin(x)/x > > More generally, how do you execute functions requiring keyword > arguments, such as limit(), when you don't know the symbolic variable > names involved (but have references to them)?
Here's one way to do it: sage: def limmy(w): ....: return limit(sin(w)/w,**{str(w):0}) ....: sage: limmy(x) 1 sage: limmy(var('w')) 1 Not the most elegant, but it works. --Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---