Hi,

These two commands fail to give the same outputs.

> sage: f = x-x+y;  f, f(1)
> (y,1)
> sage: f = x+y-x;  f, f(1)
> (y,y)

Here's another example.

> sage: f = x-x+y-x;  f, f(1,0)
> (y - x, -1)
> sage: f = x+y-x-x;  f, f(1,0)
> (y - x, y - 1)

The bug stems from sage.calculus.SymbolicArithmetic.__call__().
The problem is that f.variables() relies on the simplified expression,
while f.__call__() uses the pre-simplified expression.

> try:
>     op_vars = op.variables()
>     if len(op_vars) == 0:
>         if len(args) != 0:
>             new_ops.append( op(args[0]) )
>         else:
>             new_ops.append( op )
>         continue
>     else:
>         indices = filter(lambda i: i < len(args), map(variables.index, 
> op_vars))
>         if len(indices) == 0:
>             new_ops.append( op )
>         else:
>             new_ops.append( op(*[args[i] for i in indices]) )
> except ValueError:
>     new_ops.append( op )

Paisa

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to