Burcin Erocal wrote:
In order to use ginac as the symbolics backend in Sage [1], we also had to work around this random printing problem.
May I ask why stable printing is a requirement for use in Sage?
In retrospect, this was not the right way to fix the printing problem. I should have done as the ginac developers suggested when I first asked about this [2]. Unfortunately, I didn't know much about the design of the ginac library then, and I wanted to get things done quickly.
[2] http://www.ginac.de/pipermail/ginac-list/2008-August/001406.html
When I find the time, I plan to move the new comparison functions out of the way and bring back the old ones to make things fast again. Then, add some code in expairseq to sort its arguments with the new comparison functions before printing, and cache the sorted sequence somewhere. I don't expect to have the time to do this in the near future however.
I hope some of this will be useful if you try to stabilize printing order in ginac.
It won't be difficult to sort terms lexicographically, when printing, as opposed to based on hash values. But I doubt that caching the sorted sequence will be of practical use. Cheers -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>