225 Reputation

6 Badges

3 years, 324 days

MaplePrimes Activity

These are replies submitted by emendes

@Carl Love Many many thanks.   You were right. For larger tuples the difference in time improvement is unbelievable.  Pushing my luck,  can your solution be adapted to use Iterator?   combinat:-choose will be a problem for 9-tuples ... 20-tuples. 

I thought I had understood what I did but it seems that I didn't.  First element of newabc is {alpha[1, 0], alpha[1, 1], alpha[1, 3]} which is the result of conds(abc[1]) (abc[1]={alpha[1, 0], alpha[1, 1], alpha[1, 2]}).  Instead of saving {alpha[1, 0], alpha[1, 1], alpha[1, 3]} to newabc, I would rather have {alpha[1, 0], alpha[1, 1], alpha[1, 2]}.   To do that I made the following change:

if assigned(tab[conds(i)]) then 

which results in something completely different.  What am I missing?  

@acer I see your point.  Perhaps I should not have said "remove" but "left out" or "changed to the counterpart".  Please check "something like" above.  There the counterpart (the result of conds(element))  is swapped by element. At the end of the solution, I used set to shrink abc to the sets I need.  In summary, the procedure in "something like" works but I can't believe that it is the fastest and cleanest way of achieving the result.   The swapping was only possible because I made a copy of abc to array.  Maple won't allow abc[I]:=abc[j]; it sends out an error message.   

@acer many thanks.  What parts are you confused by?   Unfortunately, your solution results in an empty set since evalb(conds~(abc)=abc) is true.  That is the reason I said "variable size" in the title.  Once a counterpart element (conds(abc)) is found it must be removed.

@Carl Love  What is being removed is the counterpart (it is not actually a copy).   Example:  3-tuple {alpha[1, 0], alpha[1, 4], alpha[2, 2]} has 3-tuple {alpha[1, 0], alpha[1, 4], alpha[3, 3]}  as a counterpart.  The counterpart should be removed and the other 3-tuple is kept in the list.  


Since the result of evalb is true, abc[100] must be removed from abc. 

@Carl Love Many thanks.

Four things:

  1. I will try to answer point by point.
  2. I won't use technical terms.
  3. I will try.
  4. Okay.

Your questions:

  1. Yes, it is for now. Once this example is sorted out, abc will be a copy of 4-tuple, 5-tuple and so on.
  2. Yes, it does.  It applies a certain criterion over an element of abc and returns another element of the same size.
  3. I don't understand the question.  You were right, it is just one copy. Please forget about multiple copies.  


I forgot to use Grid:-Set for all subprocedures called by the main procedure.  To check that I had to copy them to a new worksheet and then issue Grid:-Set for all subprocedures.  By doing this, Grid:-Set worked as expected.

Question:  What should I do if I want to stick to using the module?  Use grid inside of the module and issue the command there?  Many thanks.

@Carl Love I am the one who should apologize and say thank you for all the help in the past and now. 

  • The list starts with three and goes up to 12 or 13 (that is the reason for my other question in the lid: Iterator).
  • Yes, there is always one element in the list that matches the search or two elements (due to the symmetry - I don't think there are more than two when the order goes up to 4 .. 13, but I can't prove that).  

Sets and lists - I normally use list to maintain the order.  By the way, if I change my last code to sets, the final number of elements goes down quite a lot (This makes me think that I am mistaken that there are only two symmetric copies). 

Only one element (copy) should remain.  The other copies are symmetrical systems that have the same dynamics. 

I will answer yes for the last question but I am not sure.  I need the indexes of the elements to use in another list. 

My questions:

a) Can the search (and remove copies) be made when I will need to use Iterator? 

b) If the answer for your last questions is no can you show me how to sure selectremove (I tried but surely I did something wrong). 

Many many thanks.

@Carl Love  My attempt to solve the problem is as follows.  

for i from 1 to nops(abc) by 1 do
end do:

conds:= proc(varCoef::set,vars::name:=alpha)
local T1,T2,res;
T1 := table([2=3,3=2,5=6,6=5,7=9,9=7]):
T2 := table([2=3,3=2]):
end proc:

for i from 1 to nops(abc) by 1 do
end do:



@Carl Love Many thanks.   I run your code and found that the first element of abc is not in the resulting list (or set).  The way I see thte search is:  get the first element and find (or not) the one in the list that fits conds and then remove it (if you don't remove it when the search reaches that element, the first one is removed and it ends up without any representative of that set of coefficients).  I have the impression that the result in your code is the list (set) of the elements that don't fit conds at all). Please correct me if I am wrong.  

As for the question set-list, the order will matter later. Would set be a better choice?  

Conds is the y-z symmetry.  


@Carl Love Thank you ever so much. 

@Carl Love Many thanks.   I am glad to know that I finally got something right.  One final question in this thread: what does [] exactly do?  I know that in the commands above [] moves away from list and in doing that set eliminates redundancy.  

@Carl Love Many thanks.  I changed your example to one of my problems.  I think I got it right but I would like to hear from you.


parms := [alpha[1, 0], alpha[1, 1], alpha[1, 2], alpha[1, 3], alpha[1, 4], alpha[1, 5], alpha[1, 6], alpha[1, 7], alpha[1, 8], alpha[1, 9], alpha[2, 0], alpha[2, 1], alpha[2, 2], alpha[2, 3], alpha[2, 4], alpha[2, 5], alpha[2, 6], alpha[2, 7], alpha[2, 8], alpha[2, 9], alpha[3, 0], alpha[3, 1], alpha[3, 2], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]]

S:= parms:
B:=s-> evalb(numelems(convert(map2(op, 1, s),set))=3):
# The Array method:
A:= Array(1..0): 
for C in Iterator:-Combination(nops(S),n) do
    if B((s:= S[[seq(C+~1)]])) then A,= s fi
L1:= [seq(A)]:
# The embedded loop method: 
L2:= [
    for C in Iterator:-Combination(nops(S), n) do
        if B((s:= S[[seq(C+~1)]])) then s fi

Could you tell me what ",=" means? Many thanks. 

@Carl Love Many thanks.  Please give some time to completely understand your solution.   Meanwhile, can you give away the major syntax additions? I am also running Maple 2020.  

The lines 

B1:= (s::set)-> `if`(B(s), s, NULL);
L:= [seq(B1(S[[seq(C+~1)]]), C= Iterator:-Combination(nops(S), 6))]

don't seem to work. They return

L:=[ifelse(B({22424170465, 193139816415, 386408307450, 395718860534, 412286285840, 427552056869}), {22424170465, 193139816415, 386408307450, 395718860534, 412286285840, 427552056869}, NULL) .....


@Carl Love Many thanks.  Two questions if I may:

1) I don't know I get it right, but can you do the same using seq (option 2)?

2) Suppose I want some save some of them using a certain criterion.   Would it faster to save them to a table?  (I know you answered a question a few years ago showing the difference between list, table and (I completely forget) but I can't find it). Many thanks.

@Kitonum That phrase was referring to the use of subsets.   The main point is to get the subsets with a fixed number of elements one by one without generating them all up front.   When I sent the question I was not aware that nextcomb was available.  Iterator seems a good option too.  Many thanks. 

2 3 4 5 6 7 8 Last Page 4 of 13