On Jul 8, 1:14 am, Mike Hansen <[email protected]> wrote: > On Wed, Jul 7, 2010 at 1:49 PM, David Sanders <[email protected]> wrote: > > I now want to substitute eps=1, so I do > > > a.subs(eps = 1) > > > but the response is still 3*epsilon ! > > This is due to the way Python functions work. Basically, doing > > a.subs(eps=1) > > is the same as doing > > a.subs(**{'eps': 1}) > > When you use keyword arguments, the function gets the string 'eps' > rather than the var eps. So, it tries to look for a variable named > 'eps' which it doesn't find. When you pass in the dictionary > explicitly: > > a.subs({eps: 1}) > > the key is the actual variable object rather than a string so it knows > to do the right thing.
I see. Thanks for such a clear explanation! David. > > --Mike -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
