I think this is an instance of this bug https://github.com/sympy/sympy/issues/9791.
Aaron Meurer On Mon, Jun 8, 2015 at 10:36 AM, TIANJIAO SUN <[email protected]> wrote: > Hi, > For expressive reasons, in some applications I name my symbols as > IndexedBased, but really I want to consider U[x,y] and U[x,y-1] etc to be > unrelated. > I got equations of relations between bunch of such symbols, and I want to > express some of them with the others, but somehow solve() doesn't work for > simultaneous equations. > In this example: > > U = IndexedBase('U') > x,y = symbols('x y') > eq1 = Eq(U[x,y]+5*U[x,y-1]-2,0) > eq2 = Eq(-4*U[x,y-1]+5*U[x-1,y],0) > > solve(eq1,U[x,y]) # this works and give -5*U[x,y-1]+2 as expected > solve([eq1,eq2],U[x,y]) # but this gives errors > > tracing down the errors message and it seems to related to testing if the > equations are constant > > /home/anaconda/lib/python2.7/site-packages/sympy/solvers/solvers.pyc in > solve(f, *symbols, **flags) > 844 ok = True > 845 else: > --> 846 if fi.is_constant(): > 847 ok = True > 848 if ok: > > > And I tried swapping symbols with Idx which gives same result. > > I figure it's probably due to sympy trying to remove equations from the list > that are constant. But I don't have a good explanation as to 1) why Indexed > symbols are different and 2) why it works in the previous case? > > Thanks, > -TS > > -- > 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 http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/ff10d4df-dbf9-427a-a61f-7efeb8031a24%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BcAwAELsmSLBLnPvEJPqA6ZAyzmkefewxA%3Dxh%2Bv3OPWg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
