[sage-support] Eigenvalues of QQ-matrix, "magic limit"?

2014-04-28 Thread Jori Mantysalo

It takes less than two minutes to run

./sage -c "n=121; l=range(1,n+1); x=matrix([[floor(n/lcm(i,j)) for i in l] for j in 
l]).eigenvalues();"

But with n=122 calculation seems to get stuck.

Well, 122=61*2, so maybe it's because of a big factor? However, n=118=59*2 
takes only about a minute. And n=123 takes less than one minute, so the 
size of the matrix is not a problem in itself.


Is there some kind of magic limit in code? Size of cache? Something else?

--
Jori Mäntysalo

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: G.relabel problem

2014-04-28 Thread Nathann Cohen
Hello !!

Using 
>G.relabel( [ i+1 for i in range(G.order()) ], inplace=True )
> and repeat the same command once more causes the error below.
>

That is because of that (rom the doc of Graph.relabel) :

If ``perm`` is a dictionary ``d``, then each vertex ``v``
(which should be a key of ``d``) is relabeled to ``d[v]``.
Similarly, if ``perm`` is a list or tuple ``l`` of length
``n``, then each vertex (which should be in `\{0,1,...,n-1\}`)
is relabeled to ``l[v]`

I agree that the error message is not clear, though.

The reason is the following : If your vertices are named 
"a","r","whatever","hello" and you want to relabel them with "1,2,3,4" then 
there is no way to know which vertex is theone that should be renamed to 1, 
which to 2, etc ... If your vertex set is 0,1,2,3 ... to begin with,  then 
we "can assume" that you want vertex 0 to be renamed to the first vertex of 
your list, vertex 1 to the second, etc ...

When you use the second syntax :
 

> But using 
>G.relabel(lambda i: i+1, inplace=True)
> twice does not produce the error.
>

there is no such doubt, and we know which vertex should be renamed to which 
output by applying the lambda function.

I think we should change the code above, so that when you feed .relabel() 
with a list then the "first vertex of g.vertices()" is labeled with the 
"first vertex of your list", etc, etc ... I hope that it will not create 
any confusion that I do not see at the moment.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
Okay, thanks to this "vector" trick I was able to do what I wanted. Do you 
believe that the syntax should be changed so that A(vector(whatever)) has 
the same result as A(whatever) ? "vector" does not add a very meaningful 
information here ...

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] How can I see GF(8,'x') x Z/3Z as an additive group ?

2014-04-28 Thread Nathann Cohen
Hello everybody !

I need to use the elements of GF(8,'x') x Z/3Z as an additive group. Is
there a way to do this with Sage ? I need that to add more combinatorial
designs :-)

Thanks !

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: G.relabel problem

2014-04-28 Thread Nathann Cohen
The problem is now fixed by this ticket :

http://trac.sagemath.org/ticket/16257

If you can review it, it will be merged faster, possibly into the next 
release :-)

Thanks for the report,

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread John Cremona
On 28 April 2014 09:48, Nathann Cohen  wrote:

> Okay, thanks to this "vector" trick I was able to do what I wanted. Do you
> believe that the syntax should be changed so that A(vector(whatever)) has
> the same result as A(whatever) ? "vector" does not add a very meaningful
> information here ...
>

I think that the point is to allow creation of elements either with respect
to the input generators (using vector) or with respect to the simplified
generators (without vector).  Since both sort of input look the same
(tuples / lists) I am guessing that the trick of using "vector" is just
that -- a trick to be able to distinguish these.   Other ways are possible,
for sure.

John


>
> Nathann
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> I think that the point is to allow creation of elements either with respect 
> to the input generators (using vector) or with respect to the simplified 
> generators (without vector).  Since both sort of input look the same (tuples 
> / lists) I am guessing that the trick of using "vector" is just that -- a 
> trick to be able to distinguish these.   Other ways are possible, for sure.

Hmmm... Is there any point to handle both at the same time ? Why
shouldn't this decision be made when the group is built, in order to
be able to use either
1) The tuple corresponding to how the user built the group (much more natural)
2) The tuples corresponding to the reduced form if the user asked for
it during the construction ?

My problem is that I have no idea of how to make those changes... I
looked at the code but these things are inherited from
God-knows-where...

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
On Monday, April 28, 2014 11:11:45 AM UTC+1, Nathann Cohen wrote:
>
> > I think that the point is to allow creation of elements either with 
> respect to the input generators (using vector) or with respect to the 
> simplified generators (without vector).  Since both sort of input look the 
> same (tuples / lists) I am guessing that the trick of using "vector" is 
> just that -- a trick to be able to distinguish these.   Other ways are 
> possible, for sure. 
>

Thats it.
 

> Hmmm... Is there any point to handle both at the same time ? Why 
> shouldn't this decision be made when the group is built


-1, some method returns an abelian group and you don't know how it was 
constructed without having to dig around.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> Thats it.

The syntax is awful, do we agree on that ?

> -1, some method returns an abelian group and you don't know how it was
> constructed without having to dig around.

?

But when I create a group by myself which I want to be equal to Z/2Z *
Z/3Z I end up with something different, isn't that a more important
problem ?

Right now, when I create MY group by writing is as I want as a
product, I have to call __repr__ to see what it accepts as input. If a
function built the group I can do the same, can't I ?

Come on guys... Don't tell me that creating a group as a product and
not even knowing how to convert a tuple to an element of my group is
not a problem ! This vector trick is nice, but you can't expect
anybody to figure it out immediately, and clearly the default
behaviour is not the right one !

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread John Cremona
On 28 April 2014 11:18, Nathann Cohen  wrote:

> > Thats it.
>
> The syntax is awful, do we agree on that ?
>
> > -1, some method returns an abelian group and you don't know how it was
> > constructed without having to dig around.
>
> ?
>
> But when I create a group by myself which I want to be equal to Z/2Z *
> Z/3Z I end up with something different, isn't that a more important
> problem ?
>
> Right now, when I create MY group by writing is as I want as a
> product, I have to call __repr__ to see what it accepts as input. If a
> function built the group I can do the same, can't I ?
>
> Come on guys... Don't tell me that creating a group as a product and
> not even knowing how to convert a tuple to an element of my group is
> not a problem ! This vector trick is nice, but you can't expect
> anybody to figure it out immediately, and clearly the default
> behaviour is not the right one !
>
>
I agree there.   The fact that Z/2 x Z/3 is isomorphic ot Z/6 does not make
them the same group.  We should allow construction of such a group (f.g.
abelian) without standardising  anything, at least as far as the
input/output interface with the user who has constructed the group is
concerned.  (There can be an internal standardised model of the group, for
sure).  The user can ask for the standard model, which would return a new
group together with morphisms both ways.

The situation is surely the same as this:  If I define a number fields with
the polynomial x^2-8 I would be unhappy if Sage decided that
Q(sqrt(8))=Q(sqrt(2)) and hence gave a field whose generator satisfied
x^2-2 instead, even if that is more standard.  Here we have the same
abstract field but different generators for it as a Q-algebra, and we can
do this sort of thing:

sage: K1. = NumberField(x^2-2)
sage: K2. = NumberField(x^2-8)
sage: K1==K2
False
sage: K1.is_isomorphic(K2)
True
sage: Hom(K1,K2)
Set of field embeddings from Number Field in a with defining polynomial x^2
- 2 to Number Field in b with defining polynomial x^2 - 8
sage: len(Hom(K1,K2))
2
sage: f = Hom(K1,K2)[0]
sage: f
Ring morphism:
  From: Number Field in a with defining polynomial x^2 - 2
  To:   Number Field in b with defining polynomial x^2 - 8
  Defn: a |--> 1/2*b
sage:

John




> Nathann
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
On Monday, April 28, 2014 11:18:09 AM UTC+1, Nathann Cohen wrote:> Thats 
it. 
>
> The syntax is awful, do we agree on that ? 
>

Its always going to be somewhat confusing to have both the original 
definition and a canonical form around. Feel free to add more descriptive 
construction methods for elements. The ctor argument convention is because 
that was chosen originally and I didn't want to break code when refactoring 
it for libgap.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-28 Thread Nathann Cohen
Helloo !!!
 

> I think this is right. Allocating & copying such a huge matrix repeatedly 
> would be terrible. Perhaps we should introduce an API function to 
> "add_constraints", which takes a list of lists, or a matrix? If a solver 
> doesn't support such a thing, we could fall back on the brute force method.
>

I am almost sure that all solvers support that. Some "allocate new 
constraints" function that would just be called befre creating the actual 
constraints :-)

Nathann 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> Its always going to be somewhat confusing to have both the original
> definition and a canonical form around. Feel free to add more descriptive
> construction methods for elements. The ctor argument convention is because
> that was chosen originally and I didn't want to break code when refactoring
> it for libgap.

What do you think the implications of the following changes would be ?

-if isinstance(x, (list,tuple)):
-try:
-x = self.optimized()[0].V().linear_combination_of_basis(x)
-except ValueError as msg:
-raise TypeError(msg)
-elif isinstance(x, FGP_Element):
+if isinstance(x, FGP_Element):
 x = x.lift()
 return self.element_class(self, self._V(x))

This changes the codes that appears in :

sage: g=groups.misc.AdditiveAbelian([4,3,3,5])
sage: g._element_constructor??

The thing is that I really know nothing about groups, nothing about
their implementation in Sage, and that I have no idea what the impact
of such changes can be  :-/

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread John Cremona
I don't think that will work if you are relying on the error message to
indicate the wrong length of input.  For example:

sage: AdditiveAbelianGroup([6,2])
Additive abelian group isomorphic to Z/2 + Z/6

Now you will expect the element (1,0) to have order 6 but it has order 2.

John


On 28 April 2014 14:09, Nathann Cohen  wrote:

> > Its always going to be somewhat confusing to have both the original
> > definition and a canonical form around. Feel free to add more descriptive
> > construction methods for elements. The ctor argument convention is
> because
> > that was chosen originally and I didn't want to break code when
> refactoring
> > it for libgap.
>
> What do you think the implications of the following changes would be ?
>
> -if isinstance(x, (list,tuple)):
> -try:
> -x = self.optimized()[0].V().linear_combination_of_basis(x)
> -except ValueError as msg:
> -raise TypeError(msg)
> -elif isinstance(x, FGP_Element):
> +if isinstance(x, FGP_Element):
>  x = x.lift()
>  return self.element_class(self, self._V(x))
>
> This changes the codes that appears in :
>
> sage: g=groups.misc.AdditiveAbelian([4,3,3,5])
> sage: g._element_constructor??
>
> The thing is that I really know nothing about groups, nothing about
> their implementation in Sage, and that I have no idea what the impact
> of such changes can be  :-/
>
> Nathann
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Running a .sage file on Windows

2014-04-28 Thread J.D. Quigley


Hello,

This is probably a very basic question, but any guidance would be 
appreciated. Is there a way to run a .sage file on Windows? I'm able to run 
.sws files by running Sage on VirtualBox and then importing the file 
through localhost:8000 (or by importing to sagenb.com), but I'm not able to 
run .sage files. I've tried running them on sagenb.com, localhost:8000, and 
by opening them from a shared drive in my virtual machine. 

Thanks!
J.D.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> I don't think that will work if you are relying on the error message to
> indicate the wrong length of input.  For example:
>
> sage: AdditiveAbelianGroup([6,2])
> Additive abelian group isomorphic to Z/2 + Z/6
>
> Now you will expect the element (1,0) to have order 6 but it has order 2.

No, this looks good !

sage: G=AdditiveAbelianGroup([6,2])
sage: G(vector([2,2]))
(2, 0)
sage: G(vector([1,0]))+G(vector([1,0]))
(2, 0)

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
On Monday, April 28, 2014 2:09:55 PM UTC+1, Nathann Cohen wrote:
>
> What do you think the implications of the following changes would be ? 
> [...]
>

I would think that this is incompatible with the current syntax. If 
anything, we should add a G.linear_combination_of_gens in addition to the 
existing G.linear_combination_of_smith_form_gens and in doubt you should 
use these over just calling G().


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> I would think that this is incompatible with the current syntax.

Yes of course, that changes the default ! But I am not so sure that it
would break many things, as the current implementation is so
unreliable that you cannot "guess" what G accepts as input, unless you
made sure to define it with a reduced form already. So I am not sure
it will break a lot of things.

>  If
> anything, we should add a G.linear_combination_of_gens in addition to the
> existing G.linear_combination_of_smith_form_gens and in doubt you should use
> these over just calling G().

I was more worried about performance issues. Really, I am not so sure
that it would break so much. Of course it means changing the default
behaviour, but who can use the default behaviour as it is ? I mean :
if you define the group from a reduced form already, then there will
be no change. And if you did not, well, you were in trouble already
because you had to first make sure that you gave the right things as
input.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
On Monday, April 28, 2014 2:59:05 PM UTC+1, Nathann Cohen wrote:
>
> > I would think that this is incompatible with the current syntax. 
> Yes of course, that changes the default


Hence it can break code that people have written privately.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> Hence it can break code that people have written privately.

I believe that not so many have written such code, for the very same
reason. But indeed if we change that we will need a deprecation step.

Don't you agree that this change would make sense ?

I just did the change I mentionned above, and run the long tests on
all files. The only doctests which broke are documentation on why you
do not get what you expect when you feed a group with a tuple.

You can see which doctests break in u/ncohen/tmp (which removes them).
Of course the documentation would have to be updated, but this
behaviour is much more natural 

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Running a .sage file on Windows

2014-04-28 Thread kcrisman


On Monday, April 28, 2014 9:21:25 AM UTC-4, J.D. Quigley wrote:
>
>
>
> Hello,
>
> This is probably a very basic question, but any guidance would be 
> appreciated. Is there a way to run a .sage file on Windows? I'm able to run 
> .sws files by running Sage on VirtualBox and then importing the file 
> through localhost:8000 (or by importing to sagenb.com), but I'm not able 
> to run .sage files. I've tried running them on sagenb.com, 
> localhost:8000, and by opening them from a shared drive in my virtual 
> machine. 
>

Hi!

.sage files are essentially scripts in the Sage variant of Python.  There 
are a few things you can do to run it.

1) Use the command-line interface on your VirtualBox installation and run 
them there (this should work the same way you import other ones).

2) Use the "Data" drop-down menu in the Sage notebook to upload the file, 
and do attach DATA+"my_file.sage" as the first cell you evaluate. 
 (Untested, you may have to not use quotes or something.)

3) Copy and paste the entire .sage file into a first cell of the worksheet 
and then do %hide at the top to 'hide' it...

I hope one of these helps.
- kcrisman

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
The default repr is in terms of smith form gens, so IMHO it makes more 
sense to default to a linear combination of smith form gens. Imagine some 
method returns an abelian group, how are you going to construct elements?


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> The default repr is in terms of smith form gens, so IMHO it makes more sense
> to default to a linear combination of smith form gens. Imagine some method
> returns an abelian group, how are you going to construct elements?

Well, obviously by changing repr, no ? O_o

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
I mean ... Really, nobody cares what the smith form generators are.
It's a technical problem, the user does not even have to be aware of
that !

Nathann

On 28 April 2014 17:19, Nathann Cohen  wrote:
>> The default repr is in terms of smith form gens, so IMHO it makes more sense
>> to default to a linear combination of smith form gens. Imagine some method
>> returns an abelian group, how are you going to construct elements?
>
> Well, obviously by changing repr, no ? O_o
>
> Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Simon King
Hi!

On 2014-04-28, Nathann Cohen  wrote:
>> The default repr is in terms of smith form gens, so IMHO it makes more sense
>> to default to a linear combination of smith form gens. Imagine some method
>> returns an abelian group, how are you going to construct elements?
>
> Well, obviously by changing repr, no ? O_o

+1.

There should of course be a command to "normalise" a product of abelian groups.
But applying this normalisation by default violates the principle of
least surprise, IMHO.

Cheers,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
On Monday, April 28, 2014 4:06:36 PM UTC+1, Nathann Cohen wrote:
>
> I believe that not so many have written such code, for the very same 
> reason. But indeed if we change that we will need a deprecation step. 
>

Moreover, how are you going to deprecate it? When is a deprecation warning 
shown?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> Moreover, how are you going to deprecate it? When is a deprecation warning
> shown?

Ahahahah. That's an interesting question, but the current way being
bad, there is absolutely no way that it will stay like that forever
just because we don't know how to tell the users :-D

I had something a bit unpleasant in mind... Just showing a deprecation
warning in this __call__ function saying that the standard WILL
change, and doing nothing... And removing the lines we need to remove
one year from now.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
To be honest, I would prefer to do the opposite. Changing it now while
printing a message saying that the format changed, and removing the
message one year  from now.

Nathann

On 28 April 2014 17:27, Nathann Cohen  wrote:
>> Moreover, how are you going to deprecate it? When is a deprecation warning
>> shown?
>
> Ahahahah. That's an interesting question, but the current way being
> bad, there is absolutely no way that it will stay like that forever
> just because we don't know how to tell the users :-D
>
> I had something a bit unpleasant in mind... Just showing a deprecation
> warning in this __call__ function saying that the standard WILL
> change, and doing nothing... And removing the lines we need to remove
> one year from now.
>
> Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread John H Palmieri
Here's something I find really confusing about additive abelian groups:

sage: H = AdditiveAbelianGroup([0,2])
sage: H((2,0))
(0, 0)
sage: H(vector((2,0)))
(2, 0)

sage: H((1,0)).order()
2
sage: H(vector((1,0))).order()
+Infinity

This is terrible, and a symptom of what Nathann wants to fix. It should be 
fixed.

  John



On Monday, April 28, 2014 8:27:45 AM UTC-7, Nathann Cohen wrote:
>
> > Moreover, how are you going to deprecate it? When is a deprecation 
> warning 
> > shown? 
>
> Ahahahah. That's an interesting question, but the current way being 
> bad, there is absolutely no way that it will stay like that forever 
> just because we don't know how to tell the users :-D 
>
> I had something a bit unpleasant in mind... Just showing a deprecation 
> warning in this __call__ function saying that the standard WILL 
> change, and doing nothing... And removing the lines we need to remove 
> one year from now. 
>
> Nathann 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
> Showing a deprecation warning for valid input isn't ideal ;-)

Indeed, indeed. Right now it prints the following input, which I hope
will be taken seriously by those who should, and be ignored by those
who should :

sage: x = A([5]); x
doctest:1: DeprecationWarning: The default behaviour changed ! If you
*really* want a linear combination of smith generators, use
.linear_combination_of_smith_form_gens.
See http://trac.sagemath.org/16261 for details.

> How about we deprecate all list/tuple input and force the user to use
> G.linear_combination_of_smith_form_gens / G.linear_combination_of_gens.

Well... It's more proper, but it does look a bit too extreme... :-/

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
Hello guys !

I just created ticket #16261 about this and uploaded my branch. It's
funny that to make all tests pass I only had to add four
"linear_combination_of_smith_form_gens"...

Now the problem is that I have no idea how to change .short_name()
(which is called by __repr__), as I have no idea how to get back the
signature of the abelian group. The one which is used by the elements
^^;

If anybody can help me there, or take a technical look at this patch.
I am afraid that I really know next to nothing about all the
math/programming involved there.

Nathann

On 28 April 2014 17:36, John H Palmieri  wrote:
> Here's something I find really confusing about additive abelian groups:
>
> sage: H = AdditiveAbelianGroup([0,2])
> sage: H((2,0))
> (0, 0)
> sage: H(vector((2,0)))
> (2, 0)
>
> sage: H((1,0)).order()
> 2
> sage: H(vector((1,0))).order()
> +Infinity
>
> This is terrible, and a symptom of what Nathann wants to fix. It should be
> fixed.
>
>   John
>
>
>
>
> On Monday, April 28, 2014 8:27:45 AM UTC-7, Nathann Cohen wrote:
>>
>> > Moreover, how are you going to deprecate it? When is a deprecation
>> > warning
>> > shown?
>>
>> Ahahahah. That's an interesting question, but the current way being
>> bad, there is absolutely no way that it will stay like that forever
>> just because we don't know how to tell the users :-D
>>
>> I had something a bit unpleasant in mind... Just showing a deprecation
>> warning in this __call__ function saying that the standard WILL
>> change, and doing nothing... And removing the lines we need to remove
>> one year from now.
>>
>> Nathann
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/yexpjig9BSg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Volker Braun
Showing a deprecation warning for valid input isn't ideal ;-)

How about we deprecate all list/tuple input and force the user to use 
G.linear_combination_of_smith_form_gens / G.linear_combination_of_gens.

 

On Monday, April 28, 2014 4:27:45 PM UTC+1, Nathann Cohen wrote:
>
> > Moreover, how are you going to deprecate it? When is a deprecation 
> warning 
> > shown? 
>
> Ahahahah. That's an interesting question, but the current way being 
> bad, there is absolutely no way that it will stay like that forever 
> just because we don't know how to tell the users :-D 
>
> I had something a bit unpleasant in mind... Just showing a deprecation 
> warning in this __call__ function saying that the standard WILL 
> change, and doing nothing... And removing the lines we need to remove 
> one year from now. 
>
> Nathann 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
Ahahaah. While writing that code, I met an infinite loop. Apparently
testing if an element of a group is equal to +infinity calls
__repr__... :-P

Nathann

On 28 April 2014 18:16, Nathann Cohen  wrote:
>> Showing a deprecation warning for valid input isn't ideal ;-)
>
> Indeed, indeed. Right now it prints the following input, which I hope
> will be taken seriously by those who should, and be ignored by those
> who should :
>
> sage: x = A([5]); x
> doctest:1: DeprecationWarning: The default behaviour changed ! If you
> *really* want a linear combination of smith generators, use
> .linear_combination_of_smith_form_gens.
> See http://trac.sagemath.org/16261 for details.
>
>> How about we deprecate all list/tuple input and force the user to use
>> G.linear_combination_of_smith_form_gens / G.linear_combination_of_gens.
>
> Well... It's more proper, but it does look a bit too extreme... :-/
>
> Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Eigenvalues of QQ-matrix, "magic limit"?

2014-04-28 Thread Nils Bruin
On Monday, April 28, 2014 12:56:48 AM UTC-7, jori.ma...@uta.fi wrote:
>
> It takes less than two minutes to run 
>
> ./sage -c "n=121; l=range(1,n+1); x=matrix([[floor(n/lcm(i,j)) for i in l] 
> for j in l]).eigenvalues();" 
>
> But with n=122 calculation seems to get stuck. 
>
> Well, 122=61*2, so maybe it's because of a big factor? However, n=118=59*2 
> takes only about a minute. And n=123 takes less than one minute, so the 
> size of the matrix is not a problem in itself. 
>

Nor is computing the characteristic polynomial. Note that `eigenvalues` 
returns its answer in the "field of algebraic numbers". Equality testing is 
notoriously difficult there, and since the characteristic polynomials of 
your matrices are not square-free, you will run into some nasty 
comparisons. The fact that the code finishes for n=121 is pretty good!

sage: n=122
sage: l=range(1,n+1); M=matrix([[floor(n/lcm(i,j)) for i in l] for j in l])
sage: f=M.characteristic_polynomial()
sage: x=flatten([[a.roots(QQbar,multiplicities=False)]*d for a,d in 
factor(f)])

works pretty quickly.

Upon inspection, it turns out that M.eigenvalues does something like that, 
but via a much less efficient route. The implementation can probably be 
streamlined considerably.

In reality, there's probably never a compelling reason to work with the 
eigenvalues of a matrix as explicit algebraic numbers. Either you need 
their embedding in CC, in which case a numerical approximation should 
suffice, or you need their algebraic properties, in which case the 
factorization of the characteristic polynomial over the base ring probably 
gives you the information you need.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
The current branch passes all tests in groups/ and modules/fg_pid/ :-)

Needs review !

Nathann

On 28 April 2014 18:29, Nathann Cohen  wrote:
> Ahahaah. While writing that code, I met an infinite loop. Apparently
> testing if an element of a group is equal to +infinity calls
> __repr__... :-P
>
> Nathann
>
> On 28 April 2014 18:16, Nathann Cohen  wrote:
>>> Showing a deprecation warning for valid input isn't ideal ;-)
>>
>> Indeed, indeed. Right now it prints the following input, which I hope
>> will be taken seriously by those who should, and be ignored by those
>> who should :
>>
>> sage: x = A([5]); x
>> doctest:1: DeprecationWarning: The default behaviour changed ! If you
>> *really* want a linear combination of smith generators, use
>> .linear_combination_of_smith_form_gens.
>> See http://trac.sagemath.org/16261 for details.
>>
>>> How about we deprecate all list/tuple input and force the user to use
>>> G.linear_combination_of_smith_form_gens / G.linear_combination_of_gens.
>>
>> Well... It's more proper, but it does look a bit too extreme... :-/
>>
>> Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nils Bruin
On Monday, April 28, 2014 9:14:17 AM UTC-7, Volker Braun wrote:
>
> Showing a deprecation warning for valid input isn't ideal ;-)
>
> How about we deprecate all list/tuple input and force the user to use 
> G.linear_combination_of_smith_form_gens / G.linear_combination_of_gens.
>

list input is actually an inverse to list output:

sage: G=AdditiveAbelianGroup([2,3])
sage: list(G.0)
[3]
sage: list(G.1)
[2]
sage: g.lift()
(1, 0)
sage: G.0.lift()
(1, 0)
sage: G.1.lift()
(0, 1)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
Hello again !

This time the branch passes all long tests in src/ except one, and I need
your advice. Here is the problem :

**
File "chain_complex.py", line 738, in
sage.homology.chain_complex.ChainComplex_class.grading_group
Failed example:
C = ChainComplex(grading_group=G, degree=G([1,2]))
Expected nothing
Got:
doctest:1: DeprecationWarning: The default behaviour changed ! If you
*really* want a linear combination of smith generators, use
.linear_combination_of_smith_form_gens.
See http://trac.sagemath.org/16261 for details.
**

1) The warning is not very meaningful as the user never called G.__call__
explicitly, and has no idea what the problem could  be
2) I cannot change the code of ChainComplex to call G(vector(x)) instead of
G(x) as AdditiveAbelianGroup is not the only group that ChainComplex works
on (and wrapping does not work for all groups)

S, well... My way of doing things would be "let's consider that this
G(x) has been broken all along, and because we are fixing a bug there is no
need to display a warning at all".

On the other hand, Volker would prefer to have a
".linear_combination_of_gens()" function to  go with the current
".linear_combination_of_smith_form_gens()" so that we could say to all
users "Don't use G(x), call one of the two .linear_combination* functions
instead".

I do not like  this, because it feels like shooting at one's foot to stop
using G(x) for one year just because it had a weird syntax before.

And besides, having a new function like that would not solve the
problem above with ChainComplex.

Well, what do you think guys ?

I pushed the branch in #16261 if you want to give it a try.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to see (1,1,1,1) as an element of Z/3Z x Z/2Z x Z/2Z x Z/2Z ?

2014-04-28 Thread Nathann Cohen
Turns out that I am an idiot, and that the warning is triggered by the
"degree=G([1,2])"
part of the expression I had overlooked. The branch now passes all tests,
and is in needs_review.

The only thing that  needs to be discussed is this warning problem, and
whether we should create a new function (or just add in the warning that
the users should use G(vector(x)) instead of G(x), which removes the
warning too).

Nathann


On 28 April 2014 20:38, Nathann Cohen  wrote:

> Hello again !
>
> This time the branch passes all long tests in src/ except one, and I need
> your advice. Here is the problem :
>
> **
> File "chain_complex.py", line 738, in
> sage.homology.chain_complex.ChainComplex_class.grading_group
> Failed example:
> C = ChainComplex(grading_group=G, degree=G([1,2]))
> Expected nothing
> Got:
>
> doctest:1: DeprecationWarning: The default behaviour changed ! If you
> *really* want a linear combination of smith generators, use
> .linear_combination_of_smith_form_gens.
> See http://trac.sagemath.org/16261 for details.
> **
>
> 1) The warning is not very meaningful as the user never called G.__call__
> explicitly, and has no idea what the problem could  be
> 2) I cannot change the code of ChainComplex to call G(vector(x)) instead
> of G(x) as AdditiveAbelianGroup is not the only group that ChainComplex
> works on (and wrapping does not work for all groups)
>
> S, well... My way of doing things would be "let's consider that this
> G(x) has been broken all along, and because we are fixing a bug there is no
> need to display a warning at all".
>
> On the other hand, Volker would prefer to have a
> ".linear_combination_of_gens()" function to  go with the current
> ".linear_combination_of_smith_form_gens()" so that we could say to all
> users "Don't use G(x), call one of the two .linear_combination* functions
> instead".
>
> I do not like  this, because it feels like shooting at one's foot to stop
> using G(x) for one year just because it had a weird syntax before.
>
> And besides, having a new function like that would not solve the
> problem above with ChainComplex.
>
> Well, what do you think guys ?
>
> I pushed the branch in #16261 if you want to give it a try.
>
> Nathann
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Eigenvalues of QQ-matrix, "magic limit"?

2014-04-28 Thread Dima Pasechnik
On 2014-04-28, Nils Bruin  wrote:
> On Monday, April 28, 2014 12:56:48 AM UTC-7, jori.ma...@uta.fi wrote:
>>
>> It takes less than two minutes to run 
>>
>> ./sage -c "n=121; l=range(1,n+1); x=matrix([[floor(n/lcm(i,j)) for i in l] 
>> for j in l]).eigenvalues();" 
>>
>> But with n=122 calculation seems to get stuck. 
>>
>> Well, 122=61*2, so maybe it's because of a big factor? However, n=118=59*2 
>> takes only about a minute. And n=123 takes less than one minute, so the 
>> size of the matrix is not a problem in itself. 
>>
>
> Nor is computing the characteristic polynomial. Note that `eigenvalues` 
> returns its answer in the "field of algebraic numbers". Equality testing is 
> notoriously difficult there, and since the characteristic polynomials of 
> your matrices are not square-free, you will run into some nasty 
> comparisons. The fact that the code finishes for n=121 is pretty good!
>
> sage: n=122
> sage: l=range(1,n+1); M=matrix([[floor(n/lcm(i,j)) for i in l] for j in l])
> sage: f=M.characteristic_polynomial()
> sage: x=flatten([[a.roots(QQbar,multiplicities=False)]*d for a,d in 
> factor(f)])
>
> works pretty quickly.
>
> Upon inspection, it turns out that M.eigenvalues does something like that, 
> but via a much less efficient route. The implementation can probably be 
> streamlined considerably.
>
> In reality, there's probably never a compelling reason to work with the 
> eigenvalues of a matrix as explicit algebraic numbers. Either you need 
> their embedding in CC, in which case a numerical approximation should 
> suffice, or you need their algebraic properties, in which case the 
> factorization of the characteristic polynomial over the base ring probably 
> gives you the information you need.
>
Well, one might want to simultaneosuly diagonalise a bunch of
commuting matrices with entries in ZZ, and use their eigenvalues for some exact
computation. That's what people who work with association schemes do
quite a bit.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How can I see GF(8,'x') x Z/3Z as an additive group ?

2014-04-28 Thread Dima Pasechnik
On 2014-04-28, Nathann Cohen  wrote:
> Hello everybody !
>
> I need to use the elements of GF(8,'x') x Z/3Z as an additive group. Is
> there a way to do this with Sage ? I need that to add more combinatorial
> designs :-)
Do you need multiplication in GF(8)? If not, you can just construct
the corresponding abelian group (Z/2Z)^3 x Z/3Z directly.

>
> Thanks !
>
> Nathann
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Eigenvalues of QQ-matrix, "magic limit"?

2014-04-28 Thread William Stein
On Mon, Apr 28, 2014 at 11:55 AM, Dima Pasechnik  wrote:
> On 2014-04-28, Nils Bruin  wrote:
>> On Monday, April 28, 2014 12:56:48 AM UTC-7, jori.ma...@uta.fi wrote:
>>>
>>> It takes less than two minutes to run
>>>
>>> ./sage -c "n=121; l=range(1,n+1); x=matrix([[floor(n/lcm(i,j)) for i in l]
>>> for j in l]).eigenvalues();"
>>>
>>> But with n=122 calculation seems to get stuck.
>>>
>>> Well, 122=61*2, so maybe it's because of a big factor? However, n=118=59*2
>>> takes only about a minute. And n=123 takes less than one minute, so the
>>> size of the matrix is not a problem in itself.
>>>
>>
>> Nor is computing the characteristic polynomial. Note that `eigenvalues`
>> returns its answer in the "field of algebraic numbers". Equality testing is
>> notoriously difficult there, and since the characteristic polynomials of
>> your matrices are not square-free, you will run into some nasty
>> comparisons. The fact that the code finishes for n=121 is pretty good!
>>
>> sage: n=122
>> sage: l=range(1,n+1); M=matrix([[floor(n/lcm(i,j)) for i in l] for j in l])
>> sage: f=M.characteristic_polynomial()
>> sage: x=flatten([[a.roots(QQbar,multiplicities=False)]*d for a,d in
>> factor(f)])
>>
>> works pretty quickly.
>>
>> Upon inspection, it turns out that M.eigenvalues does something like that,
>> but via a much less efficient route. The implementation can probably be
>> streamlined considerably.
>>
>> In reality, there's probably never a compelling reason to work with the
>> eigenvalues of a matrix as explicit algebraic numbers. Either you need
>> their embedding in CC, in which case a numerical approximation should
>> suffice, or you need their algebraic properties, in which case the
>> factorization of the characteristic polynomial over the base ring probably
>> gives you the information you need.
>>
> Well, one might want to simultaneosuly diagonalise a bunch of
> commuting matrices with entries in ZZ, and use their eigenvalues for some 
> exact
> computation. That's what people who work with association schemes do
> quite a bit.

That's also what people who work with modular forms do a lot too.
There's some  nontrivial code behind the scenes in Sage for
modular-forms applications for this sort of thing.   One wants to do
commutative algebra and never work with QQbar explicitly, if at all
possible, and also start by writing the module you're acting on as a
direct sum of indecomposables.   It's really fun.


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How can I see GF(8,'x') x Z/3Z as an additive group ?

2014-04-28 Thread Nathann Cohen
Yes I do need the multiplication too. I am implementing constructions of
MOLS and for some of them I need to do some computations on a field, then
give everything to a function that needs group elements as input... So I
need it to be a group and also to see this as a field. Can we do that in
Sage ? Nathann

On Monday, 28 April 2014, Dima Pasechnik  wrote:

> On 2014-04-28, Nathann Cohen >
> wrote:
> > Hello everybody !
> >
> > I need to use the elements of GF(8,'x') x Z/3Z as an additive group. Is
> > there a way to do this with Sage ? I need that to add more combinatorial
> > designs :-)
> Do you need multiplication in GF(8)? If not, you can just construct
> the corresponding abelian group (Z/2Z)^3 x Z/3Z directly.
>
> >
> > Thanks !
> >
> > Nathann
> >
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/DWfgVrFug38/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com .
> To post to this group, send email to 
> sage-support@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How can I see GF(8,'x') x Z/3Z as an additive group ?

2014-04-28 Thread Dima Pasechnik
On 2014-04-28, Nathann Cohen  wrote:
> Yes I do need the multiplication too. I am implementing constructions of
> MOLS and for some of them I need to do some computations on a field, then
> give everything to a function that needs group elements as input... So I
> need it to be a group and also to see this as a field. Can we do that in
> Sage ? Nathann

probably it's easiest to implement the multiplication action on tuples
directly, by contructing the corresponing matrices.
Here is how. (it's probably 15-20 lines of Sage code :/) 
The multiplicative group is cyclic, and let's assume
that you have the primitive element, i.e. the generator of this cyclic
group. Usually it is the variable used in contruction.

sage: f.=GF(8)
sage: a.multiplicative_order()
7

(or you can take f.primitive_element() for this)
 
You can assume that the basis elements e_0,...,e_{k-1} of your additive group,
(Z/pZ)^k, are a^0, a^1, ..., a^(k-1). (in our example p=2, k=3)
Now you know that mupltplication of e_j by a is just e_{j+1}, 
for j
> On Monday, 28 April 2014, Dima Pasechnik  wrote:
>
>> On 2014-04-28, Nathann Cohen >
>> wrote:
>> > Hello everybody !
>> >
>> > I need to use the elements of GF(8,'x') x Z/3Z as an additive group. Is
>> > there a way to do this with Sage ? I need that to add more combinatorial
>> > designs :-)
>> Do you need multiplication in GF(8)? If not, you can just construct
>> the corresponding abelian group (Z/2Z)^3 x Z/3Z directly.
>>
>> >
>> > Thanks !
>> >
>> > Nathann
>> >
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-support" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-support/DWfgVrFug38/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sage-support+unsubscr...@googlegroups.com .
>> To post to this group, send email to 
>> sage-support@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/sage-support.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.