[sage-devel] Re: Enhancing the SymbolicEquation class

2007-11-05 Thread Robert Bradshaw
On Nov 5, 2007, at 2:53 PM, Ted Kosan wrote: > Robert wrote: > >> How about >> >> eqn.expand() # does it to both sides >> eqn.expand('right') # does it to the right >> eqn.expand('left') # does it to the right >> >> Basically, every function valid on a symbolic expression would be >> valid on a s

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-11-05 Thread Ted Kosan
Robert wrote: > How about > > eqn.expand() # does it to both sides > eqn.expand('right') # does it to the right > eqn.expand('left') # does it to the right > > Basically, every function valid on a symbolic expression would be > valid on a symbolic equation, and take an extra (optional) parameter

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-18 Thread William Stein
On 10/18/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > I have been experimenting with making a subclass of SymbolicEquation > called MutableSymbolicEquation but I like this approach better because > it is simpler. OK. By the way, subclassing SymbolicEquation by MutableSymbolicEquation would be bad b

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-18 Thread Ted Kosan
William wrote: > On 10/17/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > How about replace_right instead of change_right. > > > > How about > > > > eqn.expand() # does it to both sides > > eqn.expand('right') # does it to the right > > eqn.expand('left') # does it to the right > > > > Basica

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread William Stein
On 10/17/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > How about replace_right instead of change_right. > > How about > > eqn.expand() # does it to both sides > eqn.expand('right') # does it to the right > eqn.expand('left') # does it to the right > > Basically, every function valid on a symbo

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Robert Bradshaw
On Oct 17, 2007, at 6:54 PM, David Harvey wrote: > On Oct 17, 2007, at 9:50 PM, William Stein wrote: > >> >> On 10/17/07, Mike Hansen <[EMAIL PROTECTED]> wrote: >>> Bobby and I don't really like sage: a.rhs.expand() since it's a hackish abuse of notation and it is confusing to

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread David Harvey
On Oct 17, 2007, at 9:50 PM, William Stein wrote: > > On 10/17/07, Mike Hansen <[EMAIL PROTECTED]> wrote: >> >>> Bobby and I don't really like >>>sage: a.rhs.expand() >>> since it's a hackish abuse of notation and it is confusing to read. >>> It's clever though (which is not good). >> >> I

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread William Stein
On 10/17/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > > > Bobby and I don't really like > >sage: a.rhs.expand() > > since it's a hackish abuse of notation and it is confusing to read. > > It's clever though (which is not good). > > I agree with that sentiment. On the other hand, I think > >

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Mike Hansen
> Bobby and I don't really like >sage: a.rhs.expand() > since it's a hackish abuse of notation and it is confusing to read. > It's clever though (which is not good). I agree with that sentiment. On the other hand, I think sage: c = b.change_right(b.right().expand()) is a bit cumbersome.

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Ted Kosan
William wrote: > So you like the suggestion to do > b.change_right(...) > and > b.change_left(...) > each of which returns a new equation? Lets see: c = b.change_right(b.right().expand()) This looks like it will work :-) Thanks, Ted --~--~-~--~~~---~--~

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread William Stein
On 10/17/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > So if simple attribute access is okay to do in Python, why are _right > and _left private? Equations are immutable, so you should *not* be changing the internal state of equations. Actually _left and _right aren't private, they are just "you

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Ted Kosan
William wrote: > SymbolicEquations are immutable, i.e., if you want to do something > to change an equation you should get back a new equation object. > The _left and _right are "private"-ish, because you are *not* supposed to > change them. For example, when you do: > >b._right = b._right.e

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Mike Hansen
How about having instance variables lhs and rhs which are thin wrappers around _left and _right which return new SymbolicEquations. That way you can do things like this: sage: a = (16*x - 13)/6 == (3*x + 5)/2 - (4 - x)/3 sage: a *= 6 sage: a.rhs.expand() 16*x - 13 == 11*x + 7 I would also want t

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread William Stein
On 10/17/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > It also shows how I am wanting to use expand() with a SymbolicEquation > object. This approach seems to work fairly well except for the fact > that SymbolicEquation's _left and _right instance variables are > private. If these variables were p

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-17 Thread Ted Kosan
Willam wrote: > I like all of your suggestions above. Could you please give an example > fake Sage session in which you illustrate use of each of the commands > you wish Sage had? Implementing the functionality should then be > easy for me, Bobby, or Mike Hansen (or you). But it would be good

[sage-devel] Re: Enhancing the SymbolicEquation class

2007-10-16 Thread William Stein
On 10/16/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > > I am currently adding a section on solving problems to the "SAGE > Programming For Newbies" book and I would like to propose some > enhancements to the SymbolicEquation class. > > The approach I am taking with the problem solving examples is to