Kitonum

20464 Reputation

26 Badges

16 years, 65 days

MaplePrimes Activity


These are questions asked by Kitonum

When generating the list of all the permutations of  [$1..10]  we get an error:

combinat[permute]([$ 1 .. 10]);

    Error, (in combinat:-permute) Maple was unable to allocate enough memory to complete this computation. Please see ?alloc

 

But if the same problem to solve using a simple custom procedure, there is no any problems:

restart;

Permute := proc (L::list)

local n;

n := nops(L);

if nops(L) = 1 then return [L[1 .. 1]] else

[seq(seq([op(p[1 .. k-1]), L[1], p[k .. n-1][]], k = 1 .. n), p = Permute(L[2 .. n]))] end if;

end proc:

L := CodeTools[Usage](Permute([$ 1 .. 10])):

nops(L);

        

 

 

In Maple 2015.1 we have

restart;

solve([sin(2*x)/cos(x+3*Pi/2)=1,  x>-4*Pi, x<-5*Pi/2], x, allsolutions, explicit);

solve([sin(2*x)/cos(x+3*Pi/2)=1, x>0, x<2*Pi], x, allsolutions, explicit);

 

 

In the first example, the error message is not clear (actually there exists a unique root  x=-11*Pi/3), in the second example, one root  (x=5*Pi/3) is lost.

 

Is there in Maple a command to verify that one segment on the real axis is a subset of another segment?  For example  RealRange(2, 4)  is subset of  RealRange(2, 5)

Of course easy to write a procedure that makes it:

Subset:=proc(r1::RealRange, r2::RealRange)

local a, b, c, d;

a, c:= op~(1,[r1, r2])[];

b, d:= op~(2,[r1, r2])[];

if a>=c and b<=d then true else false fi;

end proc:

 

Example of use:

Subset(RealRange(2,4), RealRange(2,5));

Subset(RealRange(2,5), RealRange(2,4));

                            true

                            false

 

Maple does not cope with the following simple example:

with(geom3d):

point(A,0,0,0), point(B,1,0,0), point(C,2,0,0), point(E,2,1,0):

AreCoplanar(A,B,C,E);

           Error, (in geom3d:-plane) the points may not be AreCollinear

 

Should we interpret this behavior as a bug? I think I met with this yet 10-12 years ago, but unfortunately since then nothing has changed.

When solving a simple assignment problem in Maple 2015.1 the bug occurs:

 

In Maple 2012 there are no problems:

A := Matrix([[1, 7, 1, 3], [1, 6, 4, 6], [17, 1, 5, 1], [1, 6, 10, 4]]):

n:=4:

z:=add(add(A[i,j]*x[i,j], j=1..n), i=1..n):

restr:={seq(add(x[i,j], i=1..n)=1, j=1..n),seq(add(x[i,j], j=1..n)=1, i=1..n)};

sol:=Optimization[LPSolve](z, restr, assume=binary); 

 

 

2 3 4 5 6 7 8 Page 4 of 9