Comment #1 on issue 1474 by ondrej.certik: Subs broken on sub classes of  
Symbol using sympy 0.6.4 on linux
http://code.google.com/p/sympy/issues/detail?id=1474

It's because use use .subs('B', 'X'), what happens is that sympify() gets  
called and
sympify doesn't know about your Mysymbol, so sympify('B') is just  
Symbol('B'), which
is different to your Mysymbol(). To do what you want, just use .subs(B, X),  
where B
and X are instances of the correct Symbols. Like in the session below:


In [1]: import sympy

In [2]: class Mysymbol(sympy.Symbol):
    ...:     pass
    ...:

In [3]: (sympy.Symbol('A')*sympy.Symbol('B')).subs('B','X')
Out[3]: A*X

In [4]: (sympy.Symbol('A')*Mysymbol('B')).subs('B','X')
Out[4]: A*B

In [5]: (sympy.Symbol('A')*Mysymbol('B')).subs(Mysymbol('B'),'X')
Out[5]: A*X


As to the order of things, it is done by the Printer and since  
multiplication is
commutative, it doesn't matter (you can write your own printer to print  
things in the
way you like, I can help with that too if this is what you want). Or you  
can use
noncommutative symbols if this is what you need.

Let me know if there is any other problem, or if we can close this issue.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to