On the other hand, I have tried again on the isympy console,
where .subs() works for (e*f*e*f) but not for (e*e*f);
In [15]: (e*e*f).subs(e*f,f*e+h)
Out[15]:
2
e *f
In [16]: (e*f*e*f).subs(e*f,f*e+h)
Out[16]:
2
(h + f*e)
Is it true that isympy console uses another piece of code?
I have placed a "print" marker in Mul._eval_subs() and isympy
just ignored it.
Thank you.
K.
2009/3/30 Alan Bromborsky <[email protected]>:
>
> Yau Kwan Kiu wrote:
>> Hello.
>> I want to write a function for reducing an
>> expression for an element x \in sl2 into a sum in the
>> Poincare Birkhoff Witt basis , that is,
>>
>> e,f,h=symbols('efh',commutative=False)
>>
>> e*f |---> f*e+h
>>
>> I tried to use subs naively and it wouldn't work:
>>
>>
>>>>> e,f,h=symbols('efh',commutative=False)
>>>>>
>>
>>
>>>>> (e*f).subs(e*f,f*e+h)
>>>>>
>> h + f*e
>>
>>>>> (e*f*e*f).subs(e*f,f*e+h)
>>>>>
>> e*f*e*f
>>
>> I tried to check the help(Symbol) and I couldn't find anything useful.
>> I would like to know if there is a good way to do it.
>>
>> Thank you very much.
>>
>> K.
>>
>> >
>>
>>
> If you have a beta or git distribution of sympy you should compile the
> documentation (python-sphinx and dvipng are required) and look at the
> section on geometric algebra since geometric algebra is just a clifford
> algebra over the reals (complex could be included by doubling the
> dimension) and is intimately related to the special linear group. The
> basic reduction formula for the geometric product is "a*b = 2(a.b)-b*a".
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" 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?hl=en
-~----------~----~----~----~------~----~------~--~---