Comment #2 on issue 2006 by asmeurer: functor objects
http://code.google.com/p/sympy/issues/detail?id=2006

I would expect this to also replace sin(2*x)**2 + cos(3*x)**2.

No, because that doesn't equal (sin**2 + cos**2)(x) for any x, exactly or inexactly (and of course we only consider exactly here). By the way, I just notice that my first expression has a typo; it should be sin(x)**2 + cos(x)**2.

Shouldn't it be…

I'm not entirely sure what you are saying here. If you are saying that we should use 1 for id, then definitely no. I hate this very confusing abuse of notation, because it is never clear whether something like (sin + 1)(x) means sin(x) + x or sin(x) + 1.

Or are you just being confused by what I meant by id(1). Maybe it would be clearer to use id[1] instead (actually, it should really be id[0]). id[n - 1] just returns the nth argument passed to it.

The reason is that id(x) => x doesn't generalize to multiple arguments, which we want to allow because of multi-argument functions (i.e., what does id(x, y) return). So we make it clearer by having id[n - 1] return an object that returns the nth argument.

By the way, I just noticed that id() is a built-in function, so we would have to call it something else (Id maybe, or just identity/Identity).

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

Reply via email to