Ah, ok.  I am probably not the right person to weigh in on what
symbolics should do.  I'll be happy if I can do most of what I could
do in mathematica - since I used it for 16 years, it defines what I
expect, but of course it won't always be the right design to follow
for Sage.

-M. Hampton

On May 9, 10:37 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Fri, May 9, 2008 at 9:28 AM, Marshall Hampton <[EMAIL PROTECTED]> wrote:
>
> > I'm not sure I agree that this is a bug.  After using the name "var"
> > in the loop, the value of var is y.  y is a symbolic variable, and
> > when evaluated at the string "x,y" it returns "x,y"; this seems like
> > desirable behavior (to have string-valued functions seems OK to me).
>
> > Or another way to put it: if the above behavior is a bug, then I think
> > the following would be as well:
> > sage: x,y = var("x,y")
> > sage: y(2)
> > 2
>
> > Or perhaps I am missing something.
> > -M. Hampton
>
> There is an issue with the design, though it is arguable what it is.
> Notice that var('x') acts as the identity function irregardless of the input,
> where as var('x')^2 coerces its input to the SymbolicRing.
>
> sage: x = var('x')
> sage: x('hello world')
> 'hello world'
> sage: type(x('hello world'))
> <type 'str'>
> sage: (x^2)('hello world')
> hello^2*world^2
> sage: type((x^2)('hello world'))
> <class 'sage.calculus.calculus.SymbolicArithmetic'>
> sage: x,y=var("x,y")
>
> I thus think the right fix would be for var('x') to also coerce its input
> to the symbolic ring.  So, in the original question var('x,y') would
> give an error since:
>
>  sage: SR('x,y')
> Traceback (most recent call last):
> ...
> TypeError: Malformed expression: x, !!! y
>
> By the way, what's up with the !!! in the error message?  That looks
> very weird.
>
> What do you think.
>
>  -- william
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to