On Mon, 25 Aug 2008 16:50:43 -0700 (PDT) Jason Merrill <[EMAIL PROTECTED]> wrote:
> > On Aug 25, 12:50 pm, "William Stein" <[EMAIL PROTECTED]> wrote: <snip> > > > > Burcin -- I did actually mostly implement pattern matching in Pynac. > > Some examples: <snip examples> > > sage: (sin(x)^2 + cos(x)^2).subs(sin(w0)^2+cos(w0)^2==1) > > 1 > > sage: (1 + sin(x)^2 + cos(x)^2).subs(sin(w0)^2+cos(w0)^2==1) > > sin(x)^2 + cos(x)^2 + 1 > > sage: (17*x + sin(x)^2 + cos(x)^2).subs(w1 + > > sin(w0)^2+cos(w0)^2 == w1 + 1) > > 17*x + 1 > > sage: ((x-1)*(sin(x)^2 + cos(x)^2)^2).subs(sin(w0)^2+cos(w0)^2 > > == 1) > > x - 1 > > Awesome. Thanks for making all this happen. I'm really excited about > where Sage is going. I've only been watching for a couple weeks now, > but I think I chose a fun time to find out about it. > > Is the syntax for this stuff set in stone? I'm not sure I like the > equality inside the subs call. Equality is reflexive, but > substitution is a one way operation. What about a dictionary, sage: (a > +2*b).subs({a+b:x}), or even just a single equal sign, like keyword > args, sage: (a+2*b).subs(a+b=x). The double equals would work too, > but now is probably a better time for discussion than later. I am also in favor of the dictionary and/or keyword arguments (which are equivalent from the programming pov). This is also the current interface for other subs functions in Sage. I realized that William had already wrapped these functions right after I wrote the message saying I'll get to it soon. Though when I tried using them, I expected them to work with keyword arguments, and had to look in the docs. I suggest we change this back to be consistent with the already existing objects in Sage. Comments? Burcin --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---