0

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?

Mikasa
  • 109
  • 1
  • 1
  • 5
  • 1
    What exactly is in your set A? How do you interpret the a and b? is it like {1,112,2,121,...} or just random entries like {2,5,65,...}? – Origin Nov 21 '12 at 22:34
  • @Origin: It is like the first set. In fact we assume that a and b doesn't merge and so, we can have some new elements( but finite) like ab, ababab, ....Thanks for your time. – Mikasa Nov 22 '12 at 02:20
  • oke, so you have some variables a and b, which act as digits for the elements in your set A. How do the equations interact with the set? You say some of the elements satisfy the equation a^k=(ab)^2 but how does that relate to the set? Do you mean the equation (element in A)^k = (ab)^2 or (element in A)^k=(other element in A)^2? And what did you mean by "a and b don't merge"? – Origin Nov 22 '12 at 07:59
  • @Origin: I rally meant the second form "(element in A)^k=(other element in A)^2". I meant a and b are symbolically attached to each other, like when we write xx. xx is just including two x close to each other, however; when we write xx, we always find x^2. Let 23 be just an independent number, we don't want when we write 23, one gets 2*3=6. – Mikasa Nov 22 '12 at 08:10

1 Answers1

1

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)

Origin
  • 2,009
  • 5
  • 19
  • 19