Just look where the inputs go/get saved. That will usually be enough. However, there might be some nasty magic involved because of the way we create mathematical objects in sympy (subclasses of Basic).
All subclasses of Basic have a "private" attribute _args, that is used when comparing objects, creating objects or calculating hashes of objects. All arguments to the constructor get saved there. Also, the following is always true (unless there is a bug) for instances of subclasses of Basic: type(instance)(*instance.args) == instance It helps to easily recreate expressions. On 3 March 2013 21:29, Bi Ge <[email protected]> wrote: > OK after some reading let's see if my understanding is correct. Python > variables are actually "identifiers" that sort of > point to objects. In my example, i and j bind with the 2 inputs (symbol or > integer) of KroneckerDelta. Even though > I reassign i and j to different values, the actual inputs stay unchanged. Is > this correct? If so, how should I change them? > > Bi Ge > > > On Sunday, March 3, 2013 1:23:44 PM UTC-5, Stefan Krastanov wrote: >> >> I do not think that the problem here is with your understanding of >> sympy but rather with the way that pythonic variables work. >> >> for instance: >> >> L = [1,2] >> a = L[0] # 'a' points to the object int(1) >> a = 5 # 'L' does not change but 'a' points to the object int(5) >> >> I used the verb "points" but it would be wrong to say that python >> variables are pointers. Checkout python's docs and search >> stackoverflow for questions on this subject. >> >> >> PS >> And be aware that >> >> L[i] = var >> >> is a syntactic sugar for a method call, something quite different from >> >> a = var >> >> On 3 March 2013 04:52, Bi Ge <[email protected]> wrote: >> > Hi Sympy community, >> > >> > I've been looking at issue3479 and trying to fix it by using minlex. >> > Right now I just put the following at the end of def eval(cls, i, j): >> > sort_args = minlex( ( i , j ) ) >> > i = sort_args[0] >> > j = sort_args[1] >> > >> > However, it still gives me the unchanged result such as: >> >>>>KroneckerDelta(n, m) >> > KroneckerDelta(n, m) >> > >> >>>>KroneckerDelta(m, n) >> > KroneckerDelta(m, n) >> > >> > I guess I still don't fully understand how symbols work in this >> > function. >> > Any help will be appreciated. >> > >> > Regards, >> > >> > Bi Ge >> > >> > -- >> > 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?hl=en. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
