Ask Your Question

j0equ1nn's profile - activity

2019-05-02 02:18:16 +0200 marked best answer How do I define (and work with) a set of matrices?

Suppose $a,b,c$ are matrices, and I want to define the set $S=$ { $a,b,c$ }. What is the proper syntax for this? More generally, how do I define a set by specifying its elements (regardless of their nature). I am only finding documentation for sets of numbers.

I'm also interested in doing functions that take sets like $S$ as input. For instance, if I had a matrix $d$, I want to be able to define a set like $S'=$ { $da,db,dc$ }, but I want to be able to do this via the Sage equivalent of $f(S):=$ {$ ms\mid s\in S $}.

2019-05-02 02:18:13 +0200 received badge  Good Question (source)
2018-12-17 04:39:07 +0200 received badge  Notable Question (source)
2018-10-10 23:28:48 +0200 received badge  Popular Question (source)
2018-07-24 19:06:45 +0200 received badge  Famous Question (source)
2018-02-28 13:04:33 +0200 received badge  Notable Question (source)
2018-01-25 03:33:06 +0200 received badge  Famous Question (source)
2017-04-13 16:27:36 +0200 received badge  Popular Question (source)
2017-03-03 19:02:10 +0200 received badge  Notable Question (source)
2017-03-03 19:02:10 +0200 received badge  Popular Question (source)
2016-12-06 15:15:25 +0200 received badge  Notable Question (source)
2016-08-22 15:41:09 +0200 received badge  Popular Question (source)
2016-08-22 15:41:09 +0200 received badge  Notable Question (source)
2016-06-30 08:50:24 +0200 received badge  Popular Question (source)
2016-06-15 00:20:48 +0200 received badge  Popular Question (source)
2016-04-04 06:15:23 +0200 commented answer How do I identify the set of words of given length in matrix generators

Cool, that enables my computer to make a database of words up to length 8 in my generators, with a tolerable run-time. (My group is in SL(2,C) and has 3 generators.) Thanks again for all of your help.

2016-04-04 01:30:44 +0200 commented question How do I identify the set of words of given length in matrix generators

@FredéricC I did not know of that command for generating words, but there is a big difference between words in the free group <a,b> and reduced words in a matrix group. I'm interested in reducing run-time by avoiding repetition of equivalent words, and also being able to efficiently search through the words generated.

2016-04-04 01:14:03 +0200 commented answer How do I identify the set of words of given length in matrix generators

One solution I have is just, use your original answer, then in my function that searches through G I can tell it to make the collected output into a set before returning it. This will not reduce run-time, but does save me the trouble of looking through the output for distinct elements. BTW I really appreciate your help with this! There are many things that just take me forever being inexperienced and you've already saved me a lot of time.

2016-04-04 00:35:01 +0200 commented answer How do I identify the set of words of given length in matrix generators

I want to be able to search for words satisfying certain properties, up to some chosen length. I can do that in the previous version, but I must search through each item in the list of sets G and I get a lot of repetition. It would be okay to have G be a list of sets by reduced word length (meaning if something simplifies to a shorter word, it doesn't get included in a new set). It would also be okay to have G just be a set of all words up to the given length. With the new version you've given I get the error "local variable 'W' referenced before assignment," which makes no sense to me since W=V, and V is the set of generators and their inverses.

2016-04-03 07:02:48 +0200 commented answer How do I identify the set of words of given length in matrix generators

Something strange about this though. We are not creating a set, but a list of sets, right? Because of this there is in fact a lot of repetition. For instance, every time a matrix can be written as a non-reduced word of length L in the generators, it will be included in the (L-1)th set in the list. Is there an easy modification that will put all these sets together, perhaps improving run-time further?

2016-04-03 06:07:44 +0200 commented answer How do I identify the set of words of given length in matrix generators

This is great! I had improved my code a little from what I posted, but still a run-time long enough to go grocery shopping before getting the data. This approach by contract even runs in Sage cell online in a few seconds.

2016-04-03 06:04:01 +0200 commented answer How to efficiently test whether a matrix can be written as a certain type of word

Interesting, I was hoping something like this had already been done. I made a typo though in my question: I meant to say "discrete subgroup of SL(2,C)" rather than "Z," which I expect makes this much more difficult. I'm going to update my question but of course am up-voting this answer.

2016-04-02 01:42:11 +0200 asked a question merge lists of lists

I realize that if I have two lists, say

l1 = [1,2,3]
l2 = [4,5,6]

then I can join them via

l1 + l2

i.e. this gives [1,2,3,4,5,6].

I want to know how to do this when my list is not a list of numbers, but a list of matrices. I imagine it would be the same for a list of lists but I don't know how to do that either.

2016-04-02 01:30:25 +0200 asked a question How do I identify the set of words of given length in matrix generators

I should mention that I am a beginner with Sage so please bear with me. Also this question regards a small sub-step of what this question is about: http://ask.sagemath.org/question/3293... But I expect the current issue would be much more common.

Take a small set of matrices, let's say 3 of them: m1, m2, m3. Let G be the group generated by these matrices. I want to be able to work with words of a given length in these generators. Let Gn be the words of length n in G. Then for example

G1 = (m1,m2,m3,m1^(-1),m2^(-1),m3^(-1)).

Is there a pre-built module for working with words of length n for n arbitrary? If not, I'm sure someone can find improvements on the approach I am taking. For instance to get G2, I have been doing this:

G2 = []
for g in G1:
    for h in G1:
        if g*h not in G2:
            G2.append(g*h)
        if h*g not in G2:
            G2.append(h*g)

This gives me everything in G2, and avoids repitition, but does not extend well to Gn.

To get G3 I have been doing this:

G3 = []
for g in G2:
    for h in G1:
        if g*h not in G2:
            if g*h not in G1:
                G2.append(g*h)
        if h*g not in G2:
            if h*g not in G1:
            G2.append(h*g)

If I want to go to G4 in this way, I need to add a line that makes sure my new addition isn't in G3, and I need to keep adding new lines at each increase in word length. I would like to define a function which outputs all words of length n, but as you can imagine from my approach above that is not working out well.

2016-04-01 09:39:33 +0200 asked a question How to efficiently test whether a matrix can be written as a certain type of word

I am pretty new to Sage. I plan on learning/practicing more but for now I need a quick way of getting some data, so I'm hoping hoping to get some tips.

Suppose I have a discrete subgroup H of SL(2,C), and I have a subgroup G of H. Both of these groups are finitely generated, and I have a list of generators for each group. Given some element h of H, I want an efficient way of telling whether or not there exists an element g of G such that h=gg* where g* is the conjugate transpose of g. Note that the membership problem is decidable for SL(2,C), but this problem is much easier than finding an algorithm for that general case.

What I did so far is I computed each generator of G in terms of the generators of H by writing a script that went through by word length. I also computed a list of matrices of the form gg* up to words in G up to length 3, but the order in which these show up is not convenient.

So, let h be some element of H, given as a matrix. My plan is to write h in terms of the generators of H, so that I can more easily recognize whether it's of the form I want, by comparing it to the words for the generators of G. But my method of doing this is veeeerry slow, too slow to suit my purposes. An important factor is that there are a lot of elements in H that I need to check this on, so I need to be able to run this quickly. Preferably I would define lists of matrices to check, then have a program that just runs through the lists and tells me which ones meet my condition.

I feel like I may be reinventing the wheel in some parts of this, since it seems a fairly common problem to be studying words in matrices. Perhaps there is a pre-built module that has tools I could use but so far I have not found anything.

Thanks in advance.

My original post had a typo, and said SL(2,Z) rather than SL(2,C). The answer below from @vdelecroix pertains to the original post.

2015-12-24 14:53:47 +0200 commented answer Computing in a quaternion algebra over a complex field?

Cool. In light of this I prefer to include

Im = CC(-1).sqrt()

rather than typing that every time, though I'd still need to worry about irrational square roots and whatnot. I guess the quaternion algebra stuff is designed more for computing properties of the algebras than for computations within them?

2015-12-24 14:48:07 +0200 marked best answer Computing in a quaternion algebra over a complex field?

If I enter

Q.<i,j,k> = QuaternionAlgebra(CC,1,1)

there is no problem. I can then type something like

(2+i+j)*(3*i-j)

and get the appropriate answer

2.00000000000000 + 6.00000000000000*i + (-2.00000000000000)*j + (-4.00000000000000)*k

The problem comes when I want to use non-real numbers. If I type

i*sqrt(-1)

then I get

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-0b500ba4930f> in <module>()
      1 Q = QuaternionAlgebra(CC,Integer(1),Integer(1), names=('i', 'j', 'k',)); (i, j, k,) = Q._first_ngens(3)
----> 2 i*sqrt(-Integer(1))

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.RingElement.__mul__ (/home/sc_serv/sage/src/build/cythonized/sage/structure/element.c:17265)()

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/home/sc_serv/sage/src/build/cythonized/sage/structure/coerce.c:9721)()

TypeError: unsupported operand parent(s) for '*': 'Quaternion Algebra (1.00000000000000, 1.00000000000000) with base ring Complex Field with 53 bits of precision' and 'Symbolic Ring'

As a matter of fact, something similar happens if I type

i*sqrt(2)

which is not imaginary... I also tried typing

I*i

and got a similar error message. Since I am supposedly working in the quaternion algebra over the complex numbers, how do I specify arbitrary complex coefficients?