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)? Alex On Sep 19, 9:22 am, Alex Raichev <[EMAIL PROTECTED]> wrote: > Thanks for clarifying that issue, Mike. > > Alex > > On Sep 18, 3:38 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote: > > > Hi Alex, > > > > sage: limit(sin(y[0])/y[0],y[0]=0) > > > ------------------------------------------------------------ > > > File "<ipython console>", line 1 > > > SyntaxError: keyword can't be an expression (<ipython console>, line > > > 1) > > > > sage: w=x > > > sage: limit(sin(w)/w,x=0) > > > 1 > > > sage: limit(sin(w)/w,w=0) > > > sin(x)/x > > > This is because keyword arguments are treated as strings in Python so > > what you aren't passing in is a variable or expression, but a string. > > For example, > > > sage: y = [x] > > sage: w = x > > sage: def f(*args, **kwds): > > ....: return kwds > > ....: > > sage: f(y=2) > > {'y': 2} > > sage: f(w=y) > > {'w': [x]} > > > --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 -~----------~----~----~----~------~----~------~--~---