Thanks. Although I was looking for a built-in one-word switch or function, I am happy that I or whoever wants to implement this in maxima or sage now can go here and find several approaches to the implementation. ?Best regards,?