smht

44 Reputation

3 Badges

20 years, 21 days

MaplePrimes Activity


These are answers submitted by smht

Dear Joe,

you are right, the command seq(1..3) does not work under Maple 9.
As you have outlined already, your code can be easily altered to get it run
under Maple 9, too:

    if L :: 'posint' then
#        return procname([seq(1..L)]);
        return procname([seq(u,u=1..L)]);
    elif L :: 'range(integer)' then
#        return procname([seq(L)]);
        return procname([seq(u,u=L)]);
    end if;


Example for 'posint':

P := GeneratePermutations(3):
> while not P:-finished() do P:-nextvalue(); end do;
                              [1, 2, 3]


                              [1, 3, 2]


                              [2, 1, 3]


                              [2, 3, 1]


                              [3, 1, 2]


                              [3, 2, 1]


Example for ' range(integer)'

P := GeneratePermutations(1..3):
> while not P:-finished() do P:-nextvalue(); end do;
                              [1, 2, 3]


                              [1, 3, 2]


                              [2, 1, 3]


                              [2, 3, 1]


                              [3, 1, 2]


                              [3, 2, 1]

 

Dear Joe, thank you for your answer! Your code works fine! All the best! Thomas
Page 1 of 1