with the closing paren!
sp.Eq(*[-1**i*a for i, a in enumerate(reversed((ht * _lhs - ht *
_rhs).expand().as_independent(rho1, as_Add=True)))])
On Monday, May 8, 2017 at 12:02:35 PM UTC-5, Chris Smith wrote:
> Not that I can think of. Good catch on the minus sign. And use the
> `as_Add` flag unless you are positive that the expression you are working
> with is always an Add. Does this work:
>
> sp.Eq(*[-1**i*a for i, a in enumerate(reversed((ht * _lhs - ht *
> _rhs).expand().as_independent(rho1, as_Add=True)))]
>
> On Saturday, May 6, 2017 at 3:24:24 PM UTC-5, Jonathan Essen wrote:
>
>> 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/8bee8fd6-cce7-43a2-b16d-776e93c2c69d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.