On Sun, 03 Dec 2006 10:38:20 -0800, Joel B. Mohler <[EMAIL PROTECTED]> wrote:
> > I have a couple of cases that I think scratch around at the boundaries > of the > current design with regards to simple calculus. I think they uncover > some > oddities in the current design, but I'm not entirely sure what they mean. > The results acheived are far from what a novice might expect and IMO > rather > bizarre even to the expert. > > ********* Exhibit 1: (Is x==y? Shouldn't this be a syntax error?) > sage: x.parent() > Univariate Polynomial Ring in x over Rational Field > sage: P,y=ZZ['y'].objgen() > sage: f=cos(x)*sin(y) > sage: f(1) > (cos(1)*sin(1)) > ********************* Yes, this should be a syntax error. > ********* Exhibit 2: (What in the world does sin(x)(1) mean?) > sage: P,(x,y)=ZZ['x,y'].objgens() > sage: f=sin(x) > sage: f(1) > sin(x)(1) > sage: float(f(1)) > # disaster strikes > ********************* Yes, this is wrong. But it's just a NotImplementedError, i.e., the __call__ method of sin doesn't do anything with multivariate polynomials, so it just forms the formal evaluation sin(x), which it doesn't know what to do with. > ********* Exhibit 3: (Shouldn't this be a type error?) > sage: P,x=IntegerModRing(17)['x'].objgen() > sage: f=sin(x) > sage: f(18) > sin(1) > ********************* Yes, it should be a type error. > Perhaps the most important is "Exhibit 2". To my eyes, a function > definition > is not complete with-out a clearly defined argument list. Piggybacking > on > top of argument lists to polynomial rings seems like it will lead to > endless > pains of the nature of the creatures above. This is simply how symbolic mathematics, in particular calculus, works. It does lead to pain and confusion in many calculus classes. I don't think dealing with this will be easy. But I think it's absolutely crucial in order for SAGE to ever be a viable alternative to Maple/Mathematica. All your examples above are very good, and will help inform the design that we come up with. Thanks! Keep 'em coming! (Could somebody please post something based on all this into the wiki -- I suddenly only have limited net access for the next few days). William --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---