Steve Stavrou

## 60 Reputation

9 years, 304 days

## Exporting Output...

I am trying to convert the output to a .txt file so that I can use it for something. To do this, I was exporting the output created from your algorithm using Export As... I tried to convert to .txt but it truncates the output. When I tried to export as a PDF I get an error. Do you know how I can get the 20160 elements into a .txt file??? Please and thank you.

## Which Package?...

Hello,

I pasted the following that you suggested but I am getting an error:

restart:
with(LinearAlgebra):
CartProdSeq:= proc(L::seq(list), $) local S,j; eval(subs(S= seq, foldl(S, [_i||(1..nargs)], seq(_i||j= L[j], j= nargs..1, -1)))) end proc: PRIME:= 2: for M in CartProdSeq([$0..PRIME-1] 16) do if Determinant(Matrix(M)) mod PRIME <> 0 then Mats[cat(M[])]:= [][] end if end do: Mats:= [indices(Mats, nolist)]; Error, (in LinearAlgebra:-Determinant) matrix must be square Error, invalid input: indices received Mats, which is not valid for its 1st argument, t Am I using the wrong package? ## @Kitonum Ok great, thank you again,... @Kitonum Ok great, thank you again, but your Conv has me inputing each element individually. What's a fast way that I can just quickly get all of the 225 elements converted to how I need them to be? Thaaaank you! ## @Kitonum Hi, thank you but is it po... @Kitonum Hi, thank you but is it possible to have the output not be in matrix or list of lists form? I want S to look like: S = { E11, E12, E13, ..., E11+E12, ..., E21+E22+E23+E24, ... etc.}, where |S| = 225. Meaning, I don't want to use actual arrays or lists, I just want to have a set containing elements that are all the rank-1 linear combinations of Ejk's as I have written above. My reason for this is because it is more efficient for the computations I plan to use it for--rather than using lists and arrays. Thanks! ## @Carl Love Hi Carl, Is there a way ... @Carl Love Hi Carl, Is there a way for you to modify the algorithms you gave me so that the previous sets get emptied after each new set is created? Recall that since we are classifying about 4 billion elements, there is not enough memory. But to compute set T_{r+1} I only need T_r, and thus set T_{r-1} can be emptied to free space. All that would need to be printed is the cardinality of the set BEFORE it is emptied (just so I can ensure all the elements have been classified). We start with T1, the set formed from the triplication. Then T2 is the set formed from all additions x+y(mod2) for all x and y in T1. Then T3 is the set formed from all additions x+y(mod2) for all x in T2, y in T1. After this step, we can empty T2. Now T4 is all additions x+y(mod2) where x is in T1 and y is in T3. After this step, we can empty T3. And so on, until we generate the set T_r which has no new elements. ## @Carl Love What about this: U... @Carl Love What about this: Using the previous algorithm you gave me (below), I want to build off it in the following way: Take the set T6 (which contains 24 elements) and triplicate it (using a modification of the X3 procedure below), then modify the rest of the procedure in Step 2 below using T6 as the new initial set. So it will be: for x and y in T6 perform z:=(x+y)mod2. Put only new elements formed in a new set, and repeat until no new sets can be formed. restart; #Step 0: B1:= A1+A2: B2:= A1+A3: B3:= A3+A4: B4:= A2+A4: C1:= +(A||(1..4)): R:= {A||(1..4), B||(1..4), C1}; {A1, A2, A3, A4, A1 + A2, A1 + A3, A2 + A4, A3 + A4, A1 + A2 + A3 + A4} # Step 1: The procedure X3 takes any set and produces a set with three times as many elements, using the identities above X3:= proc(R::set) local Names:= indets(R,name), S0:= [R[]], A, S01:= subs(seq(A= cat(A,1), A in Names), S0), S02:= subs(seq(A= cat(A,2), A in Names), S0); {S01[], S02[], zip(+, S01, S02)[]} end proc: S1:= X3(R): T1:= X3(S1): #Step 2: z:= P-> +(P[]) mod 2: T2:= map(z, combinat:-choose(T1,2)) minus T1: nops(T2); 2268 CartProdSeq:= proc(L::seq(set)) local Seq,i,j; option Copyright (C) 2007, Joseph Riel. All rights reserved.; eval({subs(Seq=seq, foldl(Seq , [cat(i,1..nargs)] , seq(cat(i,j)=L[j],j=nargs..1,-1) ))}); end proc: Union:= T1: for n from 3 while T||(n-1) <> {} do Union:= Union union T||(n-1); T||n:= map(z, CartProdSeq(T1,T||(n-1))) minus Union end do: nops(T1); nops(T2); nops (T3); nops(T4); nops(T5); nops(T6); nops(T7); 81 2268 21744 37530 3888 24 0 ## An idea...!... @Carl Love Hi Carl! I think I have an idea of what to try, but again I am not sure how to program it. Basically, I am only interested in the number of sets created during the Step 2 process (i.e. the number of new sets r formed where r+1 is empty): Recall that R (R has 3^2 elements) is our initial set to be triplicated. Then S1:=X3(R) has 3^3 elements, T1 := X3(S1) has 3^4 elements, and P1 := X3(T1) has 3^5 elements (and this is the case that has too many elements to complete). During the case when we use T1, the procedure for #Step 2 gave T2, ..., T6 (with sizes 2268, 21744, 37530, 388, and 24, respectively). So including T1, there are 6 sets--this is what I care to know. So I think I have an idea on how to save memory. First of all, within T2, T3, ..., T6, these sets can be further separated based on their orbits under a certain group action. Don't worry about this detail, I can do it easily by hand, but the point is that I am going to take the orbit representative from the largest set, T6, and use it in the next case (P1). Let's call this representative element (from T6) M where, M := A111 + A122 + A212 + A312 + A121 + A221 + A321 + A411 + A412 + A422. In order to use M in the next case, we need to append the indices of each term with a 1 at the end. Thus we have M':= A1111 + A1221 + A2121 + A3121 + A1211 + A2211 + A3211 + A4111 + A4121 + A4221. So now we take P1 and create a new set P1' that contains elements from P1 of the form Aijk2 (i.e. we only want elements whose last index is 2. Thus the only elements in common between P1 and P1' will be elements ending in 2). Next we modify #Step 2 so that it computes all (M' + X) mod 2, where M' is the element above and X is every possible element from P1'. Then, once again, the procedure will compute P2, P3, P4, ... and so on until it computes an empty set. I suspect it will go up to P6. ## Out of memory... @Carl Love Hmm, unfortunately for the case of triplicating the original set for the third time, we get nops(X3(T1)) = 243 elements. The number of elements to sort becomes too large. Is there a more efficient way to do this? I'm expecting that, in Step 2, there will be between 10-12 sets before it creates one that is empty. ## Maintaining Initial Identities... @Carl Love That makes sense, thank you! ## Repeating for larger initial sets, S_1... @Carl Love Thank you! But now I have another question... what if I want to take the set S1 (which contains 27 elements) and repeat the entire process so that: Step 1: For each x in S1, create x1, x2, x3 (where x3=x2+x1) and start a new set T1 (this one should have 27x3 elements) Step 2: Do as your code says: For x in T1 and y in T1 perform z=(x+y)mod2 and make T2 with only distinct z not in T1 , then do (x+y)mod2 for x in T1 and y in T2 and so on until, again, you reach a Tr that is empty. ---- And then what if I want to take T1 and for all x in T1 create x1, x2, x3 where x3=x2+x1 and this time call it U1 (this time it has 27x3x3 elements) and repeat again? I guess I'd also like to always be able to grow my sets (S1 to T1 to U1 and so on, where each new one increases in cardinality by x3 ) and for each of those sets do Step 2 above. Does that make sense? ## I have a question!... Hi Carl, am I posting the question in the proper place? If not, let me know and I can post it in another way. My comment/question is: Now I need a specific restriction on the entries of the unknown vectors X_1, X_2, X_3, X_4. For each of those length 4 vectors, I need the product of the first and fourth entries to equal the product of the second and third entries. That is, for vector X_1 = [x_11 x_12 x_13 x_14]^t, I require (x_11)(x_14) = (x_12)(x_13). Similarly for the other 3 unknown vectors X_2, X_3, X_4. I started looking at the solution of the X_1 vector. I noticed that x_13 = 0 which means the product (x_12)(x_13) = 0. So now I need to see IF (x_11)(x_14) = 0. Can you please check this for me? If (x_11)(x_14) does NOT equal 0, then let me know because I am interested in this! But if it DOES equal 0, then can you check the same thing for X_2, X_3, X_4? I'm hoping that for one of those vectors, the entries do not satisfy the constraints mentioned above. Or maybe a faster way is to modify the program to have the entry restrictions of the vectors built right in? ## I have a question!... Hi Carl, am I posting the question in the proper place? If not, let me know and I can post it in another way. My comment/question is: Now I need a specific restriction on the entries of the unknown vectors X_1, X_2, X_3, X_4. For each of those length 4 vectors, I need the product of the first and fourth entries to equal the product of the second and third entries. That is, for vector X_1 = [x_11 x_12 x_13 x_14]^t, I require (x_11)(x_14) = (x_12)(x_13). Similarly for the other 3 unknown vectors X_2, X_3, X_4. I started looking at the solution of the X_1 vector. I noticed that x_13 = 0 which means the product (x_12)(x_13) = 0. So now I need to see IF (x_11)(x_14) = 0. Can you please check this for me? If (x_11)(x_14) does NOT equal 0, then let me know because I am interested in this! But if it DOES equal 0, then can you check the same thing for X_2, X_3, X_4? I'm hoping that for one of those vectors, the entries do not satisfy the constraints mentioned above. Or maybe a faster way is to modify the program to have the entry restrictions of the vectors built right in? ## Thanks!... Thank you very much. I may have some questions when I look at this in detail tomorrow, so I may be contacting you! Thanks! ## Thanks!... Thank you very much. I may have some questions when I look at this in detail tomorrow, so I may be contacting you! Thanks! ## One last question... Thanks, that clarifies it. So how do I make it so that only the unknowns in S and R are solved for? In other words, how do I solve the following polynomial system for the unknowns a_i, b_i, c_i, d_i for i = 1, 2, 3, 4? \begin{align*} q & = \sum_{i = 1}^4 a_i s_i, \\ w & = \sum_{i = 1}^4 a_i t_i, \\ y & = \sum_{i = 1}^4 a_i r_i, \\ u & = \sum_{i = 1}^4 a_i l_i, \\ &\\ p & = \sum_{i = 1}^4 b_i s_i, \\ f & = \sum_{i = 1}^4 b_i t_i, \\ g & = \sum_{i = 1}^4 b_i r_i, \\ h & = \sum_{i = 1}^4 b_i l_i, \\ &\\ j & = \sum_{i = 1}^4 c_i s_i, \\ k & = \sum_{i = 1}^4 c_i t_i, \\ z & = \sum_{i = 1}^4 c_i r_i, \\ x & = \sum_{i = 1}^4 c_i l_i, \\ &\\ v & = \sum_{i = 1}^4 d_i s_i, \\ n & = \sum_{i = 1}^4 d_i t_i, \\ m & = \sum_{i = 1}^4 d_i r_i, \\ o & = \sum_{i = 1}^4 d_i l_i, \end{align*} subject to the constraintsa_i d_i = b_i c_i$and$s_i l_i = t_i r_i$for$i = 1, 2, 3, 4\$.

 1 2 3 Page 1 of 3
﻿