Thank you for the reply, but I noticed that the new right hand side is off
by an overall minus sign! I fixed it using:
tmp = (ht * _lhs - ht * _rhs).expand().as_independent(rho1)
sp.Eq(tmp[1], rhs=-tmp[0])
Is there was a cleaner way to do this?
On Thursday, May 4, 2017 at 8:21:44 AM UTC-7, Chris Smith wrote:
>
> Given Eq(L, R) where L and R are the left and right hand sides of the
> equation, try: `Eq(*list(reversed((L - R).expand().as_indepedent(foo,
> as_Add=True))))` where foo is the variable of interest to get the new
> equation.
>
> On Tuesday, April 25, 2017 at 2:35:10 PM UTC-5, Jonathan Essen wrote:
>>
>> I am attempting to use sympy to generate an implicit scheme for the heat
>> equation. With the Crank-Nicolson time discretization I have equation 1
>> (attached).
>>
>> Is there any way to isolate all occurrences of $\rho^{n+1}$ (along with
>> its derivatves) to the lefthand side, as in equation 2 (attached).
>>
>> I would be very interested to know! Apparently it has something to do
>> with the collect function.
>>
>> Best,
>> Jonathan
>>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/c0fe2fc1-8140-42f2-b0eb-4f77796eac8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.