Updates:
Status: Accepted
Comment #3 on issue 1927 by asmeurer: Basic.__call__ is confusing and
inconsistent
http://code.google.com/p/sympy/issues/detail?id=1927
Actually, I think this subs-call syntax should be eliminated completely for
a different reason.
After we fix issue 1688 (correct Ronan?), we can implement what is
suggested at the top of the core/functions.py docstring. We can create more
complex uncalled functions, like sin + cos, and then (sin + cos)(x) will
return sin(x) + cos(x). This has several uses. For example, you could do
expr.subs(sin**2 + cos**2, 1), and it will replace all sin**2 + cos**2,
whether it is sin(x)**2 + cos(x**2) or sin(2*x)**2 + cos(2*x)**2, with 1.
But you need to be able to do it to any expression, so that you can have
(sin + y)(x) return sin(x) + y. Therefore, Expr.__call__ will have to be
delegated entirely to this.
I think we would need to create a simple id function that works like (sin +
id)(x) == sin(x) + x. And could this be extend to multi-argument functions
in a reasonable way? I think so, as long as every unevaluated functor can
accept as many arguments as you pass it, though then id would really have
to be something like (f + id(1))(x, y) == f(x, y) + x.
Do people like this idea? Should there be a new issue for this, is there
already one, or should it just be this one?
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.