On Apr 17, 6:03 am, kcrisman <[EMAIL PROTECTED]> wrote: > However, what I really want is to be able to do this dynamically and > to have the output be an "ordered set". Maybe an example would be > that I might want to list different orders of operations, so that > object A="exponentiation>multiplication>addition" would be my normal > list, but then I could have another ordering be the (wrong but > potentially fun) B="addition>multiplication>exponentiation", and that > if I wanted to then put in subtraction in B, I could infix it to be > B="addition>multiplication=subtraction>exponentiation" for a LOT of > fun. > > I was thinking now that maybe just a list (which has an implicit > ordering and lots of functions on it) would work, but I don't know > that it would allow "=" between elements very easily.
For tiny sets, you could use graphs. For your final example, start with a graph with edges "addition->multiplication", "multiplication- >subtraction", "subtraction->multiplication", and "subtraction- >exponentiation". Then compute the transitive closure of the graph. To test whether A>B, A=B, A<B, or A and B are incomparable, just check whether there are edges A->B and B->A in the graph. Unfortunately the current implementation of transitive closure looks pretty slow, so this will currently only work for tiny sets. Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---