Hello again,

bastian.weber wrote:
> Hello,
> 
> 
> currently I have this behavior:
> 
> 
> In <69>: (d**3).subs(d**2,k)
> Out<69>: k**(3/2)
> 
> 
> Is it somehow possible to get
> 
> In <69>: (d**3).subs(d**2,k)
> Out<69>: d*k
> 
> instead?

SNIP

> 
> Maybe subs is the wrong way to achieve this, but at the moment I dont
> see any other.

I just got the idea to use polynomial division to get the quotient q and
the remainder r. Then I could multiply the quotient q by k (which I want
to insert instead of d**2) from the right and then add the remainder r
to get my desired result.

But unfortunately div does not support non-commutative symbols:

div(d**3, d**2, d)

gives:

SymbolsError: Non-commutative symbols: (d,)



The expression which I want to handle reads:

In <11>: m, d = symbols('m d', commutative = False)
In <12>: a = 1 - 4*d**2 + 4*m**2 + d**4 + m**4 - 4*m*d - 2*m**2*d**2
In <13>: div(a, d**2, d)

of course, I get the SymbolsError too in that case.


Any ideas for a workaround or an elegant solution would be very welcome.


(The background is: m and d are operators. m means multiply by argument
and d means take the derivative. So I have some rules like d*m = 1 +
m*d. At the end these compound operators are applied to gaussian-like
functions, so I have another rule: d = -m and therefore d**2 = d*d =
d*(-m) = -(1 + m*d) = -1 + m**2. Higher powers of d could than be
reduced to that case.)

Regards,
Bastian.

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

Reply via email to