Ask Your Question

phcosta's profile - activity

2023-11-30 21:02:48 +0200 received badge  Famous Question (source)
2023-11-30 21:02:48 +0200 received badge  Popular Question (source)
2023-11-30 21:02:48 +0200 received badge  Notable Question (source)
2023-08-27 15:58:40 +0200 commented question Jupyter in sagemath 10

I was using 9.8 and Juptyer was working. But after I updated it stoped. I already tried to reinstall. That is the proble

2023-08-25 23:30:48 +0200 asked a question Jupyter on Sagemath 10

Jupyter on Sagemath 10 I installed SageMath 10.0 on my MacBook, but Jupyter stopped working. Any suggestions?

2023-08-25 23:29:42 +0200 asked a question Jupyter in sagemath 10

Jypter in sagemath 10 I installed SageMath 10.0 on my MacBook, but Jupyter stopped working. Any suggestions?

2023-05-13 13:46:47 +0200 received badge  Notable Question (source)
2023-02-19 17:05:59 +0200 received badge  Popular Question (source)
2022-06-20 11:45:17 +0200 received badge  Popular Question (source)
2021-08-19 04:33:45 +0200 commented answer Changing symmetric elements in a matrix

Thank you.

2021-08-19 04:01:02 +0200 commented answer Changing symmetric elements in a matrix

Thanks. it is possible to assign values to ps, for example p(1,1,1,1) = 1.

2021-08-19 03:58:13 +0200 commented answer Changing symmetric elements in a matrix

Thanks. it is possible to assign values to p s, for example p(1,1,1,1) = 1.

2021-08-19 03:55:17 +0200 marked best answer Changing symmetric elements in a matrix

Hello, I hope you are doing fine. I have the matrix below:

def p(*t):
   return SR.var(('p' + '_{}'*len(t)).format(*[str(i) for i in t]))
S = FiniteEnumeratedSet([1,2]) 
P = cartesian_product([S]*2)
M = {}
for (row, (i,j)) in enumerate(P):
   for (col, (k,l)) in enumerate(P):
      if i<=j:
         M[(row, col)] = p(i,j,k,l)
      elif i!=j:
         M[(row, col)] = p(i,j,k,l)
m = matrix(M)

This return the matrix:

m
[p_1_1_1_1 p_1_1_1_2 p_1_1_2_1 p_1_1_2_2]
[p_1_2_1_1 p_1_2_1_2 p_1_2_2_1 p_1_2_2_2]
[p_2_1_1_1 p_2_1_1_2 p_2_1_2_1 p_2_1_2_2]
[p_2_2_1_1 p_2_2_1_2 p_2_2_2_1 p_2_2_2_2]

I would like to apply the symmetry property that I have in the system which guarantees p(i,j,k,l) = p(j,i,l,k). In this case, M = {1,2} it is easy to do manually, but if M = {1,2,3}, for instance, it is much more complicated.

So basically, I would like to exchange the elements in such a way that:

m
[p_1_1_1_1 p_1_1_1_2 p_1_1_1_2 p_1_1_2_2]
[p_1_2_1_1 p_1_2_1_2 p_1_2_2_1 p_1_2_2_2]
[p_1_2_1_1 p_1_2_1_2 p_1_2_1_2 p_1_2_2_2]
[p_2_2_1_1 p_2_2_1_2 p_2_2_1_2 p_2_2_2_2]

Any suggestions?

2021-08-18 17:15:32 +0200 asked a question Changing symmetric elements in a matrix

Changing symmetric elements in a matrix Hello, I hope you are doing fine. I have the matrix below: def p(*t): return

2021-08-12 14:50:24 +0200 commented answer Inserting points in elements of a list

I have used that one: http://sagebook.gforge.inria.fr/

2021-08-10 03:55:28 +0200 marked best answer Inserting points in elements of a list

I would like to transform a list, for example:

A = [((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 2)),
     ((1, 1), (1, 1, 1, 3)),
     ((1, 1), (1, 1, 2, 1)),
     ((1, 1), (1, 1, 3, 1)),
     ((1, 1), (1, 2, 1, 1)),
     ((1, 1), (1, 2, 1, 2)),
     ((1, 1), (1, 2, 1, 3)),
     ((1, 1), (1, 3, 1, 1)),
     ((1, 1), (1, 3, 1, 2))]

into

A = [((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 2)),
     ((1, 1, 1), (1, 1, 1, 3)),
     ((1, 1, 1), (1, 1, 2, 1)),
     ((1, 1, 1), (1, 1, 3, 1)),
     ((1, 1, 2), (1, 2, 1, 1)),
     ((1, 1, 2), (1, 2, 1, 2)),
     ((1, 1, 2), (1, 2, 1, 3)),
     ((1, 1, 3), (1, 3, 1, 1)),
     ((1, 1, 3), (1, 3, 1, 2))]

Any suggestions?

2021-08-10 03:54:32 +0200 commented answer Inserting points in elements of a list

Thank you. It is a very nice solution. Could you give me some references to learn a bit more about python/sagemath progr

2021-08-09 20:17:28 +0200 commented question Inserting points in elements of a list

Yes, it is exactly that. I would like to do that in a list that has len(A) = 108.

2021-08-09 17:19:52 +0200 edited question Inserting points in elements of a list

Inserting elements in a list I would like to transform a list, for example: A = [((1, 1), (1, 1, 1, 1)), ((1, 1),

2021-08-09 17:15:34 +0200 edited question Inserting points in elements of a list

Inserting elements in a list I would like to transform a list, for example: A = [((1, 1), (1, 1, 1, 1)), ((1, 1),

2021-08-09 17:13:00 +0200 asked a question Inserting points in elements of a list

Inserting elements in a list I would like to transform a list, for example: A = [((1, 1), (1, 1, 1, 1)), ((1, 1),

2021-08-04 21:11:44 +0200 commented answer Combining sets with a matrix

It works here. Thank you one more time.

2021-08-04 17:12:19 +0200 commented answer Combining sets with a matrix

Thank you very much. I guess, I got the idea. I put an example of the output that I'm looking for in my question. Probab

2021-08-04 17:08:58 +0200 edited question Combining sets with a matrix

Combining sets with a matrix Hello, I hope everyone is doing fine. I try to do some combinations of sets, but I have no

2021-08-04 04:40:01 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:39:48 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:39:12 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:38:58 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:38:33 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:38:11 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u

2021-08-04 04:37:56 +0200 marked best answer Combining sets with a matrix

Hello, I hope everyone is doing fine. I try to do some combinations of sets, but I have no clue how. If anyone can point me in any direction, it will be great. Here is the problem:

M = FiniteEnumeratedSet({1, 2})
P1 = cartesian_product([M]*2) 
P1 = P.list()
P2 = cartesian_product([M]*4)
P2 = [p for p in P2 if p[0] <= p[1]]
C = P1 + P2 #len(C) total columns
R = P1*3  #len(R) total rows

What I would like to do is to mount a matrix where the number of columns represents the sets C (16 columns) and the number of rows represents R. The rule for each entrance it will be:

if (i,j) in R and (i,j) in C:
    return -1
elif if (i,j) in R and ((i,u,j,v) in C or (u,i,v,j) in C):
    return 1
else:
    return 0

I would like some output as it follows below:

                 (1,1) (1,2) (2,1) (2,2) (1,1) (1,2) (2,1) (2,2) (1,1) (1,2) (2,1) (2,2)
   (1, 1)        [-1     0     0     0     -1     0     0     0   -1     0     0     0] 
   (1, 2)        [ 0    -1     0     0      0    -1     0     0    0    -1     0     0]
   (2, 1)        [ 0     0    -1     0      0     0    -1     0    0     0    -1     0]
   (2, 2)        [ 0     0     0    -1      0     0     0    -1    0     0     0    -1]
   (1, 1, 1, 1)  [ 1     0     0     0      1     0     0     0    0     0     0     0] 
   (1, 1, 1, 2)  [ 1     1     0     0      0     0     0     0    0     0     0     0]
   (1, 1, 2, 1)  [ 0     0     0     0      1     0     0     0    0     0     0     0]
   (1, 1, 2, 2)  [ 0     1     0     0      0     0     0     0    0     0     0     0]
   (1, 2, 1, 1)  [ 0     0     0     0      0     0     0     0    1     0     0     0]
   (1, 2, 1, 2)  [ 0     0     1     1      0     0     0     0    1     0     0     1]
   (1, 2, 2, 1)  [ 0     0     1     0      0     1     0     0    0     1     0     0]
   (1, 2, 2, 2)  [ 0     0     0     1      0     1     0     0    0     1     0     0]
   (2, 2, 1, 1)  [ 0     0     0     0      0     0     1     0    0     0     1     0]
   (2, 2, 1, 2)  [ 0     0     0     0      0     0     1     1    0     0     0     0]
2021-08-04 04:37:56 +0200 commented answer Combining sets with a matrix

Thank you for your time. I'll try to explain better: I would like to put ones in such a way that if (i,j,k,l) and (i,j,u