410 Reputation

6 Badges

7 years, 325 days

MaplePrimes Activity

These are replies submitted by emendes

@Carl Love Many thanks for the code with all 6 conditions.  I knew it that you would take my sloppy code and transform it into a single line.  Light years beyond my skills. 

Odd situation:  (Mac)  The first time I run the code, it did not finish up for n=4. That usually takes little time to finish.  I quitted Maple on my mac and. run the code again.  This time it worked for n=4, n=7, ...

Linux:  Please see the messages below.  



  1. nIs, the tables and their number in permutations_by_index, TS_5t, T6, parms and {0,1,4}, {0,2,7}, {0,3,9} (the numbers of set can also change)   are problem-dependent. Can they be made arguments as n


@Carl Love Thank you ever so much for the thorough explanation.   The permutation concept and ist implication are now much clear.   I wasn't aware of the homorbital definition.  I think my main problem is with computation aspects of it.  cache and remember are not "natural" to me.  I wouldn't know how to use them.  (As usual, I need time to go through it slowly).

Condition 6 - if by counterpart you mean the result of conds (symmetry), the answer is yes. If even the counterpart is no removed right way, Condition 6 will remove it later on.  (I would rather have it removed now than later).   

@Carl Love I am trying some ideas so I would say that it is no longer needed. 

Yes, condition 5  being false automatically disqualifies the counterpart of S.

Condition 6 (I think it encompasses Condition 1) 

TS:=table([0={},1={1},2={2},3={3},4={1},5={1,2},6={1,3},7={2},8={2,3},9={3}]),  # T

# valid 3d forms
valid3Dforms := proc(S::set,T::table,Is::set)
description "This functions returns true for a valid 3D form.";
local i,j,res,newTi,newTj;
if Is = op~(1,S) then  # Condition 1 
   res:=((newTj[1] union newTj[2]) subset {0,1,2}) or ((newTj[1] union newTj[3]) subset {0,1,3}) or ((newTj[2] union newTj[3]) subset {0,2,3}):
   res:=not res:
end if:
end proc,

It only works for this example.  I need to make it work for a different TS.  

@Carl Love  I was trying to remove condition 3 from Orbit by simply comment it out (I pay attention to the ands), but unfortunately it breaks the code somehow.   

Error, (in anonymous procedure called from AllowOrbit) improper op or subscript selector 


@Carl Love  I did as you've asked,  The results are:

  1. compile=false - Linux -  same error.  mac - problem solved, no messages. 
  2. numtasks=26.  Linux - no error.   
  3. Sequential works fine for both OS's before and after changes.

@Carl Love The second attempt works in the mac but it did not in the server. 

A different error msg comes out if I try one more time

I had to add another condition (Condition 5).   

testallvars := proc(S::set,T::table)
description "This function tests if all variables show up in the 3D form";
local j,ans;
end proc:


@Carl Love Many thanks.  Now I know why the number on the bottom right change from time to time.

@Carl Love Many many thanks. That code will save me precious time, thank you ever so much. As usual, I need time to understand what is going on. I tried to run Symmetry.mw on my mac and on my server but unfortunately, it did not run on both of them.  Here are the screenshots

1) Server

2) mac

New questions:

  1. How to insert a code (OrbitPartition module) in a worksheet as you did?  
  2. How to load Orbit partition module without executing the entire worksheet?  I copied it to a separate mpl file to be called whenever I need.  With the error messages I am not sure if the calling of the module works. 


Regarding the proof, I would like to see it if I may.  You have my email address, don't you?  Many thanks.  


@Carl Love Please don't keep me in the dark.   Answering your question: No, that would be my next step.   My Linux box is on its knee trying to find the 12-tuple sets.   The problem here is one step further. There is another condition that depends on solve.  

@acer Many thanks for helpful information on kernelopts.  In your answer, you mentioned garbage collection.  I am dealing with huge sets and if I add a loop to OrbitPartition to change  the size of tuple (say from 3 to 15), memory allocation could be a problem.   For instance, 12 crashed my 72 core linux.  I haven't used gc() from one step to the another.  The reason for not using was "Note, as of Maple 16 the use of gc is discouraged.".   How serious is that statement?   Would it be safe to use gc() within the loop?  

@Carl Love Many thanks for the excellent explanation. When I saw the numbers I knew it that there is something fishy about them.  

Re: Making it a module: - Yes, please.  I have too many worksheets doing almost the same thing. I am placing the definite solutions into a module so I do not need to worry about using previous versions or anything of the sort. 

Module:  export OrbitPartition and all the other functions as local functions.  I know there will be a catch here and I want to learn what is needed to avoid it.  

@Carl Love Many thanks.   I will follow your suggestion but my earlier trials with tasksize defined by Maple did not go well.  Perhaps if I set the tasksize myself as you said,  I will get the better results.  

@Carl Love Thank you ever so much.  

Answers to your answers:

  1. Re: Re: Why op rather than `?[]`  I see.  Many thanks for the explanation.  I didn't know about gc.   
  2. Re: Re: Condition 3 and tuple length.  Great!  It seems that my explanations are somehow improving. 
  3. Re: Re: Maximum orbit length: Now I understand what you meant by Orbit. No, this cannot happen with the sets in this example.  


  1. I run the code for tuple_size = 7 and it was pretty fast.   Code:-Usage sent out "memory used=36.06GiB, alloc change=160.00MiB, cpu time=9.76m, real time=5.23m, gc time=6.33m".   Since my mac only has 16 GB of ram, does it mean that there was swapping to the disk?   Would it be possible to run the code for tuple_size=15?
  2. options remember and cache.  Could you give details on why you used them? 


@Carl Love Many thanks.  The discussion is helping me to better understand the main problem that I need to solve (thanks a lot).


Your Questions:

  1. I can't be sure a 100% but I think that the answer is "No, it does not".  
  2. I don't know if I understand your question.  What do you mean by length 2?  T1 and T2 are particular to this set of parameters (parms).  If parms changes by adding more "alphas", then T1 and T2 will be different.  

Your Answers (to my questions):

  1. But the following set is valid
[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[2, 0], alpha[2, 1], alpha[2, 2], alpha[2, 3], 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]]

         I am not sure if I understand your answer. 

       2. Why should op replace `?[]`?  

@Carl Love  Many many thanks.  As I said your solution is way out of my league.  I will have to break it down to see if I can understand it.  

"Your 3rd condition cannot ... tuple sizes".  Why not?  Example (24 terms)

[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[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]]

for i=1 and i=3, the elements are the same and therefore the tuple is not valid (It covers 1,2,3 and there are elements with j>=4). 

When comparing results, my routine returns 153 sets instead of 358.  I need to understand your solution in order to see if I got it right.

Edit 1: My bad!  I forgot to add another condition:  i=1, if j is a subset or equal to {0,1,4} or for i=2,  if j is  a subset or equal to  {0,2,7} or for i=3, if j is a subset or equal to {0,3,9}, the set is not valid and should be removed (as well as its counterpart).  

Although I could add this new condition to your code, I very much doubt that my coding is as efficient and concise as yours.   Here it is (for my shame):


test3d := proc(listparms::set)
description "This function returns the indices of the list of parameters that won't lead to a full 3D form";
# It only works for quadratic models 
local i,j,L1,L2,L3,ndim,inds,t:={seq(i,i=0..9)},T:=[{0,1,4},{0,2,7},{0,3,9}],CT,res,auxparms;
CT:=[seq(t minus T[i],i=1..nops(T))]: # At least one of these terms and the system is okay
L1:=map(`?[]`, auxparms, [1]):  # list of the first subscript
L2:=map(`?[]`, auxparms, [2]):  # list of the second subscript
ndim:=max(L1):  #  Dimension
L3:=[seq(L2[inds[i]],i=1..ndim)]:  # Second subscript in groups
end proc:

The number of sets is now down to 123 (30 less than the result in my routines). 


Edit 2: Question:  Could you explain what  `?[]` does?  Is there a command (something like op) that does the same?  (I have it above but I am not sure if I grasped the full meaning of it).

First 7 8 9 10 11 12 13 Last Page 9 of 19