Search code examples
maple

Need a Maple program,


I am New in Maple and have heard that, this maths software is powerful in symbolic calculation. S assume that we have a set of elements like

A:={a, aab, b, aba, abbb, abab...}

such that #A=20 and moreover, we know that some of these elements satisfy an equation, for example a^k=(ab)^2 for some positive integers k. I have written some loops including for and if and assuming A is a set of numbers, but I have exhausted. I see, I can’t arrange and link these functions together properly. May I ask someone hint me, how maple can help me find the values of k for example in a finite range [1..10] satisfying the relation above?


Solution

  • I this you could do something like this:

    restart:
    A:={a,b,1000*a+111*b,101*b+1010*a,110*a+b};
            A := {a, b, 110 a + b, 1000 a + 111 b, 101 b + 1010 a}
    
     for i from 1 to 9 do
        for j from 1 to 9 do
           As:=subs(a=i,b=j,A);
           for e in As do
               for ee in As do
                  if((ee<>e) and (e<=ee^2)) then
                     for k from 1 to 10 while (e^k<ee^2) do
                     od;
                     if(e^k=ee^2) then 
                        print(e,"^",k,"=",ee,"^2");
                     fi;
                  fi;
               od;
           od;
        od;
     od;
    

    Just fill in the elements of your set and let it calculate. You could go slightly faster if you sort your set first (so you have A=[1,6,16,61]) and calculate all squared numbers. Then loop over the entries but only looking at those that are bigger (but that might not be what you are looking for)