Hi.

This sounds like a good suggestion. Based on the name,
_remove_repeated, does remove duplicates, but this can done without
removing the ordering.

Aaron Meurer

On Mon, Jun 4, 2018 at 4:20 AM, Andrew D. Hanlon <ddhan...@gmail.com> wrote:
> Hello Everyone,
>
> I've been using sympy in my research for several months now, and it has been
> really great! I have a suggestion for a possible improvement. I have been
> making extensive use of the tensor modules, and I deal with indices quite
> frequently.
>
> My issue lies in the function 'get_indices' defined in the
> tensor.index_methods module. This function returns all of the free indices
> (i.e. non-repeated indices in an expression). But, every time this function
> gets called, the order in which the indices are returned is random. I would
> find it quite useful if the indices were returned in the same order that
> they appear in the expression passed to 'get_indices', or at the very least
> in a determined order.
>
> The random order can be traced to the function '_remove_repeated' (also
> defined in the tensor.index_methods module). In the line right before the
> return of that function, the list 'inds' contains all the free indices in
> the same order that they appeared in the expression passed to 'get_indices'.
> Then, when the function returns it creates a set from this list which
> destroys the ordering. I would suggest that the '_remove_repeated' function
> does not convert 'inds' to a set.
>
> My guess for why this was converted to a set in the first place was to
> ensure the uniqueness of the elements in 'inds'. However, it seems that the
> elements in 'inds' are already unique. But, even if they were not, there are
> probably some other ways to ensure this that don't spoil the ordering.
>
> What do others think of my suggestion?
>
> Thank you,
> --Andrew Hanlon
>
> --
> 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 sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> 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/CACO9nak03Qo%2BVTXV2x%3D%3DbcJHtPe_hwz2NtvWDYknZO4d7uAr8Q%40mail.gmail.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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
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/CAKgW%3D6KWr5%2BBOkho6nenTZAusi8jCxnqJV%2Bm_ukZxRRLSAR_1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to