531 Reputation

18 years, 322 days

Tracking Matrix changes in a procedure...

Maple

I have written a procedure in which I create a matrix and then manipulate (change) the matrix until certain conditions are met (a while loop).  I would like to know when an iteration of my loop does not make any changes to my matrix (but the stopping conditions are not yet met) so that I do not enter into an infinite loop.

ISO Faster method of generating specific...

Maple

Situation:  I have multiple lists of the form [i\$i=1..n,0\$k] , where n is a positive integer and k is a nonegative integer.

Desired result:  For each list, produce a list of permutations of the list (as you would receive from combinat[permute]) such that in each permutation, the nonnegative integers in the list appear in ascending order from left to right and no two nonnegative integers are adjacent to one another.

Summing lists of lists of numbers...

Maple
I have a list of lists. The number of lists I have is unknown (though always a positive integer) and the number of elements in each list is unknown (though, again, always a positive integer). Some examples: [[2],[3]]; [[4],[4],[5,1]]; [[3,4,1],[2],[2],[6,7]]; I'd like to form a list of all possible sums formed from one element of each list. The lists of sums from the examples above would be [6]; [13,9]; [13,14,11,14,15,12]; The order doesn't matter, and repeated elements don't matter. I can form these lists when I can control the number of lists in the large list and write an explicit nest of for loops. I figure there's got to be a more elegant and powerful way of producing these sums.

Seeking Optimization...

Maple
I've got two procedures set up that work, but I know there have to be better ways to accomplish the same goals. First, I've got a procedure that finds to how many digits two floats (`a` and `b`) agree. I had tried a few methods of examining the `SFloatMantissa` and `SFloatExponent` of the difference, but those methods would fail in unpredictable ways. My current method explodes the floats into lists and compares every entry in a `for` loop. The example below is basically the heart of my procedure (I do take into consideration things like the location of the decimal and trailing zeros):