Re: [sage-support] libSingular multiple return values are lost.

2015-08-06 Thread 'Martin Albrecht' via sage-support
Hi,

On Wednesday 05 Aug 2015 23:35:26 Kwankyu wrote:
> Hi,
> 
> I am learning to use the libSingular interface to use Singular functions in
> Sage. I have two questions.
> 
> (1) My Singular procedures return multiple values, but my Sage function
> wrapping the procedure (via "singular_function")  seems to lose the values
> except the first one. Is this a bug or a limitation?

I had no idea Singular would support multiple return values. We could support 
this by turning them into tuples.

> (2) My Singular procedures do not need a ring (they internally construct
> rings) as input, but my Sage function wrapping the procedure raises an
> error if I do not specify a ring (via ring=...). I can use a dummy for
> this, but this does not look elegant. Is there a way to avoid constructing
> a dummy ring in this situation?

We could do this:

- if no ring is given we try to find one as we do currently.
- if that fails because the inputs are not polynomials of any kind, we could 
use a dummy ring ?

Cheers,
Martin

> Thank you in advance. Anyway, this libSingular interface is brilliant!
-- 
.www: https://martinralbrecht.wordpress.com
.pgp: 40BC 7F0D 724B 4AB1 CC98 4014 A040 043C 6532 AFB4
.xmpp: martinralbre...@jabber.ccc.de
.twitter: https://twitter.com/martinralbrecht
.keybase: https://keybase.io/martinralbrecht

-- 
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] CryptoMiniSat package

2015-05-14 Thread Martin Albrecht
Hi,

see here:

http://doc.sagemath.org/html/en/reference/sat/index.html#solvers

sage: from sage.sat.solvers.dimacs import DIMACS
sage: fn = tmp_filename()
sage: solver = DIMACS(filename=fn)
sage: solver.add_clause( ( 1,  2,  3) )
sage: solver.add_clause( ( 1,  2, -3) )
sage: _ = solver.write()
sage: for line in open(fn).readlines():
:print line,
p cnf 3 2
1 2 3 0
1 2 -3 0

or simpler:

sage: from sage.sat.solvers.dimacs import DIMACS
sage: fn = tmp_filename()
sage: solver = DIMACS()
sage: solver.add_clause( ( 1,  2,  3) )
sage: solver.add_clause( ( 1,  2, -3) )
sage: solver.clauses(fn)
sage: for line in open(fn).readlines():
:print line,
p cnf 3 2
1 2 3 0
1 2 -3 0

On Thursday 14 May 2015 00:44:41 Alan Chee wrote:
> Hi all!,
> 
> I downloaded the CryptoMiniSat package from
> http://www.sagemath.org/packages/optional/ and I hope to save the CNF
> clauses derived from a polynomial system to a file. I
> did the following:
> 
> sage: from sage.sat.converters.polybori import CNFEncoder
> sage: from sage.sat.solvers import CryptoMiniSat
> sage: cms = CryptoMiniSat()
> 
> sage: fn = tmp_filename()
> sage: phi = CNFEncoder(cms,R)
> sage: phi(F) # F is a system of Booleanpolynomials
> 
> However, there is no 'clauses' attribute for the cms object for sage 5.7.
> Is there any way to write the CNFs to a file?
> Thanks in advance!
> 
> Alan

-- 
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] I.variety() and polynomial order

2015-04-20 Thread Martin Albrecht
Hi Peter,

variety() calls triangular_decomposition() which indeed changes the term 
ordering for you if required:

# make sure to work w.r.t. 'lex'
if P.term_order() != 'lex':
Q = P.change_ring(order='lex')
else:
Q = P

So the documentation should be updated.

Cheers,
Martin

On Monday 20 Apr 2015 06:21:21 Peter Mueller wrote:
> Dear All,
> 
> let I be an ideal of  a polynomial ring. Then, according to the doc,
> I.variety() expects the underlying polynomial ring to have lexicographic
> order. However, no error is raised if the polynomial order is a different
> one (degrevlex in my case). Does it mean that internally a Groebner basis
> is computed with respect to the lex order, no matter what the original
> order was?
> 
> I looked at the code for variety(), but wasn't able to quickly recognize
> the behavior of this method.
> 
> The reason that I looked at the doc of variety() at all was that I came
> across a case where points were missing. It was a complicated situation, so
> I'm not quite sure that this is due to variety() giving wrong results if
> the polynomial order isn't lex, or if I made a mathematical or programming
> error somewhere.
> 
> Anyway, if variety() works for any polynomial order, then the doc should
> tell so. And if it does not, then using the method should raise an error
> rather than returning an unreliable answer.
> 
> Best wishes,
> Peter Mueller

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

2015-04-20 Thread Martin Albrecht
Hi,

$ sage -i cryptominisat && sage -b

should do the trick.

Cheers,
Martin

On Monday 20 Apr 2015 07:01:00 Dibyendu Roy wrote:
> Dear Members,
> 
> I want to install CryptoMiniSat 2.9.9. I have downloaded the latest file
> from https://gforge.inria.fr/frs/?group_id=1992. Could you please tell me
> the procedure of installation. I am using sage 6.4.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] F,s = sr.polynomial_system(P,K) for SR(5,2,2,4)

2015-03-17 Thread Martin Albrecht
You are not getting this error message on these commands, right? For future 
reference, please always include a small example how to trigger a potential 
bug, otherwise we can't help you. 

It seems, though, that you're passing a 32 entry list to a function which 
expects 2*2*4 = 16 entry lists.

Cheers,
Martin

On Tuesday 17 Mar 2015 02:01:14 Joe Ouni wrote:
> thank you for your reply
> 
> I get the following error :
> a matrix from Full MatrixSpace of 4 by 1 dense matrices over Finite Field
> in a of size 2^8 cannot be converted to a matrix in Full MatrixSpace of 2
> by 2 dense matrices over Finite Field in a of size 2^8!
> 
> the following does not work too :
> 
> 1. sage: P = sr.random_element()
> sage: K = sr.random_element()
> 
> 2. sage: P = '3243f6a8885a308d313198a2e0370734'
> sage: K = '2b7e151628aed2a6abf7158809cf4f3c'
> 
> On Monday, March 16, 2015 at 11:59:52 PM UTC+1, Martin Albrecht wrote:
> > On Monday 16 Mar 2015 12:45:07 Joe Ouni wrote:
> > > Hello ,
> > > 
> > > The following SR (2,1,1,4) worked fine.
> > > 
> > > sage: sr = SR(2,1,1,4,star=True,aes_mode=True,
> > > gf2=True,allow_zero_inversions = True)
> > > sage: P = sr.vector([0, 0, 1, 0])
> > > 
> > > sage: K = sr.vector([1, 0, 0, 1])
> > > sage: C = sr(P,K)
> > > sage: load mpolynomialsystem.py
> > > sage: F,s = sr.polynomial_system(P,K)
> > > 
> > > but when I try the same for SR (5,2,2,8) does not work.
> > > I tried using
> > > sage: P = sr.vector([0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0,
> > 
> > 0,
> > 
> > > 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1])
> > > 
> > > sage: K = sr.vector([1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1,
> > 
> > 0,
> > 
> > > 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0])
> > 
> > What error are you seeing?
> > 
> > > I need it for my work absolutely.
> > > Thanks in advance

-- 
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] F,s = sr.polynomial_system(P,K) for SR(5,2,2,4)

2015-03-16 Thread Martin Albrecht
On Monday 16 Mar 2015 12:45:07 Joe Ouni wrote:
> Hello ,
> 
> The following SR (2,1,1,4) worked fine.
> 
> sage: sr = SR(2,1,1,4,star=True,aes_mode=True,
> gf2=True,allow_zero_inversions = True)
> sage: P = sr.vector([0, 0, 1, 0])
> 
> sage: K = sr.vector([1, 0, 0, 1])
> sage: C = sr(P,K)
> sage: load mpolynomialsystem.py
> sage: F,s = sr.polynomial_system(P,K)
> 
> but when I try the same for SR (5,2,2,8) does not work.
> I tried using
> sage: P = sr.vector([0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0,
> 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1])
> 
> sage: K = sr.vector([1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0,
> 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0])

What error are you seeing?
 
> I need it for my work absolutely.
> Thanks in advance

-- 
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] m4rie build error on debian wheezy 7.8.0

2015-03-08 Thread Martin Albrecht
Hi,

it seems you're running into a compiler bug:

libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./m4rie -I/home/alwi-
wheezy/sage-6.5/local/include -I/include -mmmx -msse -msse2 -msse3 -O2 -fPIC -
Wall -pedantic -g -I/home/alwi-wheezy/sage-6.5/local/include -MT 
m4rie/conversion_cling16.lo -MD -MP -MF m4rie/.deps/conversion_cling16.Tpo -c 
m4rie/conversion_cling16.c  -fPIC -DPIC -o m4rie/.libs/conversion_cling16.o
gcc: internal compiler error: Killed (program cc1)

I'm not sure there's much we can do. You could try a different compiler (?)

On Friday 06 Mar 2015 23:16:49 smkitalkas...@gmail.com wrote:
> I have a problem building sage 6.5, especially for m4rie spkg, other
> packages seems normal. Log attached.

-- 
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 convert from PolynomialSequence to DIMAC format

2015-01-28 Thread Martin Albrecht
Hi,

try:

http://www.sagemath.org/doc/reference/sat/

Cheers,
Martin

PS: it's the first hit on Google when you search for "PolynomialSequence 
DIMACS Sage". Just saying.

On Wednesday 28 Jan 2015 12:57:21 Juan Grados wrote:
> Dears members,
> I have a object PolynomialSequence in ANF.
> 
> PF = PolynomialSequence(total_polynomials, cipherSimon.RR)
> 
> I need output this PF object in DIMAC format file. Could you help me please?

-- 
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] Sage LLL differs from PARI/gp

2015-01-05 Thread Martin Albrecht
sage: gp.qflll?
Type:   GpFunction
String form:qflll
File:   /opt/sage-devel/local/lib/python2.7/site-
packages/sage/interfaces/gp.py
Definition: gp.qflll(self, *args, **kwds)
Docstring:
qflll(x,{flag=0}): LLL reduction of the vectors forming the matrix x
(gives the unimodular transformation matrix T such that x*T is LLL-
reduced). flag is optional, and can be 0: default, 1: assumes x is
integral, 2: assumes x is integral, returns a partially reduced basis,
4: assumes x is integral, returns [K,T] where K is the integer kernel
of x and T the LLL reduced image, 5: same as 4 but x may have
polynomial coefficients, 8: same as 0 but x may have polynomial
coefficients.

Pari returns the transformation matrix not the reduced basis.

Cheers,
Martin

On Monday 05 Jan 2015 09:23:03 Ralf Stephan wrote:
> Hello,
> why do Pari and Sage give wildly different results:
> 
> sage: A = matrix(ZZ, [[0,1,3,14],[1,3,14,59],[3,14,59,247],[14,59,247,988]])
> sage: gp.qflll(A)
> [-5, 1, 30, -23; -3, 4, 18, -28; 1, -1, -10, 12; 0, 0, 1, -1]
> sage: A.LLL()
> [ 0  0  2  0]
> [ 1 -1  0  3]
> [ 2  3 -1  0]
> [-6  2  0  2]
> 
> and how do I get Pari's output using Sage's interface to fplll?
> (Actually I'm only interested in the first column)
> 
> Regards,

-- 
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] PB with sr.mq module

2014-11-14 Thread Martin Albrecht
Works for me:

sage: sr = mq.SR(1,1,1,4, gf2=True, polybori=True)
sage: K = sr.base_ring()
sage: a = K.gen()
sage: K = [a]
sage: P = [1]
sage: F,s = sr.polynomial_system(P=P, K=K)
sage: F.groebner_basis()
[k100, k101 + 1, k102, k103 + k003, x100 + 1, x101 + k003 + 1, x102 + k003 + 
1, x103 + k003, w100, w101, w102 + 1, w103 + k003 + 1, s000 + 1, s001 + k003, 
s002 + k003, s003 + k003 + 1, k000, k001, k002 + 1]

On Friday 14 Nov 2014 06:54:55 myshell.dub...@gmail.com wrote:
> Hi,
> 
> I'm working with Sage 6.3 on a macbook pro with OSX10.8.5.
> 
> When I use some function of the module sr.mq
> (http://www.sagemath.org/doc/reference/cryptography/sage/crypto/mq/sr.html),
> I have a bug:
> 
> sage: sr = mq.SR(1,1,1,4, gf2=True, polybori=True)
> sage: K = sr.base_ring()
> sage: K
> Finite Field in a of size 2^4
> sage: a = K.gen()
> sage: K = [a]
> sage: P = [1]
> sage: F,s = sr.polynomial_system(P=P, K=K)
> sage: F.groebner_basis()
> ---
> RuntimeError  Traceback (most recent call last)
>  in ()
> > 1 F.groebner_basis()
> 
> /usr/local/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/mult
> i_polynomial_sequence.pyc in groebner_basis(self, *args, **kwargs)
> 482 True
> 483 """
> --> 484 return self.ideal().groebner_basis(*args, **kwargs)
> 485
> 486 def monomials(self):
> 
> /usr/local/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/pbor
> i.so in sage.rings.polynomial.pbori.BooleanPolynomialIdeal.groebner_basis
> (build/cythonized/sage/rings/polynomial/pbori.cpp:33799)()
> 
> /usr/local/sage/local/lib/python2.7/site-packages/sage/ext/c_lib.so in
> sage.ext.c_lib.sig_raise_exception
> (build/cythonized/sage/ext/c_lib.c:1040)()
> 
> RuntimeError: Aborted
> 
> What the matter with this?
> 
> Thank you for your help

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Re: var() definition in finite fields

2014-09-30 Thread Martin Albrecht
Your matrix is over GF(2) not over the symbolic ring SR:

sage: m1 = SR(GF(2)(1)) * var("m1")
sage: m2 = SR(GF(2)(1)) * var("m2")
sage: m3 = SR(GF(2)(1)) * var("m3")
sage: m4 = SR(GF(2)(1)) * var("m4")

sage: q = Matrix(SR, [
[m1, m2],
[m3, m4],
])

sage: q^2
[ m1^2 + m2*m3 m1*m2 + m2*m4]
[m1*m3 + m3*m4  m2*m3 + m4^2]


On Tuesday 30 Sep 2014 08:46:42 Kim Schoener wrote:
> I'm not sure I understand fully what you're saying. I did
> 
> m1 = SR(GF(2)(1)) * var("m1")
> m2 = SR(GF(2)(1)) * var("m2")
> m3 = SR(GF(2)(1)) * var("m3")
> m4 = SR(GF(2)(1)) * var("m4")
> 
> but the Matrix definition
> 
> q = Matrix(GF(2), [
> [m1, m2],
> [m3, m4],
> ])
> 
> still results in the same error: "unable to convert x (=x1) to an integer".
> 
> How do I define a variable in the SR that I can work with? I can't seem to
> figure it out from the example you gave me.
> 
> Thank you,
> Kim
> 
> Am Dienstag, 30. September 2014 17:04:10 UTC+2 schrieb Volker Braun:
> > Anything symbolic is in the symbolic ring SR, finite field elements are in
> > GF(2). You can wrap finite field elements in the symbolic ring if you want
> > to do symbolic computations with finite field coefficients:
> > 
> > sage: SR(GF(5)(3)) * x
> > 3*x
> > sage: _ * 2
> > x
> > 
> > though the symbolic elemnts still don't know anything about finite fields,
> > they just carry the coefficients along.
> > 
> > On Tuesday, September 30, 2014 3:14:03 PM UTC+1, Kim Schoener wrote:
> >> Heya!
> >> 
> >> I want to do something relatively easy in Sage but can't figure out how.
> >> Hopefully you can help me. I want to do some symbolic operations
> >> (matrix/vector) in the GF(2). Let's start out with real numbers first:
> >> 
> >> (m1, m2, m3, m4) = (var("m1"), var("m2"), var("m3"), var("m4"))
> >> q = Matrix([
> >> 
> >> [m1, m2],
> >> [m3, m4],
> >> 
> >> ])
> >> print(q)
> >> print(q * q)
> >> 
> >> Works pefectly:
> >> 
> >> [m1 m2]
> >> [m3 m4]
> >> [ m1^2 + m2*m3 m1*m2 + m2*m4]
> >> [m1*m3 + m3*m4  m2*m3 + m4^2]
> >> 
> >> But when I try the same thing in GF(2) by definiing
> >> 
> >> q = Matrix(GF(2), [
> >> 
> >> [m1, m2],
> >> [m3, m4],
> >> 
> >> ])
> >> 
> >> I get:
> >> 
> >> [...]
> >> 
> >>   File "parent.pyx", line 1069, in sage.structure.parent.Parent.__call__
> >> 
> >> (sage/structure/parent.c:8546)
> >> 
> >>   File "coerce_maps.pyx", line 156, in
> >> 
> >> sage.structure.coerce_maps.NamedConvertMap._call_
> >> (sage/structure/coerce_maps.c:4930)
> >> 
> >>   File "expression.pyx", line 857, in
> >> 
> >> sage.symbolic.expression.Expression._integer_
> >> (sage/symbolic/expression.cpp:5877)
> >> TypeError: unable to convert x (=m1) to an integer
> >> 
> >> However, the matrix definition seems to be okay, when I do
> >> 
> >> q = Matrix(GF(2), [
> >> 
> >> [1, 1 ],
> >> [1, 0],
> >> 
> >> ])
> >> print(q * q)
> >> 
> >> I get
> >> 
> >> [0 1]
> >> [1 1]
> >> 
> >> which is what I'd expect. Why does it not work with variables when
> >> working in GF(2) and how can I get this to work the way I want it to?
> >> 
> >> Thank you so much,
> >> Regards,
> >> Kim

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Weird! OverflowError: cannot convert float infinity to integer

2014-09-22 Thread Martin Albrecht
This is a bug in Sage's finite field via NTL's GF2E implementation which is 
triggered by M4RIE:

sage: K. = GF(2^15)
sage: type(K), type(matrix(K))
(sage.rings.finite_rings.finite_field_givaro.FiniteField_givaro_with_category,
 sage.matrix.matrix_mod2e_dense.Matrix_mod2e_dense)

sage: K. = GF(2^16)
sage: type(K), type(matrix(K))
(sage.rings.finite_rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e_with_category,
 sage.matrix.matrix_mod2e_dense.Matrix_mod2e_dense)

sage: K. = GF(2^17)
sage: type(K), type(matrix(K))
(sage.rings.finite_rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e_with_category,
 sage.matrix.matrix_generic_dense.Matrix_generic_dense)

I've fixed it at:

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

Cheers,
Martin

On Saturday 20 Sep 2014 04:07:08 Volker Braun wrote:
> I still get the overflow with the m4ri update that is bound to be in
> 6.4.beta4. Martin, any ideas?
> 
> On Friday, September 19, 2014 5:25:46 AM UTC+1, Michiel Kosters wrote:
> > I have a similar bug with the following code:
> > 
> > n=16
> > F.=GF(2^n)
> > print Matrix([a]), F(0)
> > print Matrix([F(0)])
> > 
> > The last print statement gives an error OverflowError: cannot convert
> > float infinity to integer
> > For other n, the code does not give an error.
> > 
> > Yours,
> > Michiel
> > 
> > On Tuesday, July 8, 2014 10:21:06 PM UTC+8, David Hoo wrote:
> >> I happened to meet a overflow error, I install sage 6.2 both on a 64-bit
> >> macbook running MacOS 10.9 and 32-bit Dell Desktop running Ubuntu 12.04.
> >> 
> >> The error message goes like this:
> >> 
> >> OverflowError Traceback (most recent call
> >> last)
> >> 
> >>  in ()
> >> 
> >> > 1 get_ipython().magic(u'runfile DataCollecctionScript.py')
> >> 
> >> 
> >> 
> >> 
> >> /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7/si
> >> te-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
> >> 
> >> *   2163* magic_name, _, magic_arg_s = arg_s.partition(' ')
> >> 
> >> *   2164* magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
> >> 
> >> -> 2165 return self.run_line_magic(magic_name, magic_arg_s)
> >> 
> >> *   2166*
> >> 
> >> *   2167*
> >> #
> >> -
> >> 
> >> 
> >> 
> >> 
> >> /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7/si
> >> te-packages/IPython/core/interactiveshell.pyc in run_line_magic(self,
> >> magic_name, line)
> >> 
> >> *   2084* kwargs['local_ns'] = sys._getframe(stack_depth
> >> ).f_locals
> >> 
> >> *   2085* with self.builtin_trap:
> >> 
> >> -> 2086 result = fn(*args,**kwargs)
> >> 
> >> *   2087* return result
> >> 
> >> *   2088*
> >> 
> >> 
> >> 
> >> 
> >> /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7/si
> >> te-packages/sage/repl/ipython_extension.pyc in runfile(self, s)
> >> 
> >> 
> >> 
> >> 
> >> /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7/si
> >> te-packages/IPython/core/magic.pyc in (f, *a, **k)
> >> 
> >> *189* # but it's overkill for just that one bit of state.
> >> 
> >> *190* def magic_deco(arg):
> >> 
> >> --> 191 call = lambda f, *a, **k: f(*a, **k)
> >> 
> >> *
signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Question about solve_sat

2014-08-27 Thread Martin Albrecht
It means that the system is believed to be unsolvable.

On Wednesday 27 Aug 2014 13:54:47 Juan Grados wrote:
> Dear members,
> 
> I'm trying to solve the attach formulas but I get FALSE, anyone know what
> means that, or Why I get FALSE?
> 
> sage: solve_sat(PolynomialSequence(F,RR),n=infinity)
> False
> 
> thanks

-- 
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] Question about SAT solver

2014-08-12 Thread Martin Albrecht
This is a bug. In particular:

sage: S.solve(eliminate_linear_variables=False)
[{w: 0, z: 0, y: 0, x: 0}]

Does the trick. The bug is that eliminating linear variables already solves 
the problem and the logic in solve() doesn't handle this case. Please open a 
ticket and CC me.

On Tuesday 12 Aug 2014 09:01:33 Juan Grados wrote:
> Dears members,
> 
> I'm trying to understand why the solver not found solution in this code
> 
> R. = BooleanPolynomialRing()
> S = PolynomialSequence([x*y+z,x+y])
> sol = S.solve(); sol
> []
> 
> For me the solution is x=1;y=1 and z=1, or I'm wrong?
> 
> thanks

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] A possible bug in boolean polynomial

2014-08-10 Thread Martin Albrecht
Why? These are different errors. One is (probably) an integer overflow, the 
other a failure to allocate 2^30 something.

On Sunday 10 Aug 2014 04:38:52 pp wrote:
> Hi all,
> 
> Consider the following code:
> 
> NUM = 2
> R = BooleanPolynomialRing(NUM, ['x%d'%(i) for i in range(NUM)])
> expr = R('x0') + R('x1') * R('x2')
> print expr
> from sage.crypto.boolean_function import BooleanFunction
> expr2 = BooleanFunction(expr)
> print expr2.truth_table().count(False)
> 
> This code works fine. Now changing NUM to 30 and 80 respectively, I can see
> two different responses: One is MemoryError and the other is OverflowError.
> Is that a bug; I mean, aren't both of them supposed to give same kind of
> error?
> 
> Thanks.

-- 
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] Error when trying to input an 8-bit Sbox into the argument of S = mq.SBox(.)

2014-06-19 Thread Martin Albrecht
Works for me.


sage: s = range(256)
sage: S = mq.SBox(s)
sage: S
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 
129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 
159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 
174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 
189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 
204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 
219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 
234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 
249, 250, 251, 252, 253, 254, 255)
sage: shuffle(s)
sage: S = mq.SBox(s)
sage: S
(198, 15, 199, 161, 183, 147, 244, 107, 95, 14, 193, 139, 216, 231, 144, 20, 
63, 228, 46, 72, 235, 143, 169, 186, 90, 210, 121, 190, 194, 101, 10, 3, 180, 
43, 120, 42, 73, 117, 222, 254, 45, 105, 148, 109, 128, 178, 159, 8, 52, 217, 
170, 75, 2, 239, 221, 48, 140, 233, 103, 94, 245, 34, 224, 122, 208, 18, 189, 
100, 204, 85, 201, 114, 58, 12, 131, 57, 205, 206, 53, 69, 24, 214, 51, 243, 
96, 55, 184, 188, 28, 236, 29, 197, 227, 6, 7, 56, 16, 226, 154, 61, 116, 242, 
153, 157, 150, 181, 86, 44, 185, 168, 187, 74, 76, 225, 36, 156, 195, 171, 92, 
158, 155, 149, 135, 234, 249, 64, 70, 84, 127, 252, 182, 93, 237, 138, 71, 
232, 220, 47, 196, 203, 134, 27, 81, 68, 39, 41, 129, 173, 142, 118, 11, 82, 
112, 123, 30, 26, 200, 219, 50, 209, 79, 229, 31, 246, 207, 25, 124, 22, 241, 
176, 108, 179, 141, 13, 126, 247, 212, 106, 102, 165, 21, 33, 60, 104, 132, 
17, 191, 125, 174, 99, 0, 215, 97, 145, 23, 137, 83, 80, 192, 111, 177, 230, 
162, 9, 166, 146, 19, 110, 38, 255, 240, 136, 88, 4, 78, 160, 113, 119, 59, 
223, 250, 251, 62, 49, 213, 151, 89, 115, 164, 66, 248, 152, 172, 32, 238, 
211, 167, 35, 40, 175, 1, 130, 163, 77, 253, 133, 87, 91, 37, 218, 54, 98, 67, 
65, 5, 202)

On Wednesday 18 Jun 2014 17:48:59 Lei Poo wrote:
> I am also having this problem. I also tried enclosing the numbers with [ ],
> i.e. S=mq.SBox([1,2,3]) but it did not work. Does anybody know how to fix
> this?
> 
> On Saturday, December 22, 2012 9:16:31 AM UTC-8, Martin Albrecht wrote:
> > Pass a list of numbers instead of independent numbers. SBox( [1,2,3]) not
> > SBox(1,2,3)
> > 
> > sent from a telephone.
> > 
> > On 19 Dec 2012 08:17, "sea21" > wrote:
> >> Why is it that when I try to input an 8-bit Sbox into the argument of S =
> >> mq.SBox(.), I get the error: "SyntaxError: more than 255 arguments"? Does
> >> this class not work for more than 7-bit S-boxes?
> >> 
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "sage-support" group.
> >> To post to this group, send email to sage-s...@googlegroups.com
> >> .
> >> To unsubscribe from this group, send email to
> >> sage-support...@googlegroups.com .
> >> Visit this group at http://groups.google.com/group/sage-support?hl=en.

-- 
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: Sage posts "PowmInsecureWarning: Not using mpz_powm_sec." when launched

2014-06-08 Thread Martin Albrecht
On Saturday 07 Jun 2014 13:34:18 Volker Braun wrote:
> Afaik its only used in the openid module. And exploiting a timing attack
> over network is most likely not possible.

they are practical at least over LAN: 
https://crypto.stanford.edu/~dabo/papers/ssl-timing.pdf
 
> On Saturday, June 7, 2014 8:40:54 PM UTC+1, em2slyn wrote:
> > Hi All:
> > 
> > I am hosting a Sage server for our department and ever since upgrading to
> > 6.X the following message displays every time Sage is launched.
> > 
> > Executing twistd  --pidfile="sage_notebook.sagenb/sagenb.pid" -ny
> > "sage_notebook.sagenb/twistedconf.tac"
> > /home/sageserver/sage-6.2/local/lib/python2.7/site-packages/Crypto/Util/nu
> > mber.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should
> > rebuild using libgmp >= 5 to avoid timing attack vulnerability.
> > 
> >   _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to
> > 
> > avoid timing attack vulnerability.", PowmInsecureWarning)
> > .
> > .
> > .
> > 
> > I've been tracking this down and noticed there are a number of posts on
> > the web related to this warning although not specifically addressing Sage.
> > Unfortunately, some sites have provided various workarounds but I cannot
> > seem to find a resolution.
> > 
> > I am currently hosting Sage 6.2 on Ubuntu Server 12.04 and tried an
> > experimental build using Ubuntu 14.04. Initially, I installed GMP 6.0.0a
> > from gmplib.org and rebuilding Python using the command *sage -f python*
> > along with *SAGE_UPDATING=yes make*. The warning persisted. Then I did a
> > complete build from source adding libgmp-dev to the standard pool of
> > prerequisite packages. Still no luck.
> > 
> > First of all, is this a problem with Sage or the OS I've selected to use?
> > Is there a package that is missing that should be included in the build?
> > Any input would be welcome. Thank you!
> > 
> > Have a GREAT DAY!!
> > 
> > Shaun

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] enum algorithm

2014-05-26 Thread Martin Albrecht
the fpLLL docs state that CVP support is experimental and shouldn't be used 
yet. If your CVP instance is BDD (i.e. you know a bound) you could reduce it 
to uSVP e.g. like this: http://eprint.iacr.org/2013/602.pdf

On Monday 26 May 2014 12:45:55 J.A. Ketch wrote:
> for CVP the only function is L.closest_vector(t) which uses
> Miccianchio-Voulgaris algorithm. Is there also another algorithm from
> fplll?
> thanks
> 
> On Tuesday, May 13, 2014 8:37:25 PM UTC+3, Martin Albrecht wrote:
> > On Tuesday 13 May 2014 09:51:27 J.A. Ketch wrote:
> > > are the following algorithms implemented in sage?
> > > enum algorithm (for svp and cvp)
> > 
> > fpLLL has enumeration for finding the shortest vector (the code for CVP is
> > experimental according to the docs). There's a ticket on trac implementing
> > an
> > interface
> > 
> >http://trac.sagemath.org/ticket/15976
> > > 
> > > miccianchio-voulgaris algorithm(for svp and cvp)
> > 
> > The same ticket also contains code for CVP computation using Voronoi cell
> > computation (which was actually written ages ago, but never merged)
> > 
> > > thank you
> > 
> > Cheers,
> > Martin

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Can't evaluate a polynomial on a finite field if representation is not "poly"

2014-05-21 Thread Martin Albrecht
Looks like a bug, can you open a ticket?

On Monday 19 May 2014 19:13:55 Grégory Landais wrote:
> Hello,
> 
> evaluating a polynomial on a finite field does not work if the finite
> field was created with a 'repr' argument in the constructor different
> than the default one (poly).
> 
> Curently using sage 6.1.1 on ubuntu 12.04 but same behaviour in 6.2.
> 
> Here is the code that works :
> 
> sage: F.=GF(2**8)
> sage: PR.=PolynomialRing(F)
> sage: f=PR.random_element(9)
> sage: b=F.random_element()
> sage: f(b)
> a^6 + a^5 + a^4 + a^3 + a^2 + 1
> 
> 
> 
> 
> And the same code with the repr parameter changed (same behaviour with
> repr="int") :
> 
> sage: F.=GF(2**8, repr="log")
> sage: PR.=PolynomialRing(F)
> sage: f=PR.random_element(9)
> sage: b=F.random_element()
> sage: f(b)
> ---
> NameError Traceback (most recent call last)
>  in ()
> > 1 f(b)
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/rings/polynomial/polynomial_zz_pex.so in
> sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX.__call__
> (sage/rings/polynomial/polynomial_zz_pex.cpp:14427)()
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/structure/parent.so in sage.structure.parent.Parent.__call__
> (sage/structure/parent.c:8858)()
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:4206)()
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:4113)()
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/rings/finite_rings/finite_field_givaro.pyc in
> _element_constructor_(self, e) 355 2*a4^3 + 2*a4^2 + 1
> 356 """
> --> 357 return self._cache.element_from_data(e)
> 358
> 359 def gen(self, n=0):
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/rings/finite_rings/element_givaro.so in
> sage.rings.finite_rings.element_givaro.Cache_givaro.element_from_data
> (sage/rings/finite_rings/element_givaro.cpp:6459)()
> 
> /home/local/user/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-package
> s/sage/rings/finite_rings/element_givaro.so in
> sage.rings.finite_rings.element_givaro.Cache_givaro.element_from_data
> (sage/rings/finite_rings/element_givaro.cpp:5381)()
> 
>  in ()

-- 
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] enum algorithm

2014-05-13 Thread Martin Albrecht
On Tuesday 13 May 2014 09:51:27 J.A. Ketch wrote:
> are the following algorithms implemented in sage?
> enum algorithm (for svp and cvp)

fpLLL has enumeration for finding the shortest vector (the code for CVP is 
experimental according to the docs). There's a ticket on trac implementing an 
interface

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

> miccianchio-voulgaris algorithm(for svp and cvp)

The same ticket also contains code for CVP computation using Voronoi cell 
computation (which was actually written ages ago, but never merged)

> thank you

Cheers,
Martin



signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Re: Sampling elements from a vector space

2014-05-12 Thread Martin Albrecht
Why not:

%time A = random_matrix(GF(4,'a'), 36, 10^6)
CPU times: user 568 ms, sys: 12 ms, total: 580 ms
Wall time: 578 ms

However, getting the rows out takes ages. The reason is that vectors over 
GF(4) are generic, i.e. noone sat down and wrote up a simple class which 
implements these vectors as matrices with one row:

sage: A = matrix(GF(4,'a'),10, 10)
sage: type(A)


sage: v = vector(GF(4,'a'),10)
sage: type(v) # generic type



Compare that with GF(2):

sage: %time A = random_matrix(GF(2), 36, 10^6)
CPU times: user 16 ms, sys: 0 ns, total: 16 ms
Wall time: 16 ms
sage: %time V = A.rows()
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 2.55 ms

sage: A = matrix(GF(2),10, 10)
sage: type(A)


sage: v = vector(GF(2),10)
sage: type(v) # specialised type


So I'm afraid the answer is: "implement it and send a patch" :)

On Monday 12 May 2014 11:56:14 Gerli Viikmaa wrote:
> Thank you - this has sped up the dataset creation 2 times.
> 
> This is the resulting function:
> 
> def generate_data(field, length, n):
>  data = zero_matrix(field, n, length)
>  for i in range(n):
>  for j in range(length):
>  data[i,j] = field.random_element()
>  return data
> 
> Here the vectors are rows, so I can call sequences[i] to get the ith
> vector.
> 
> %time sequences = generate_data(GF(4,'a'), 36, 10^6)
> CPU times: user 26.28 s, sys: 0.56 s, total: 26.84 s
> Wall time: 26.93 s
> 
> compared to
> 
> space = VectorSpace(GF(4,'a'), 36)
> %time sequences=[space.random_element() for __ in range(10^6)]
> CPU times: user 58.41 s, sys: 0.20 s, total: 58.60 s
> Wall time: 58.75 s
> 
> I do wonder if the filling up can be done even better...
> 
> Gerli
> 
> On 11/05/14 23:34, Dima Pasechnik wrote:
> > On 2014-05-11, Gerli Viikmaa  wrote:
> >> Hi,
> >> 
> >> Thank you for your reply.
> >> 
> >> This doesn't improve the time at all (which is my main concern). I am
> >> still looking for a different way of generating this data, something
> >> that would be at least 5-10 times faster than my proposed way.
> > 
> > the problem is apparently the slow creation of elements of the space,
> > not the process of generating random elements.
> > Here are results of profiling:
> > 
> > sage: %prun sequences=[space.random_element() for __ in range(5)]
> > 
> >   6050003 function calls in 393.762 seconds
> >   
> >  Ordered by: internal time
> >   
> >   ncalls tottime  percall  cumtime  percall
> >   filename:lineno(function)
> >   5  386.048  0.008  386.1850.008
> >   free_module.py:1903(zero_vector) 5  4.5330.000  393.574
> >  0.008 free_module.py:4609(random_element) 1801.092   
> >   0.0001.7550.000 finite_field_givaro.py:208(random_element)
> >   1800.6630.0000.6630.000 {method
> >   'random_element' of
> >   'sage.rings.finite_rings.element_givaro.Cache_gi} 1800.391 
> > 0.0000.3910.000 {method 'random' of '_random.Random'
> >   objects} 5  0.3800.000  386.7420.008
> >   free_module.py:5012(__call__)> 
> > .. some entries, not taking much time at all, deleted...
> > 
> > If you look at the random_element() code in sage/modules/free_module.py
> > (starting at the line 4609, see e.g.
> > https://github.com/sagemath/sage/blob/master/src/sage/modules/free_module.
> > py)
> > 
> > then you see that it calls self(0), i.e. zero_vector(),
> > and this is what eats up almost all the time.
> > 
> > It will be much faster to allocate a zero matrix
> > (zero_matrix(GF(4, 'a'), 36,10^6))
> > and fill it in, basically using the random_element() code,
> > adapted appropriately.
> > 
> > HTH,
> > Dima
> > 
> >> Gerli
> >> 
> >> On 11/05/14 22:23, Dima Pasechnik wrote:
> >>> On 2014-05-11, Gerli Viikmaa  wrote:
>  Hi,
>  
>  I am trying to analyse sets of random vectors from a vector space
>  GF(4)^36.
>  For that I need to sample rather large sets (up to 10^6 vectors) many
>  times
>  (I would like it to be 1000, depending on how fast I can analyse).
>  
>  I first thought my analysis was slow on such large sets but apparently
>  just
>  generating the sets takes an incredibly long time!
>  
>  What is the preferred method for efficiently generating sets of random
>  vectors?
>  
>  Setup:
>  space = VectorSpace(GF(4, 'a'), 36)
>  n = 10^6
>  
>  
>  I have tried the following methods:
>  
>  sample(space, n)
>  gives me
>  OverflowError: Python int too large to convert to C long
>  
>  An attempt to sample indexes and then ask for space[i] instead:
>  sample(range(4^36), n)
>  also results in
>  OverflowError: range() result has too many items
>  
>  Trying to use space.random_element():
>  First I tried to get unique samples:
>  sequences = []
>  
>  while len(sequences) < n:
>    

Re: [sage-support] Re: Complex embedding with quotient()

2014-05-07 Thread Martin Albrecht
Hi Nils,

On Wednesday 07 May 2014 16:43:03 Nils Bruin wrote:
> On Wednesday, May 7, 2014 9:58:48 AM UTC-7, François Colas wrote:
> > What I want to do is a way to evaluate polynomials of K in a power of a
> > primitive square root of unity:
> > 
> > omega = CC(e^(2*I*pi/m))
> > F = Hom(K, CC)
> > f = F([omega])
> > TypeError: images do not define a valid homomorphism
> > 
> > Does anyone see another way to do this?
> 
> Have you tried using CyclotomicField(m) ? I think that uses specialized
> code, which should handle high degrees much better than generic number
> field code:

unfortunately that's not the case for the OP, see:

https://groups.google.com/forum/#!searchin/sage-devel/QuotientRing|
sort:date/sage-devel/qxGMiYDF4eQ/zDcTmXWJH9UJ
 
> sage: K=CyclotomicField(3*5*7*11)
> sage: K.coerce_embedding()
> Generic morphism:
>   From: Cyclotomic Field of order 1155 and degree 480
>   To:   Complex Lazy Field
>   Defn: zeta1155 -> 0.852033056930? + 0.00543996044764063?*I
> 
> Alternatively, if you really want to use an explicit quotient ring
> construction:
> 
> f = F([omega],check=False)
> 
> The error you run into otherwise is:
> 
> sage: sage.rings.morphism.RingHomomorphism_im_gens(H,[omega])
> ValueError: relations do not all (canonically) map to 0 under map
> determined by images of generators.
> 
> i.e., the cyclotomic polynomial evaluated at omega doesn't return an exact
> zero, because CC uses float arithmetic.

Cheers,
Martin

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Irreducibility of polynomials

2014-05-07 Thread Martin Albrecht
Here's how to find out:

sage: P. = GF(2)[]
sage: f = P.random_element()
sage: f.is_irreducible??

if 0 == GF2X_IterIrredTest(self.x):
return False
else:
return True

Okay, what's GF2X_IterIrredTest?

sage: search_src("GF2X_IterIrredTest")
libs/ntl/ntl_GF2X_decl.pxd:62:long GF2X_IterIrredTest "IterIrredTest" 
(GF2X_c f)

This leads us to NTL's IterIrredTest, searching for it leads to:

http://www.shoup.net/ntl/doc/GF2XFactoring.txt

long IterIrredTest(const GF2X& f);

// performs an iterative deterministic irreducibility test, based on
// DDF.  Fast on average (when f has a small factor).

Gruß,
Martin

On Wednesday 07 May 2014 05:51:11 Silke Johler wrote:
> Hi everyone,
> 
> I would like to know which test Sage uses to test irreducibility of a
> polynomial over GF(2). Is it Rabin`s Test? How to compute the first
> condition? I am not asking for the command, just the
> technique .
> 
> Thanks.

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Not spam despite subject ... Fwd: REQUEST FOR ASSISTANCE

2014-05-01 Thread Martin Albrecht
Hi,

just doing

sage: A = matrix(GF(2), 52751923, 39)
sage: A[i,j] = your entry

doesn't do the trick?

In this case: with extremely high probability this matrix has full rank, so 
imply extract a, say, 1000 x 39 submatrix, compute Gaussian elimination on 
that. The rest will be zero anyway.

On Thursday 01 May 2014 06:34:31 you wrote:
> -- Forwarded message --
> From: "Nasir Mehmood" 
> Date: May 1, 2014 6:28 AM
> Subject: REQUEST FOR ASSISTANCE
> To: 
> Cc:
> 
> Hi, i want to perform Gussain Elimination mod 2 (GF2) of a very very large
> matrix  (52751923 x 39), whose size is in 24MB. Can you plz guide me how do
> it using SAGE? Because i m unable to copy it on SAGE. Matrix is also
> attached, please.

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] what is the syntax of the repeat loop ?

2014-03-18 Thread Martin Albrecht
You'd write it like this:

sage: sage.rings.polynomial.toy_buchberger.buchberger??

G = set(F.gens())
B = set(filter(lambda (x,y): x!=y, [(g1,g2) for g1 in G for g2 in G]))

while B!=set():
g1,g2 = select(B)
B.remove( (g1,g2) )

h = spol(g1,g2).reduce(G)
if h != 0:
B = B.union( [(g,h) for g in G] )
G.add( h )

if get_verbose() >= 1:
print "%d reductions to zero."%(reductions_to_zero)

return Sequence(G)

:)

On Tuesday 18 Mar 2014 14:07:23 etienne mann wrote:
> I want to program the Buchberger algo to compute a grobner basis. I know it
> is already in sage but for my students, I want them to rewrite it.
> The loop is something like
> repeat:
> S=[];
> for i in range(1,len(G)):
> for j in range(1,len(G)):
> r= AlgoDivision(SPolynomial(G[i],G[j]),G)[2];
> if not(r==0):
> Append(~S,r)
> G=G + S;
> until S==[];
> 
> Le mardi 18 mars 2014 22:01:17 UTC+1, projetmbc a écrit :
> > Hello,
> > you have to learn Python a little before using Sage.
> > 
> > In Python you just have while and for loops.
> > 
> > What kind of repeat loop do you want to do ?
> > 
> > Christophe BAL
> > 
> > 
> > 2014-03-18 21:57 GMT+01:00 etienne mann 
> > 
> >> Hi,
> >> 
> >> I did not find a reference for programing a repeat loop in sage?
> >> Of course, I can also use a while loop but it seems strange that there is
> >> no repeat loop :)
> >> 
> >> thx for a clue
> >> Etienne

-- 
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: CryptoMiniSat package

2013-12-31 Thread Martin Albrecht
Hi Valerie,

please direct such questions to [sage-support] which I CCed.

On Tuesday 31 Dec 2013 10:51:06 you wrote:
> Hi Dr Martin,
> 
> 
> I downloaded the CryptoMiniSat package from
> http://www.sagemath.org/packages/optional/ and
> 
> would like to save the clauses derived from a polynomial system in a file. I
> did the following:
> 
> sage: from sage.sat.converters.polybori import CNFEncoder
> sage: from sage.sat.solvers import CryptoMiniSat
> sage: cms = CryptoMiniSat

This should read CryptoMiniSat()

> sage: fn = tmp_filename()
> sage: phi = CNFEncoder(cms,R)
> sage:phi(F) # F is a system of Booleanpolynomials
> 
> sage:cms.clauses(fn)
> 
> But I received the error message
> 
> AttributeError: 'sage.sat.solvers.cryptominisat.cryptominisat.Crypt' object
> has no attribute 'clauses'
> 
> But from http://sagenb.org/src/sat/solvers/cryptominisat/cryptominisat.pyx,
> the 'clauses' function is contained in the CryptoMiniSat module.
> 
> 
> May I know whether there was something wrong with my commands or that the
> CryptoMiniSat module does not have the attribute 'clauses'? If so, how may
> I go about doing it? 
> 
> Also, is there a possibility for multi-threading for CryptoMiniSat in Sage?
> 
> 
> Valerie

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Install cryptominisat-2.9.5 in Ubuntu 13.10

2013-11-18 Thread Martin Albrecht
Try running "sage -b" to compile the Sage interface to CryptoMiniSat.

On Monday 18 Nov 2013 15:48:24 Santanu Sarkar wrote:
> Dear all,
>   I am trying to install cryptominisat in my Ubuntu 13.10. But I have the
> following
> error.
> 
> sage: B = BooleanPolynomialRing(10,'x')
> sage: I = Ideal(B.random_element() for _ in range(10))
> sage: import sage.sat.boolean_polynomials
> sage: sage.sat.boolean_polynomials.solve(I.gens())
> ---
> ImportError   Traceback (most recent call last)
>  in ()
> > 1 sage.sat.boolean_polynomials.solve(I.gens())
> 
> /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/
> lib/python2.7/site-packages/sage/sat/boolean_polynomials.pyc in solve(F,
> converter, solver, n, target_variables, **kwds)
> 150
> 151 if solver is None:
> --> 152 from sage.sat.solvers.cryptominisat import CryptoMiniSat as
> solver
> 153
> 154 if not isinstance(solver, SatSolver):
> 
> /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/
> lib/python2.7/site-packages/sage/sat/solvers/cryptominisat/__init__.py in
> ()
>   2 from cryptominisat import CryptoMiniSat
>   3 except ImportError:
> > 4 raise ImportError("Failed to import
> 'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
> \"install_package('cryptominisat')\" to install it.")
>   5
>   6 from solverconf import SolverConf
> 
> ImportError: Failed to import
> 'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
> "install_package('cryptominisat')" to install it.
> 
> 
> I have already installed cryptominisat. Hence I am getting
> 
> sage: install_package('cryptominisat')
> ---
> ValueErrorTraceback (most recent call last)
>  in ()
> > 1 install_package('cryptominisat')
> 
> /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/
> lib/python2.7/site-packages/sage/misc/package.pyc in
> install_package(package, force)
> 169 if not force:
> 170 if is_package_installed(package):
> --> 171 raise ValueError, "Package is already installed.
> Try install_package('%s',force=True)"%(package)
> 172 raise ValueError, "There is no package name starting with
> '%s'."%(package)
> 173 # len(L)==1, i.e. exactly one package matches the given one.
> 
> ValueError: Package is already installed. Try
> install_package('cryptominisat',force=True)
> sage:

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


Re: Re: [sage-support] Re: Re: Re: Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-24 Thread Martin Albrecht
Hi all,

see http://trac.sagemath.org/ticket/15091

Cheers,
Martin

On Saturday 24 August 2013 10:14:42 Jeroen Demeyer wrote:
> On 2013-08-23 16:02, Volker Braun wrote:
> > I see. The path is indeed hard-coded in libtinfo.so. Does setting the
> > TERMINFO environment variable fix it?
> 
> It should be set to $SAGE_LOCAL/share/terminfo

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: Re: Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-23 Thread Martin Albrecht
Hi Volker,

ah, I got it: I moved $SAGE_ROOT from /opt/sage-5.12.beta3 and to 
/opt/sage-5.12 and somehow the relocation didn't work, i.e., the path is 
hardcoded somewhere.

Cheers,
Martin

On Friday 23 August 2013 05:49:46 you wrote:
> Your build log contains
> 
> 1600 entries written to /opt/sage-5.12.beta3/local/share/terminfo
> 
> but the strace has
> 
> stat("/opt/sage-5.12.beta3/local/share/terminfo", 0x7fffd6692220) = -1
> ENOENT (No such file or directory)
> 
> There is something really fishy here. Does the directory exist or not?
> Maybe there is some permission problem?
> 
> On Thursday, August 22, 2013 10:32:46 PM UTC+1, Martin Albrecht wrote:
> > Hi Volker,
> > 
> > here you go. Grepping through it nothing stood out ... I am not sure what
> > I am
> > looking for, though.
> > 
> > Cheers,
> > Martin
> 
> On Thursday 22 August 2013 12:02:10 you wrote:
> > > ncurses didn't install the terminfo database on your system... there is
> > > apparently no /opt/sage-5.12.beta3/local/share/terminfo
> > > 
> > > Can you post your ncurses build log?
> > > 
> > > On Thursday, August 22, 2013 7:07:17 PM UTC+1, Martin Albrecht wrote:
> > > > Hi Volker,
> > > > 
> > > > here it is. Thanks!
> > > > 
> > > > Cheers,
> > > > Martin
> > > > 
> > > > On Thursday 22 August 2013 10:39:10 you wrote:
> > > > > Can you post the whole trace?
> > > > > 
> > > > > sage -sh
> > > > > strace python -c 'import curses; curses.initscr()' >& output.log
> > > > > 
> > > > > On Thursday, August 22, 2013 6:23:48 PM UTC+1, Martin Albrecht
> > 
> > wrote:
> > > > > > Hi Volker,
> > > > > > 
> > > > > > On Thursday 22 August 2013 08:31:26 you wrote:
> > > > > > > sage -sh
> > > > > > > strace python -c 'import curses; curses.initscr()' |& grep xterm
> > > > > > > with TERM=xterm
> > > > > > 
> > > > > > it's empty.
> > > > > > 
> > > > > > > and xterm-256color?
> > > > > > 
> > > > > > it's also empty.
> > > > > > 
> > > > > > > ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so
> > > > > > 
> > > > > > $ ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so
> > > > > > 
> > > > > > linux-vdso.so.1 (0x7fff9299)
> > > > > > libncurses.so.5 =>
> > 
> > /opt/sage-5.12/local/lib/libncurses.so.5
> > 
> > > > > > (0x7fae4a43f000)
> > > > > > 
> > > > > > libpython2.7.so.1.0 =>
> > > > > > 
> > > > > > /opt/sage-5.12/local/lib/libpython2.7.so.1.0
> > > > > > (0x7fae4a05e000)
> > > > > > 
> > > > > > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> > > > > > 
> > > > > > (0x7fae49e11000)
> > > > > > 
> > > > > > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
> > > > 
> > > > (0x00007fae49a65000)
> > > > 
> > > > > > libtinfo.so.5 => /opt/sage-5.12/local/lib/libtinfo.so.5
> > > > > > 
> > > > > > (0x7fae49833000)
> > > > > > 
> > > > > > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
> > > > > > 
> > > > > > (0x7fae4962e000)
> > > > > > 
> > > > > > libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1
> > > > > > 
> > > > > > (0x7fae4942b000)
> > > > > > 
> > > > > > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
> > > > 
> > > > (0x7fae4912d000)
> > > > 
> > > > > > /lib64/ld-linux-x86-64.so.2 (0x7fae4a875000)
> > > > > > 
> > > > > > so it seems to pick up the right one.
> > > > > > 
> > > > > > I noticed that the shell after sage -sh is seriously FUBAR, e.g.
> > > > 
> > > > backspace
> > > > 
> > > > > > doesn't delete but adds spaces. This problem does not exist with
> > 
> > 5.11.
> > 
> > > > > > I should perhaps note that I am on zsh if that makes a difference
> > 
> > (?)
> > 
> > > > > > Cheers,
> > > > > > Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi Volker,

On Thursday 22 August 2013 08:31:26 you wrote:

> sage -sh
> strace python -c 'import curses; curses.initscr()' |& grep xterm
> with TERM=xterm

it's empty.

> and xterm-256color? 

it's also empty.

> ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 

$ ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 

 
linux-vdso.so.1 (0x7fff9299)
libncurses.so.5 => /opt/sage-5.12/local/lib/libncurses.so.5 
(0x7fae4a43f000)
libpython2.7.so.1.0 => /opt/sage-5.12/local/lib/libpython2.7.so.1.0 
(0x7fae4a05e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7fae49e11000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7fae49a65000)
libtinfo.so.5 => /opt/sage-5.12/local/lib/libtinfo.so.5 
(0x7fae49833000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x7fae4962e000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 
(0x7fae4942b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7fae4912d000)
/lib64/ld-linux-x86-64.so.2 (0x7fae4a875000)

so it seems to pick up the right one.

I noticed that the shell after sage -sh is seriously FUBAR, e.g. backspace 
doesn't delete but adds spaces. This problem does not exist with 5.11. 

I should perhaps note that I am on zsh if that makes a difference (?)

Cheers,
Martin


--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

yep, looks like it succeeded ... funny that this would present a problem.

building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -
I/opt/sage-5.12.beta3/local/include -I. -IInclude -I./Include -
I/usr/include/x86_64-linux-gnu -I/usr/local/include -
I/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include -
I/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src -c 
/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.c -o 
build/temp.linux-
x86_64-2.7/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.o
gcc -pthread -shared -L/opt/sage-5.12.beta3/local/lib -
L/opt/sage-5.12.beta3/local/lib build/temp.linux-
x86_64-2.7/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.o
 
-L/opt/sage-5.12.beta3/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib 
-L. -lncurses -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so


Cheers,
Martin

On Thursday 22 August 2013 07:40:23 Volker Braun wrote:
> Your Python managed to build the _curses extension? Mine didn't, which is
> presumably why it Python can't get itself confused:
> 
> building '_curses' extension
> gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
> -Wall -I/home/vbraun/opt/
> sage-5.12.beta3/local/include -I. -IInclude -I./Include
> -I/usr/local/include -I/home/vbraun/opt/
> sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include
> -I/home/vbraun/opt/sage-5.12.beta3/spkg/b
> uild/python-2.7.5.p1/src -c
> /home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
> les/_cursesmodule.c -o
> build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
> thon-2.7.5.p1/src/Modules/_cursesmodule.o
> gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib
> -L/home/vbraun/opt/sage-5.12.b
> eta3/local/lib
> build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/pytho
> n-2.7 .5.p1/src/Modules/_cursesmodule.o
> -L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib
> -L. -lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so
> *** WARNING: renaming "_curses" since importing it failed:
> /lib64/libncursesw.so.5: undefined sy
> mbol: _nc_putchar
> building '_curses_panel' extension
> gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
> -Wall -I/home/vbraun/opt/
> sage-5.12.beta3/local/include -I. -IInclude -I./Include
> -I/usr/local/include -I/home/vbraun/opt/
> sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include
> -I/home/vbraun/opt/sage-5.12.beta3/spkg/b
> uild/python-2.7.5.p1/src -c
> /home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
> les/_curses_panel.c -o
> build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
> thon-2.7.5.p1/src/Modules/_curses_panel.o
> gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib
> -L/home/vbraun/opt/sage-5.12.beta3/local/lib
> build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/pytho
> n-2.7.5.p1/src/Modules/_curses_panel.o
> -L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib -L. -lpanelw
> -lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses_panel.so ***
> WARNING: renaming "_curses_panel" since importing it failed:
> /lib64/libncursesw.so.5: undefined symbol: _nc_putchar
> 
> On Thursday, August 22, 2013 2:22:50 PM UTC+1, Martin Albrecht wrote:
> > Hi all,
> > 
> > I am running Linux here. I found that link as well and played with my TERM
> > settings, but nothing is working so far:
> > 
> > sage: osos.environ["TERM"]
> > 'xterm-new'
> > sage: ZZ?
> > WARNING: terminal is not fully functional
> > -  (press RETURN)
> > 
> > ... and then I am back in the 90s with "more".
> > 
> > Cheers,
> > Martin
> > 
> > On Thursday 22 August 2013 06:12:29 Volker Braun wrote:
> > > The change is because we switched to ncurses instead of termcap.
> > > 
> > > Are you on OSX? Your TERM should be set to xterm-new or, even
> > > better, xterm-256color
> > > 
> > > https://code.google.com/p/iterm2/issues/detail?id=1956
> > > 
> > > On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote:
> > > > Hi all,
> > > > 
> > > > with Sage 5.12.beta3 I get:
> > > > 
> > > > sage: os.environ["TERM"]
> > > > 'xterm'
> > > > sage: ZZ?
> > > > 
> > > > /opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()
> > > > 
> > > >  31 # instead of calling exit() in error ca

[sage-support] Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

I am running Linux here. I found that link as well and played with my TERM 
settings, but nothing is working so far:

sage: osos.environ["TERM"]
'xterm-new'
sage: ZZ?
WARNING: terminal is not fully functional
-  (press RETURN)

... and then I am back in the 90s with "more".

Cheers,
Martin

On Thursday 22 August 2013 06:12:29 Volker Braun wrote:
> The change is because we switched to ncurses instead of termcap.
> 
> Are you on OSX? Your TERM should be set to xterm-new or, even
> better, xterm-256color
> 
> https://code.google.com/p/iterm2/issues/detail?id=1956
> 
> On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote:
> > Hi all,
> > 
> > with Sage 5.12.beta3 I get:
> > 
> > sage: os.environ["TERM"]
> > 'xterm'
> > sage: ZZ?
> > 
> > /opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()
> > 
> >  31 # instead of calling exit() in error cases.
> >  32 setupterm(term=_os.environ.get("TERM", "unknown"),
> > 
> > ---> 33   fd=_sys.__stdout__.fileno())
> > 
> >  34 stdscr = _curses.initscr()
> > 
> >  35 for key, value in _curses.__dict__.items():
> > error: setupterm: could not find terminal
> > sage:
> > 
> > This is in konsole (KDE's console). Any ideas?
> > 
> > Cheers,
> > Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

with Sage 5.12.beta3 I get:

sage: os.environ["TERM"]
'xterm'
sage: ZZ?

/opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()
 31 # instead of calling exit() in error cases.
 32 setupterm(term=_os.environ.get("TERM", "unknown"),
---> 33   fd=_sys.__stdout__.fileno())
 34 stdscr = _curses.initscr()
 35 for key, value in _curses.__dict__.items():

error: setupterm: could not find terminal
sage:

This is in konsole (KDE's console). Any ideas?

Cheers,
Martin


--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


Fwd: [sage-support] Re: Possible bug in algebraic_immunity( ) function in crypto toolbox

2013-08-20 Thread Martin Albrecht
Hi Yann,

I believe you are the original author of this code?

Cheers,
Martin

--  Forwarded Message  --

Subject: [sage-support] Re: Possible bug in algebraic_immunity( ) function in 
crypto toolbox
Date: Tuesday 20 August 2013, 08:54:18
From: Oleksandr Kazymyrov 
To: sage-support@googlegroups.com

I have the same problem.

My output (Mac OS 10.8.4 with sage 5.11) for
#!/usr/bin/env sage

from sage.crypto.boolean_function import BooleanFunction

P = BooleanPolynomialRing(4,'x')
P.inject_variables()
f = BooleanFunction(x0*x2 + x2*x3 + 1)

print "f.algebraic_immunity() = {0}".format(f.algebraic_immunity())
print "f.annihilator(f.algebraic_immunity()) = 
{0}".format(f.annihilator(f.algebraic_immunity()))
print "f.algebraic_immunity(annihilator=True) = 
{0}".format(f.algebraic_immunity(annihilator=True))

g = BooleanFunction(f.algebraic_immunity(annihilator=True)[1])

print "f = {0}".format(f.algebraic_normal_form())
print "g = {0}".format(g.algebraic_normal_form())
print "g*f = 
{0}".format(g.algebraic_normal_form()*f.algebraic_normal_form())

is
Defining x0, x1, x2, x3
f.algebraic_immunity() = 1
f.annihilator(f.algebraic_immunity()) = None
f.algebraic_immunity(annihilator=True) = (1, x2 + 1)
f = x0*x2 + x2*x3 + 1
g = x2 + 1
g*f = x2 + 1

Therefore algebraic_immunity returns wrong degree. g*f = 0 for degree 2, 
which is the correct answer.

On Tuesday, February 12, 2013 6:35:05 PM UTC+1, akhil wrote:
>
> Hello,
>
> SAGE returns an incorrect annihilator when algebraic_immunity(annihilator 
> = True) is used in the following code:
>
> from  sage.crypto.boolean_function import BooleanFunction
> R = BooleanPolynomialRing(4,'x')
> f1 = R.gen(0)*R.gen(1)*R.gen(2) + R.gen(0)*R.gen(1)*R.gen(3) + 
> R.gen(0)*R.gen(2)*R.gen(3) + R.gen(1)*R.gen(2)*R.gen(3) + 1
> annihilator_f1 = BooleanFunction(f1).algebraic_immunity(annihilator = 
> True)[1]
> print (annihilator_f1 * f1)
>
> annihilator_f1 is incorrect, because the response comes as:
>
> x0 + x1 + x2 + x3 + 1
>
>
> and not 0 as expected.
>
> The annihilator( ) function however, returns the correct answer, as 
> checked with the following code:
>
> for i in range(1,f1.total_degree() + 1):
> if BooleanFunction(f1).annihilator(i) == None:
> continue
> else:
> p =  BooleanFunction(f1).annihilator(i)
> print p
> print (p*f1 == 0)
> break
>
> Output:
>
> x0*x1*x2 + x1*x2*x3
> True
>
>
> The above code was written in online notebook version of SAGE.
>
> Thanks,
> AKHIL.
>
>
>
>
>

-- 
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/groups/opt_out.
-

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

Main.sage
Description: Binary data


signature.asc
Description: This is a digitally signed message part.


[sage-support] n-dimensional numerical integration

2013-06-29 Thread Martin Albrecht
Hi all,

do we have n-dimensional numerical integration in Sage? All I can find is 3D, 
but what about higher dimensions? 

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de


signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Modifying ANF2CNF converter to produce limited number of CNF clauses

2013-05-22 Thread Martin Albrecht
I don't understand what you're trying to do, but in any case: Sage is open 
source, so yes you can definitely modify it. It's probably easiest if you 
simply subclass the ANF2CNF converter and implement whatever change you want 
to see in your subclass.

On Wednesday 22 May 2013, akhil wrote:
> Hello everyone,
> 
> 
> I wanted to know if the SAGE builtin ANF2CNF converter (I am using the
> sparse strategy implementation) can be modified so as to display a limited
> number of clauses of the given ANF expression, say 'n' number of clauses (n
> must be input to the converter, along with the ANF expression).
> 
> Please help if anybody can come up with a solution.
> 
> Thanks a lot.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de


signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] Conjunctive Normal Form

2013-04-20 Thread Martin Albrecht
sage: B. = BooleanPolynomialRing()
sage: f=a+b*c
sage: from sage.sat.converters.polybori import CNFEncoder
sage: from sage.sat.solvers.dimacs import DIMACS 
sage: solver = DIMACS()
sage: ce = CNFEncoder(solver, B)
sage: ce([f])
[None, a, b, c]
sage: solver.clauses()
[((-2, -3, 1), False, None), ((3, -1), False, None), ((2, -1), False, None)]


On Saturday 20 Apr 2013, Santanu Sarkar wrote:
> Dear all,
>   I want to convert the polynomial f into Conjunctive Normal Form (CNF)
> in Sage. How can I do this?
> 
> 
> B. = BooleanPolynomialRing()
> f=a+b*c

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] What is "set_verbose" command in buchberger algorithm?

2013-04-05 Thread Martin Albrecht
sage: set_verbose? 

On Friday 05 Apr 2013, Neda wrote:
>  Hello
> I computed buchberger algorithm as
> R.=PolynomialRing(QQ,3)
> I=ideal(x^6-y^2+z, z^3+y^2)
> set_verbose(3)
> I.groebner_basis('toy:buchberger')
> (x^6 - y^2 + z, z^3 + y^2) => 0
> G: set([x^6 - y^2 + z, z^3 + y^2])
> 
> (z^3 + y^2, x^6 - y^2 + z) => 0
> G: set([x^6 - y^2 + z, z^3 + y^2])
> 
> 2 reductions to zero.
> [x^6 - y^2 + z, z^3 + y^2]
> I just want to know what is "set_verbose(3)" command  in this? also "toy:"
> ...  that I just found these commands in sage documents!
> thank you

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Problem in Sat Solver

2013-04-05 Thread Martin Albrecht
Mhh, the thing triggering the AssertionError is

 assert(self._solver.okay())

so what seems to be happening is that by the time you add x4 + x5 the solver 
has figured out that the problem has no solution.

AssertError is certainly a user unfriendly error to raise. It should be a 
ZeroDivision error perhaps. Can you open a ticket so we don't forget to fix 
that?

On Friday 05 Apr 2013, Santanu Sarkar wrote:
> R.=BooleanPolynomialRing(6)
> 
> C=[x0,   x0 + x1,   x1 + x2, x3,   x2 + 1,   x4 +x5]
> tt=cputime()
> 
> I = Ideal(C)
> 
> import sage.sat.boolean_polynomials
> B= sage.sat.boolean_polynomials.solve(I.gens())

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Possible bug in anf2cnf.py

2013-03-13 Thread Martin Albrecht
The output is correct:

sage: B. = BooleanPolynomialRing()
sage: from sage.sat.boolean_polynomials import solve as solve_sat
sage: solve_sat([a*b],n=infinity) 
[{b: 1, a: 0}, {b: 0, a: 0}, {b: 0, a: 1}]

i.e., the solver returns all valid solutions for a*b. In more detail:

p cnf 4 4
1 -4 0 
2 -4 0
4 -1 -2 0
-4 0

means (if w == 4)

   (a | -w) & (b | -w) & (w | -a | -b) <=> w == a*b

a = 0, =>  w = 0 (first clause)
a = 0  =>  w = 0 (second clause)
a = 1, b=1 => w = 1 (third clause)

On Wednesday 13 Mar 2013, akhil wrote:
> Hello,
> 
> 
> I am using SAGE builtin anf2cnf.py converter, but the DIMACS output
> returned is incorrect, when verified by multiplying the CNF clauses. Sample
> code:
> 
> B. = BooleanPolynomialRing()
> from sage.sat.converters.polybori import CNFEncoder
> from sage.sat.solvers.dimacs import DIMACS
> fn = tmp_filename()
> solver = DIMACS(filename=fn)
> e = CNFEncoder(solver, B)
> e.clauses_dense(a*b)
> _ = solver.write()
> print open(fn).read()
> 
> Output returned:
> 
> p cnf 4 4
> 1 -4 0
> 2 -4 0
> 4 -1 -2 0
> -4 0
> 
> Here 4 is the index for the monomial a*b. On multiplying these clauses, the
> answer comes as a' + b', and not a*b as required.
> 
> Can anybody please help?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Re: Random Permutation

2013-03-04 Thread Martin Albrecht
Why not use shuffle()?

On Monday 04 Mar 2013, Simon King wrote:
> Hi Gary,
> 
> On 2013-03-04, GaryMak  wrote:
> >> sage: Permutations(50).random_element()
> >> [11, 4, 30, 48, 49, 36, 22, 16, 27, 6, 44, 33, 13, 50, 9, 35, 15, 12,
> >> 26, 45, 1, 18, 2, 40, 19, 10, 28, 7, 37, 46, 25, 29, 34, 41, 38, 24, 8,
> >> 20, 32, 21, 14, 23, 31, 47, 43, 17, 3, 39, 5, 42]
> > 
> > I have a set of size (say) 50 and I would like to generate a
> > randomly-ordered list of its elements. The trouble is, if I use
> > Permutations(my_set).random_element() it seems to want to generate the
> > whole lot of them before picking out a random one!! Sorry but I cannot
> > find how else to invoke this functionality, but I know there must be a
> > better way 
> 
> Permutations(50).random_element() is quite fast, and I think it does
> *not* try to enumerate Sym(50).
> 
> I'd do:
>   sage: L = some list
>   sage: p = Permutations(len(L)).random_element()
>   sage: L_rand = [L[p[i]-1] for i in range(len(L))]
> 
> Note that it is p[i]-1, because addressing list elements in Python is
> zero-based, but Permutations(50) permutes the numbers from 1 to 50, not
> from 0 to 49.
> 
> Best regards,
> Simon

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Arrays of Boolean variables

2013-02-27 Thread Martin Albrecht
A = R.gens()[:1]
B = R.gens()[1:]

On Wednesday 27 Feb 2013, Santanu Sarkar wrote:
> Dear all,
>I need two arrays of Boolean variables. So I have written
> 
> R=BooleanPolynomialRing(2,['x%d'%(i+1) for i in range
> (1)]+,['y%d'%(i+1) for i in range (1)] )
> R.inject_variables()
> 
> Now in one array A, I want to store x1,..,x1 and in another array B
> want to store
> y1,..y1.  Hence  A=[x1,.., x1] & B=[y1,..,y1]. How this can be
> possible?
> 
> Also function R.inject_variables() explicitly shows the variables, which I
> do not want.
> Is there any way to tackle this?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Sat Solver

2012-12-24 Thread Martin Albrecht
Works for me

$ sage
--
| Sage Version 5.4.1, Release Date: 2012-11-15   |
| Type "notebook()" for the browser-based notebook interface.|
| Type "help()" for help.|
--
sage: from sage.sat.solvers import SatSolver
sage: 

$ /opt/sage-5.5.rc1/sage
--
| Sage Version 5.5.rc1, Release Date: 2012-12-18 |
| Type "notebook()" for the browser-based notebook interface.|
| Type "help()" for help.|
--
**
**
* Warning: this is a prerelease version, and it may be unstable. *
**
**
sage: from sage.sat.solvers import SatSolver
sage: 


On Monday 24 Dec 2012, Santanu Sarkar wrote:
> Dear all,
>  To solve a SAT problem, when I have written  the following, I got error.
> 
> from sage.structure.sequence import Sequence
> from sage.rings.infinity import PlusInfinity
> 
> from sage.sat.solvers import SatSolver
> from sage.sat.converters import ANF2CNFConverter
> 
> 
> 
> Traceback (click to the left of this block for traceback)
> ...
> ImportError: No module named sat.solvers

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: Re: [sage-support] Solve system of non linear equations

2012-12-23 Thread Martin Albrecht
try ./sage -i instead of sage -i

-- sent from a tablet, please excuse my brevity
On Dec 23, 2012 5:38 PM, "Santanu Sarkar" 
wrote:

> I want to install sat solver.  I have the following error
> a@a-Compaq-Presario-C700-Notebook-PC:~/Downloads/sage-5.2-linux-32bit-ubuntu_12.04_lts-i686-Linux$
> sage -i cryptominisat-2.9.5
>
> mkdir: cannot create directory `/usr/lib/sage/spkg/logs': Permission denied
> Calling sage-spkg on 'cryptominisat-2.9.5'
> tee: /usr/lib/sage/install.log: Permission denied
> tee: /usr/lib/sage/spkg/logs/cryptominisat-2.9.5.log: No such file or
> directory
> Attempting to download package cryptominisat-2.9.5
> http://www.sagemath.org//packages/optional/cryptominisat-2.9.5.spkg -->
> cryptominisat-2.9.5.spkg
> [ ]
> http://www.sagemath.org//packages/standard/cryptominisat-2.9.5.spkg -->
> cryptominisat-2.9.5.spkg
> [ ]
> http://www.sagemath.org//packages/experimental/cryptominisat-2.9.5.spkg--> 
> cryptominisat-2.9.5.spkg
> [ ]
> http://www.sagemath.org//packages/archive/cryptominisat-2.9.5.spkg -->
> cryptominisat-2.9.5.spkg
> [ ]
> **
> * Unable to download cryptominisat-2.9.5
> * Please see http://www.sagemath.org//packages for a list of valid
> * packages or check the package name.
> **
> Error: Failed to download package cryptominisat-2.9.5 from
> http://www.sagemath.org/
>
>
>
> On 13 December 2012 16:45, Martin Albrecht  > wrote:
>
>> sage -i cryptominisat-2.9.5
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Error when trying to input an 8-bit Sbox into the argument of S = mq.SBox(.)

2012-12-22 Thread Martin Albrecht
Pass a list of numbers instead of independent numbers. SBox( [1,2,3]) not
SBox(1,2,3)

sent from a telephone.
On 19 Dec 2012 08:17, "sea21"  wrote:

> Why is it that when I try to input an 8-bit Sbox into the argument of S =
> mq.SBox(.), I get the error: "SyntaxError: more than 255 arguments"? Does
> this class not work for more than 7-bit S-boxes?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: Re: [sage-support] Re: Groebner Basis over finite field

2012-12-13 Thread Martin Albrecht
You can try to compute over ZZ with p added as a generator, because

   J in Z^n/ ~= J +  in Z^n

sage: p = next_prime(2^100)
sage: R. = ZZ[]
sage: I = Ideal(R.random_element() for _ in range(R.ngens()))
sage: I += [p]

sage: I.groebner_basis()
[x^2 + 380295180068468820449010961696*x*z + 25353012004564588029934064*z^2 
+ 1014120480182583521197362564522*z, y^2 + x*z + 6*y*z + 2*y, 
1267650600228229401496703205653]

It won't be efficient but better than the toy implementation I guess.

On Thursday 13 Dec 2012, Santanu Sarkar wrote:
> Thanks for your information. No, I need large
> prime field.
> 
> On 13 December 2012 12:19, Simon King  wrote:
> > Hi!
> > 
> > On 2012-12-13, Santanu Sarkar  wrote:
> > > When I want to calculate
> > > Groebner basis, I have following error.
> > > 
> > > 
> > > verbose 0 (3292: multi_polynomial_ideal.py, groebner_basis) Warning:
> > > falling back to very slow toy implementation.
> > 
> > This is not an error but a warning.
> > 
> > > P1=next_prime(2^100)
> > > R.=GF(P1)[]
> > 
> > The warning tells you that your finite field is so big that it can not
> > be dealt with in (lib)Singular. Hence, if you want to compute a Gröbner
> > basis over such a big finite prime field, Sage can not use the fast
> > implementation in (lib)Singular; instead, Sage will try to use a generic
> > implementation of Buchberger's algorithm (that's what is called "toy
> > implementation" in the warning message). If you are lucky, the
> > computation will succeed soon, if you aren't lucky, then there is not
> > much one can do about it.
> > 
> > Are you sure that you need this particularly large finite field? Would a
> > smaller finite field do? Would QQ do?
> > 
> > Best regards,
> > Simon
> > 
> > 
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sage-support" group.
> > To post to this group, send email to sage-support@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/sage-support?hl=en.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: Re: [sage-support] Solve system of non linear equations

2012-12-13 Thread Martin Albrecht


On Sunday 09 Dec 2012, Georgi Guninski wrote:
> On Sat, Dec 08, 2012 at 11:44:19AM +0530, Santanu Sarkar wrote:
> > Dear all,
> > 
> >   I have a system of non linear equations over GF(2). How to solve
> > 
> > them in Sage?
> 
> If you need to solve large nonlinear systems over GF(2) and don't
> insist on using sage I suspect a better choice is to convert
> them to conjunctive normal form (CNF) and then use state of the
> art SAT solver like lingeling/cryptominisat.
> 
> There are sage programs for converting ANF to CNF, don't know if
> they are in vanilla sage.

Yes, it's all here:

On the shell

$ sage -i cryptominisat-2.9.5
$ sage -b

In Sage:

sage: B = BooleanPolynomialRing(10,'x')
sage: I = Ideal(B.random_element() for _ in range(10)) 

sage: import sage.sat.boolean_polynomials
sage: sage.sat.boolean_polynomials.solve(I.gens())
[{x7: 1, x8: 0, x9: 1, x6: 0, x5: 0, x4: 1, x3: 1, x1: 1, x2: 1, x0: 1}]
sage: I.groebner_basis()
[x0 + 1, x1 + 1, x2 + 1, x3 + 1, x4 + 1, x5, x6, x7 + 1, x8, x9 + 1]

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: Re: [sage-support] Re: Solve system of non linear equations

2012-12-08 Thread Martin Albrecht
We are talking about the Boolean polynomial ring here, right? So an F4 style 
algorithm is used by default (subject to some heuristics). To emphasise you'd 
have to construct your ring using the BooleanPolynomialRing constructor.

On Saturday 08 Dec 2012, john_perry_usm wrote:
> On Saturday, December 8, 2012 11:07:31 AM UTC-6, Santanu wrote:
> > Thank you. But when I try to solve
> > f1=x1 + x2 + x4 + x10 + x31 + x43 + x56 ,
> > f2=x2 + x3 + x5 + x11 + x32 +x44 + x57,
> > 
> > it becomes very slow. Is there any faster approach like
> > F4 algorithm available in Sage?
> 
> F4 is not yet available in Sage; as far as I know, we're waiting for
> upstream (Singular) to implement it. They've been working on it very hard
> for quite some time, because they're trying to do it right, and it's not as
> easy as one might think. Last I heard, they had both F4 and an F5-like
> algorithm with respectable performance in an internal development branch,
> but they had to integrate it with the regular Singular branch. It's been a
> huge effort to do this, since memory management & other tricky issues come
> into play.
> 
> Daniel Cabarcas wrote an open-source implementation of F4 for his Master's
> Thesis, which you might be able to find online. Bjarke Roune & Michael
> Stillman described an open-source F5-like algorithm at ISSAC 2012, and gave
> an address where you can download it in the paper.
> 
> All that said, when I look at your system, I wonder if something's wrong
> with the formatting, because it looks to me as if it's either linear or
> univariate. Is that the case?
> 
> regards
> john perry

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Re: Solve system of non linear equations

2012-12-08 Thread Martin Albrecht
Or compute a Gröbner basis:

sage: P. = BooleanPolynomialRing()
sage: Ideal(x^2 + y^2).groebner_basis()
[x + y]
sage: Ideal(x^2 + y^2).variety()   
[{y: 0, x: 0}, {y: 1, x: 1}]

On Saturday 08 Dec 2012, Volker Braun wrote:
> I take it you mean polynomial equations:
> 
> sage: AA. = AffineSpace(GF(2),2)
> sage: S = AA.subscheme(x^2+y^2)
> sage: S.point_set().points()
> [(0, 0), (1, 1)]
> 
> On Saturday, December 8, 2012 6:14:19 AM UTC, Santanu wrote:
> >   I have a system of non linear equations over GF(2). How to solve
> > 
> > them in Sage?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] libm4rie-20120613 will not build on Ubuntu Server 12.04.1 LTS x86

2012-11-04 Thread Martin Albrecht
Wow, we crashed GCC:

libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./m4rie -
I/opt/sage/sage-5.4.rc3/local/include -I/include -mmmx -msse -msse2 -msse3 -O2 
-fPIC -Wall -pedantic -g -I/opt/sage/sage-5.4.rc3/local/include -MT ple.lo -MD 
-MP -MF .deps/ple.Tpo -c m4rie/ple.c -o ple.o >/dev/null 2>&1
mv -f .deps/trsm.Tpo .deps/trsm.Plo
mv -f .deps/ple.Tpo .deps/ple.Plo
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.

But I have no idea how to fix it (other than perhaps - as that thread you link 
to indicates - involve reinstalling GCC) 

On Sunday 04 Nov 2012, Brandon Curtis wrote:
> I am attempting to build Sage on a Linode-hosted [1] Linux virtual server.
>  Both sage-5.3 and sage-5.4-rc3 fail repeatedly at libm4rie-20120613.
> 
> I found one other reference to a similar problem [2], but reinstalling
> buildessential did not help.  I have gcc-4.6, but I have also tried with
> gcc-4.5 and gcc-4.4 (using export CXX="gcc-4.N") without success.
> 
> libm4rie-20120613.log - http://pastebin.com/9sJM8Fg8
> 
> [1] http://www.linode.com/
> [2]
> https://groups.google.com/forum/?fromgroups=#!topic/sage-support/PMtuoWdpcJ
> 0
> 
> Thoughts or suggestions?
> 
> *
>   Brandon Curtis, PhD Candidate
> UC Berkeley - Chem/Bio Eng <http://www.linkedin.com/in/brandoncurtis>
> <https://kindle.amazon.com/profile/Brandon-Curtis/5046185>
>   <https://plus.google.com/u/0/105858766264293200612/about>
> <http://brandoncurtis.net>
>   <http://jbei.org>
> *

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Re: The matrix function

2012-10-21 Thread Martin Albrecht
Guys, the OP's installation is broken:

On Sunday 21 Oct 2012, E. Mehmet Kıral wrote:
> /home/eren/sage/local/lib/python2.7/site-packages/numpy/lib/polynomial.py
> in () 9 import re
>  10 import warnings
> ---> 11 import numpy.core.numeric as NX
>  12
>  13 from numpy.core import isscalar, abs, finfo, atleast_1d, hstack
> 
> AttributeError: 'module' object has no attribute 'core'

This is not a "how do I use Sage" thread but a thread about repairing a broken 
Sage installation.

On Sunday 21 Oct 2012, Johan Grönqvist wrote:
> 2012-10-21 22:24, E. Mehmet Kıral skrev:
> > I understand that for the identity matrix there are other methods. But I
> > do get the same error message for simply matrix(2)
> > which according to the manual matrix?, should give me the 2by2 zero
> > matrix. Or I get the same error when I try to construct a matrix out of
> > vectors. This should not happen. I have my sage running in ubuntu 12.10
> > inside a virtual machine and I am using the version 5.3 of sage
> 
> Size and empty list of entries:
> sage: matrix(2, [])
> [0 0]
> [0 0]
> 
> #Rows and #columns:
> sage: matrix(2, 2)
> [0 0]
> [0 0]
> sage: matrix(2, 3)
> [0 0 0]
> [0 0 0]
> 
> #Rows and list of entries
> sage: matrix(2, [1, 0, 2, 0, 1, 2])
> [1 0 2]
> [0 1 2]
> 
> #rows, #columns and list of entries
> sage: matrix(2, 3, [1, 0, 2, 0, 1, 2])
> [1 0 2]
> [0 1 2]
> 
> #rows, #columns and a function to supply elements
> sage: matrix(6, 4, lambda i, j: i+j)
> [0 1 2 3]
> [1 2 3 4]
> [2 3 4 5]
> [3 4 5 6]
> [4 5 6 7]
> [5 6 7 8]
> 
> 
> Hope it helps,
> 
> johan

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] obtaining coefficient matrix of a set of linear equations

2012-09-09 Thread Martin Albrecht
sage: P. = GF(127)[]
sage: F = Sequence(P.random_element(degree=1) for _ in range(4))
sage: F.coefficient_matrix()
(
[43 97 14 66]  [x]
[37 51 74 71]  [y]
[16 86 87 71]  [z]
[ 8 78  4 70], [1]
)

On Sunday 09 Sep 2012, akhil wrote:
> Hello,
> 
> 
> Given a set of m linear equations in n unknowns, how do I use SAGE to give
> me the coefficient matrix* A*(size m *n) and column vector *b*(size m*1)
> such that Ax = b; where *x*(size n*1) is the vector of unknowns ?
> 
> Thanks a lot.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Multivariate polynomials: libsingular vs. polydict

2012-09-05 Thread Martin Albrecht
Hi,

On Wednesday 05 Sep 2012, Robert Samal wrote:
> Hi,
> 
> I'm trying to compute something using multivariate polynomials, and am
> struggling to understand the relation between polynomials of type  'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular
> '> and of type  'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>.
> 
> How does one create one or the other? And, mainly: how can one convert from
> one to the other?

It shouldn't happen that you can create two polynomials of different types 
polydict vs. libsingular for the same ring.

> What happened to me is that I unwillingly created some polynomial of one
> type and some of the other and than methods like
> P.coefficient(Q.monomials()[0]) object that they got argument of wrong
> type. (Here P and Q are polynomials of the respective types.)

If you have a ring P and and an element f in Q, doesn't P(f) work? If all else 
fails, there's always P(str(f)).

> I'm sorry for not giving specific lines how to reproduce this, but -- in
> this case this is the point ... I got my polynomials P and Q over the
> course of several days and don't quite understand what happened.
> 
> Thanks!
> 
>   Robert

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: Re: [sage-support] Boolean function evalution

2012-07-17 Thread Martin Albrecht
Hi,

On Tuesday 17 Jul 2012, Virendra Sule wrote:
> Thanks Martin for the help. I find it very difficult to search for help in
> SAGE. Students in my class have written a lot of code in SAGE for number
> theory calculations but none for Boolean functions.
> 
> In the following what is function f, it looks like a random element of R.

You should play with inline help a bit, e.g., 

sage: R.random_element? 

will tell you information about that function.

> I
> suppose f.subs(x=1) substitutes this value in f.

Correct, see:

sage: f.subs?

> So for the specific random
> f chosen at the time this function is yz. What does the call f(*G) mean?

sage: f(x,y,z) calls f on x,y,z. G is a list of length three and * turns that 
into three different arguments for f's call. This is not a Sage feature but a 
feature of the Python language. 

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Boolean function evalution

2012-07-17 Thread Martin Albrecht
sage: R. = BooleanPolynomialRing(3)  
sage: f = R.random_element()
sage: G = [R.random_element() for _ in range(3)]
sage: f.sub
f.subsf.substitute  
sage: f.subs(x=1)
y*z
sage: f(*G)
x*y + x*z + x + y + 1


On Tuesday 17 Jul 2012, virensule wrote:
> How do I evaluate and compose Boolean functions in Boolean polynomial ring?
> 
> For example I have
> 
> R=BooleanPolynomialRing(3,x)
> x=R.gens()
> f=BooleanFunction(x[0]*x[1]+x[1]*x[2]+x[1]+1)
> 
> Now how do I find the function g=f(evaluated when x[0]=1)?
> 
> Also if g is another function defined similarly, how do I compute f(g())
> composition?
> 
> Can someone help please?
> 
> Thanks in advance.
> Virendra

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] multivariate polynomial factorization over GF(2)

2012-06-18 Thread Martin Albrecht
Dear [libsingular-devel], the following bug was reported at [sage-support]:


> ring r = 2,(t,x),dp;
> poly g = t^16*x + t^10*x + t^9*x + t^6*x + t^5 + t*x + x^2;
> factorize(g);
Singular : signal 11 (v: 3133/ 14405 ):
current line:>>factorize(g);<<
Segment fault/Bus error occurred at a776a01 because of 10283 (r:1340008265)
please inform the authors
trying to restart...

A backtrace can be found here:

  http://trac.sagemath.org/sage_trac/ticket/13129

On Monday 18 Jun 2012, barbules wrote:
> sage-5.0-linux-64bit gives segmentation fault on the following:sage: sage:
> 
> R.=GF(2)['t,x']
> g=t^16*x + t^10*x + t^9*x + t^6*x + t^5 + t*x + x^2
> g.factor(proof=False)

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Polynomial representation over GF(2^n)

2012-06-16 Thread Martin Albrecht


On Wednesday 13 Jun 2012, Oleksandr Kazymyrov wrote:
> And one more.
> 
> The following is quite strange:
> sage: K=GF(2^8,'a',modulus=ZZ['x']("x^8 + x^7 + x^6 + x^4 + x^3 + x^2 +
> 1")) sage: b=K.multiplicative_generator()
> sage: c=K(0)
> sage: c.log(b)
> 0
> sage: c=K(1)
> sage: c.log(b)
> 0
> 
> How to determine when c is 0 and when 1? Perhaps log should return
> -1 for finite fields when c=0?

Yep, this looks like a bug. Can you open a ticket and perhaps provide a patch?
 
> Kind regards,
> Oleksandr
> 
> On Wednesday, June 13, 2012 3:02:46 PM UTC+2, Oleksandr Kazymyrov wrote:
> > Hi all,
> > 
> > Continuing the
> > question<https://groups.google.com/forum/?fromgroups#!topic/sage-support
> > /cvtz4Zh-WYQ> ...
> > 
> > Input data:
> > sage: K=GF(2^8,'a',modulus=ZZ['x']("x^8 + x^7 + x^6 + x^4 + x^3 + x^2 +
> > 1"))
> > sage: K.multiplicative_generator()
> > a^4 + a^3 + a
> > sage: P=PolynomialRing(K,'x')
> > sage: pol=P.random_element(5)
> > sage: pol
> > (a^7 + a^5 + a^3 + 1)*x^5 + (a^5 + a^4 + a^3 + a^2 + a + 1)*x^4 + (a^7 +
> > a^3 + a^2 + a)*x^3 + (a^5 + a^2)*x^2 + (a^6 + a^5 + a^4 + 1)*x + a^3
> > 
> > 1. How to represent *pol *using multiplicative generator? The output must
> > be b^(i1)*x^5 + b^(i2)*x^4 + b^(i3)*x^3 + b^(i4)*x^2 + b^(i5)*x + a^3,
> > where b = K.multiplicative_generator(), i1-i5 logarithmic representation
> > of (a^7 + a^5 + a^3 + 1), (a^5 + a^4 + a^3 + a^2 + a + 1)...
> > 
> > I have a correct function:
> > sage: b=K.multiplicative_generator()
> > sage: P(["({0})^{1}".format(b,i.log(b)) for i in pol.coeffs()]) == pol
> > True
> > sage: ["({0})^{1}".format(b,i.log(b)) for i in pol.coeffs()]
> > ['(a^4 + a^3 + a)^27', '(a^4 + a^3 + a)^234', '(a^4 + a^3 + a)^195',
> > '(a^4 + a^3 + a)^134', '(a^4 + a^3 + a)^79', '(a^4 + a^3 + a)^101']
> > 
> > If I have one program then the above method suits me. But if two, i.e.
> > one program represents polynomial in the form b^(i1)*x^5 ... and returns
> > b and another program tries to restore it, then I worry about the phrase
> > The docs for multiplicative_generator() say: "return a generator of the
> > multiplicative group", then add "Warning: This generator might change
> > from one version of Sage to another."
> > 
> > 2. So the question is how to uniquely reconstruct the original *pol*, if
> > I have *modulus*, *multiplicative generator *and* representation of pol
> > as *b^(i1)*x^5...?
> > 
> > Regards,
> > Oleksandr

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Command in sage for partial Gaussian Elimination

2012-06-14 Thread Martin Albrecht
Hi,

On Thursday 14 Jun 2012, Thomas Klotz wrote:
> Thanks for the response, but I don't think that submatrices will help much
> with what we're doing. 

> Do you know if sage invokes singular for gaussian elimination?

No (except for one case), Sage calls various different packages (LinBox, NTL, 
IML, M4RI, M4RIE, Pari, ...) or implements its own highly efficient linear 
algebra. The only case when Singular is called is when linear algebra over 
multivariate polynomial rings is performed.

See http://wiki.sagemath.org/DenseLinearAlgebra

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Command in sage for partial Gaussian Elimination

2012-06-13 Thread Martin Albrecht
No, there isn't such a function. However, some matrices support "windows", 
these are submatrices which are created without copying the data out. Hence, 
doing the splitting up/combining step is quite cheap. See:

  matrix_window_modn_dense.pyx

but it will probably take some code-writing to get it to do what you want.

On Tuesday 12 Jun 2012, Thomas Klotz wrote:
> I was wondering if anyone knows a way for sage to perform gaussian
> elimination on a matrix, but only up to the nth row and will stop at that
> point.
> 
> I realize that I could just split up the matrix and perform the algorithm
> on that part of it, and just re-join it to the rest of the matrix, but I
> was wondering if there is some built-in function for this.
> 
> Thanks,
> Tom

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Martin Albrecht
PARI doesn't have a log_repr() to begin with, so I don't see how that's 
relevant.

On Sunday 03 Jun 2012, Jeroen Demeyer wrote:
> On 2012-06-03 12:14, Martin Albrecht wrote:
> > 2) K.multiplicative_generator() currently returns a random generator, but
> > for the GivaroGFq implementation we should simply return the generator
> > which has internal representation '1', i.e., the guy we actually use to
> > represent the elements. Once this done log_repr() will also start to
> > make sense again.
> 
> On the other hand, doing this for the Givaro interface but not for the
> PARI interface (where logs are never used) is also confusing.  I would
> say: leave things as they are.  Note that the generator is not "random",
> it is deterministic.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Martin Albrecht
Hi,

K.gen() returns the thing we represent field elements in, but not necessarily 
the field generator. 


1) However, the documentation is wrong:

"""
Return a generator of self. All elements x of self are expressed as  
log_{self.gen()}(p) internally
"""

This should be fixed and a reference to multiplicative_generator() added.

2) K.multiplicative_generator() currently returns a random generator, but for 
the GivaroGFq implementation we should simply return the generator which has 
internal representation '1', i.e., the guy we actually use to represent the 
elements. Once this done log_repr() will also start to make sense again.

Olexandr, would those fixes solves your confusion/problem?

On Sunday 03 Jun 2012, Oleksandr Kazymyrov wrote:
> I have used log_repr() and expect that it return y of equation x^y = z. I
> also believed  hat k.gen() return generator of the field.
> 
> Now I must use following construction for solving my problem
> sage: R.=ZZ[]
> sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> sage: a = k.multiplicative_generator()
> sage: a^ZZ(k(ZZ(3).digits(2)).log(a)) == k(ZZ(3).digits(2))
> 
> By the way, any of next functions don't return the value y of equation
> x^y=z sage: b=K(ZZ(3).digits(2))
> sage: b
> a + 1
> sage: b.log_repr()
> '1'
> sage: b.log_to_int()
> 3
> 
> I think that log_repr() should has the same logic as int_repr() or
> integer_representation(), i.e.
> sage: a=K.multiplicative_generator()
> sage: ZZ(K(ZZ(3).digits(2)).log(a))
> 164
> 
> What do you think?
> 
> Kind regards,
> Oleksandr
> 
> On Tuesday, May 29, 2012 12:52:16 PM UTC+3, AlexGhitza wrote:
> > Hi,
> > 
> > On Mon, May 21, 2012 at 9:29 AM, Oleksandr Kazymyrov
> > 
> >  wrote:
> > > I have encountered the following problem In Sage 5.0:
> > > sage: R.=ZZ[]
> > > sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> > > sage: k(ZZ(3).digits(2))
> > > a + 1
> > > sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr())
> > > a
> > > sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > False
> > > sage: k("a+1")^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > True
> > > 
> > > It easy see that k.gen() or k.multiplicative_generator() is not a
> > 
> > generator
> > 
> > > of the finite field:
> > > sage: k.multiplicative_generator()
> > > a^4 + a + 1
> > 
> > Why is it clear that a^4+a+1 is not a multiplicative generator?  I think
> > it is:
> > 
> > sage: k. = GF(2^8, names='a', name='a', modulus=x^8+x^4+x^3+x+1)
> > sage: (a^4+a+1).multiplicative_order()
> > 255
> > 
> > Indeed, so is a+1:
> > sage: (a+1).multiplicative_order()
> > 255
> > 
> > The docs for multiplicative_generator() say: "return a generator of
> > the multiplicative group", then add "Warning: This generator might
> > change from one version of Sage to another."

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org



Re: Re: [sage-support] Re: Solving quadratic inequalities with Mixed Ineger Linear Programming

2012-05-31 Thread Martin Albrecht
You can try SCIP which is a constraint integer programming solver and supports 
quadratic constraints. I started a Sage interface here:

  http://trac.sagemath.org/sage_trac/ticket/10879

>From the ticket description:

"""
"SCIP is currently one of the fastest non-commercial mixed integer programming 
(MIP) solvers. It is also a framework for Constraint Integer Programming and 
branch-cut-and-price. It allows total control of the solution process and the 
access of detailed information down to the guts of the solver." --  
http://scip.zib.de/

Features interesting to Sage:

 - SCIP is pretty fast for Mixed Integer Programming
- SCIP is a Constraint Integer Programming solver and allows non-linear 
constraints
 - SCIP's source code is available

However, we don't have the right to redistribute the SCIP source code. Thus, 
the attached SPKG is empty except for the spkg-install script etc.

To build a SCIP for Sage do:

- download the ZIB Optmisation Suite from  
http://zibopt.zib.de/download.php?fname=ziboptsuite-2.0.1.tgz
- place the files scip-2.0.1.tgz and soplex-1.5.0.tgz in the src/ subdirectory 
of the attached SPKG
- install the SPKG
- apply the attached patch and sage -b

KNOWN ISSUES

- Sage crashes when SCIP variables are printed with SIGSEGV on OSX. It works 
fine under Linux.

- the following doctests fail
 sage -t  -long -force_lib 
devel/sage/doc/en/thematic_tutorials/linear_programming.rst # 1 doctests 
failed
 sage -t  -long -force_lib devel/sage/sage/graphs/digraph.py # 1 doctests 
failed
 sage -t  -long -force_lib devel/sage/sage/numerical/mip.pyx # 3 doctests 
failed

- printing of quadratic constraints does not work yet.
"""

The patch probably also bitrotted a bit by now. But I'd be very happy to see 
it completed, so I'm happy to help anyone who'd attempt to finish it. Also, 
the SCIP developers are happy to help out if we have questions etc.

On Wednesday 30 May 2012, Ruslan Kiyanchuk wrote:
> Thanks. Can you recommend any good tool other than Sage (since it doesn't
> have such interfaces yet) that would handle quadratic inequalities?
> 
> On Wed, May 30, 2012 at 3:32 PM, Nathann Cohen 
wrote:
> > Well, no it is not. We would need an interface with quadratic solvers to
> > do that, and all we have now are *linear* solvers. At least through the
> > MILP class.
> > 
> > Nathann
> > 
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/sage-support
> > URL: http://www.sagemath.org

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Methods in GF

2012-05-29 Thread Martin Albrecht
g:
>   Return the zero element of this ring (cached).
> 
>   EXAMPLES:
> 
>  sage: *ZZ.zero_element()*
>  0
>  sage: *QQ.zero_element()*
>  0
>  sage: QQ['x'].*zero_element()*
>  0
> 
>   The result is cached:
> 
>  sage: ZZ.*zero_element()* is ZZ.*zero_element()*
>  True

These are aliases, I don't find this confusing.

Anyway, do you want to provide (documentation) patches for the issues you 
discovered?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] ZZ for base more than 2^64

2012-05-29 Thread Martin Albrecht


On Thursday 24 May 2012, Oleksandr Kazymyrov wrote:
> Dear all,
> 
> In manual "ZZ ?" you can find:
> 
> As an inverse to "digits()", lists of digits are accepted, provided
>that you give a base. The lists are interpreted in little-endian
>order, so that entry "i" of the list is the coefficient of
>"base^i":
> 
>   sage: Z([3, 7], 10)
>   73
>   sage: Z([3, 7], 9)
>   66
>   sage: Z([], 10)
>   0
> 
> But for base more than 2^64 it doesn't work. It looks stupid, because you
> can call "digits(2^64)", but not an inverse function:
> sage: a=ZZ(randint(0,2^128-1)).digits(2^64)
> sage: a
> [1154963902035838039, 8176620537326016718]
> sage: ZZ(a,2^64)
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (1348, 0))
> 
> ---
> OverflowError Traceback (most recent call last)
> 
> OverflowError: long int too large to convert
> 
> Of course it is possible to convert it back using Sage:
> sage: a=ZZ(randint(0,2^128-1))
> sage: a
> 201636464310824733716520014075404236490
> sage: b=a.digits(2^64)
> sage: b
> [6699442741605840586, 10930734632904602844]
> sage: sum([b[i]*(2^64)^i for i in xrange(len(b))]) == a
> True
> 
> Why core library doesn't include this functionality? Are there any other
> ways to do the same as described above using another function?

It's easy: implement it and send us a patch ;) On a more serious note, it 
seems you found a bug and your code above is the right fix. So it would be 
great if you could open a ticket and provide a patch which falls back to the 
generic code above if the base is >= 2^64.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Generator of Finite Field

2012-05-29 Thread Martin Albrecht
Hi,

it seems I was wrong about this yesterday (Olexandr and I discussed in person 
yesterday):

sage: K.gen?

   Return a generator of self. All elements x of self are expressed as
   log_{self.gen()}(p) internally.

   This generator might differ between different runs or different
   architectures.

   WARNING: The generator is not guaranteed to be a generator for
  the multiplicative group.  To obtain the latter, use
  multiplicative_generator().

So, indeed, K.gen() may be != K.multiplicative_generator()


Olexandr, does your code work if you switch to multiplicative_generator() or 
does that present problems for you?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] IntegerVectors question

2012-05-17 Thread Martin Albrecht
Hi,

currently when running e.g.

sage: IV53 = IntegerVectors(5,3) # length 3 vectors that sum to 5
sage: IV53.cardinality()

The algorithm is simply to enumerate all elements (which is the default 
algorithm).  My question is: is that because that's the best we can do, or 
just because nobody sat down and implemented the correct formula (i.e., is it 
known)?

If an exact formula is not know, does anyone know an upper bound (somewhat 
tight :))?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Testing multivariate quadratic polynomial system [crypto]

2012-05-02 Thread Martin Albrecht
You could also construct a system for a given plaintext ciphertext pair and 
then substitute the key in every equation. The resulting system should be 
trivial to solve and be != 1.

On Wednesday 02 May 2012, Zoresvit wrote:
> I'm implementing a MQ polynomial system for GOST 28147-89 cipher. The idea
> is similar to polynomial system construction in mq.SR for AES and *ctc.py*
> for Courtois Toy Cipher by Martin Albrecht. And I'm wondering what is the
> best way to test correctness of the system.
> 
> What I've implemented so far:
> 
>1. replacing every variable by intermediate encryption bits to test the
>correctness of each equation (system should result 0);
>2. extracting first round of the system, injecting plaintext and key
>values and solving this one-round system. The resulting variables should
> be equal to the ciphertext after the first round.
> 
> Are these two tests enough for making sure the system is correct or are
> there any better solutions to this?
> 
> Thanks!

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Smith form [bug?]

2012-04-27 Thread Martin Albrecht
Looks like a bug, can you open a ticket and perhaps post a patch? I can review 
it.

On Friday 27 Apr 2012, dschar...@gmail.com wrote:
> Today I was just doing some college work and I found an error computing the
> Smith form of a Matrix (over GF(2)).
> 
> 
> sage: AA = matrix(Zmod(2), [[1,1], [1,0], [0,1]])
> sage: AA.smith_form()
> 
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "_sage_input_100.py", line 10, in 
> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("QUEuc21pdGhfZm9ybSgp")
> ,globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "",
> line 1, in 
> 
>   File "/tmp/tmpXWhShB/___code___.py", line 2, in 
> exec compile(u'AA.smith_form()
>   File "", line 1, in 
> 
>   File "matrix2.pyx", line 10512, in sage.matrix.matrix2.Matrix.smith_form
> (sage/matrix/matrix2.c:49285) File "matrix_mod2_dense.pyx", line 1666, in
> sage.matrix.matrix_mod2_dense.Matrix_mod2_dense.submatrix
> (sage/matrix/matrix_mod2_dense.c:9696) TypeError: submatrix() takes
> exactly 4 positional arguments (2 given)
> 
> 
> When I looked at the code, it seemed that "Matrix Mod2" submatrix doesn't
> have the parameters "nrows , ncols" as optional (like the "Matrix"
> submatrix method).
> 
> (If necessary: I have Sage 4.8.0 installed in Ubuntu 12.04 (32 bits)).

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Eval problem with rationals

2012-04-19 Thread Martin Albrecht
Try 

sage: sage_eval?

which preparses it's input while eval does not.

On Thursday 19 Apr 2012, Graham Gerrard wrote:
> z="1/2*x"
> x=3
> eval(z)
> 0
> z="x*1/2"
> eval(z)
> 3/2
> 
> ??
> 
> Graham

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Are there any SAT Solver implemented in Sage?

2012-04-16 Thread Martin Albrecht
Hi,

there is no canonical way of using SAT solvers in Sage yet. Incidentally, it's 
one of the proposals for Sage's Google Summer of Code projects. In the 
meantime you can use these scripts here to convert boolean polynomial systems 
to SAT and the solution back:

https://bitbucket.org/malb/algebraic_attacks/src/5d8dafeef675/anf2cnf.py
https://bitbucket.org/malb/algebraic_attacks/src/5d8dafeef675/polybori-cnf-
converter.py

On Monday 16 Apr 2012, Zoresvit wrote:
> So I've found the CryptoMiniSat solver implementation (optional
> package)<http://trac.sagemath.org/sage_trac/ticket/418> and managed to
> install it, but can't find any documentation on its' usage. Also I happend
> to find some mentions about different SAT solvers interfaces integrated
> into Sage but had problems with figuring out what is actually ready for
> use and how it can be used. I would appreciate any help and hints on using
> SAT solvers in Sage.
> 
> Thanks.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Solving a set of quadratic inequalities (continuous)

2012-04-13 Thread Martin Albrecht
Couldn't you use SCIP for this?

http://scip.zib.de/
http://trac.sagemath.org/sage_trac/ticket/10879

On Friday 13 Apr 2012, Nathann Cohen wrote:
> Hello everybody !!!
> 
> I would like to solve a set of equations with a very easy shape. My
> equations are defined on variables p1_x, p1_y, p2_x, p2_y, ..., and I
> 
> would like to obtain values for them satisfying constraints like :
> |p1 - p2| < 1, i.e.  (p1_x - p2_x)^2 + (p1_y - p2_y)^2 < 1
> 
> or something similar with a > instead of <. I do not really mind
> whether the inequalities are strict or not, as I feel free to replace
> < 1 by <= 0.9.
> 
> Would you know of any way to solve this type of equations, or to
> ensure that no solution exists ?
> 
> Thank yo ! :-)
> 
> Nathann

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Deriving an irreducible polynomial for F_2

2012-03-21 Thread Martin Albrecht
Is this what you are looking for?

sage: P. = GF(2)[]
sage: f = P.random_element(degree=31)
sage: f.is_irreducible() 
False
sage: while f.degree() != 31 or f.is_irreducible() is False:
: f = P.random_element(degree=31)
: 
sage: f.is_irreducible()
True
sage: f.degree()
31


On Wednesday 21 Mar 2012, clinton bowen wrote:
> Hello,
> 
> Is there a way to derive irreducible polynomials of degree n for the field
> F 2? I am looking for the set of all irreducible polynomials of degree
> n=31. If so, how is it done in sage?
> 
> Thanks,
> 
> clinton

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Question about polynomials roots

2012-03-02 Thread Martin Albrecht
Have you read the documentation? It's massive as I just found out:

sage: F = GF(3)
sage: P. = F[]
sage: p = P.random_element()
sage: p.roots?

Or check the source:

sage: p.roots??

On Saturday 03 Mar 2012, juaninf wrote:
> Dears members
> 
> I am have a p(X) belong F[X], where F is a Galois Field. In sage i
> have a roots() function, I want know please, What is a algorithm used
> for implement this function?.
> 
> thanks.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Some bugs and some wishes

2012-02-21 Thread Martin Albrecht
> Hi Rob, you understand more than I do - is this a bug (big step of
> time needed for that type of calculation at an rather arbitrary
> number)? Should I create a track ticket for that? Do you have also an
> opinion on the various other points?

Actually, the cutoff changed:

sage: type(Matrix(GF(previous_prime(2^23)),10,10))


sage: type(M)

sage: %time M.right_kernel()
CPU times: user 0.23 s, sys: 0.02 s, total: 0.25 s
Wall time: 0.26 s
Vector space of degree 1001 and dimension 1 over Finite Field of size 8388593
Basis matrix:
1 x 1001 dense matrix over Finite Field of size 8388593

sage: type(Matrix(GF(previous_prime(2^24)),10,10))

sage: M = MatrixSpace(GF(previous_prime(2^24)), 1000, 1001).random_element();
sage: %time M.right_kernel()
... wait a long long time

This cutoff is not arbitrary btw. but such that the product of two elements 
fits into a double (53 bits).

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] performance of matrix_from_columns method ...

2012-01-29 Thread Martin Albrecht
On Saturday 28 January 2012, Benjamin Howard wrote:
> Hi --
> 
> I have an application in mind where I desperately
> need a faster implementation of the matrix methods:
> 
> matrix_from_columns
> matrix_from_rows_and_columns
> matrix_from_rows
> 
> I am aware that these will not be as fast as the submatrix method (for
> contiguous
> submatrices) but the above three methods are still too slow by far...
> 
> I'm hoping that someone could spend a little bit of time to write
> faster versions of these (maybe
> just cythonize them...)?   I do not know how to do this myself or I'd
> be glad to.   Just to give an idea of how slow they are currently, see
> below:
> 
> #my own ad hoc matrix_from_columns:
> def My_matrix_from_columns(mat,cols):
> set_all_cols = set(range(mat.ncols()))
> set_compl_cols = set_all_cols.difference(set(cols))
> compl_cols = list(set_compl_cols)
> all_cols = cols + compl_cols
> all_cols_one_up = [j+1 for j in all_cols]
> p = sage.combinat.permutation.Permutation(all_cols_one_up)
> p_matrix = p.to_matrix()
> mat_perm = mat * p_matrix
> return mat_perm.submatrix(0,0,mat_perm.nrows(),len(cols))
> 
> (I'm running sage-4.8, compiled from source on a pretty basic desktop
> computer)
> 
> sage: M = Matrix(GF(2),5000,5000); M.randomize()
> sage: L = range(5000); shuffle(L); L = L[:2500]
> sage: time N = M.matrix_from_columns(L)
>  Time: CPU 2.72 s, Wall: 2.73 s
> sage: time N2 = My_matrix_from_columns(M,L)
>  Time: CPU 0.43 s, Wall: 0.45 s
> 
> Surely, going to all the trouble of building that permutation matrix
> after constructing
> the complement to L in range(M.ncols()) (and adding one to get a valid
> permutation
> which unfortunately isn't 0-based), then,
> multiplying by the permutation matrix,
> then extracting the contiguous submatrix, seems like it should have
> been slower
> than the native method from the matrix class?

How soon do you need it? I'm asking because I don't know how soon I could make 
this happen, but I'm sure we can make this much much faster by doing this in 
the M4RI library itself, i.e., in C. Do you know a bit of C?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Question about Groener Basis

2011-10-13 Thread Martin Albrecht
On Thursday 13 October 2011, juaninf wrote:
> I want implement a efficient linear solve system over GF(2) (and too
> parallel if this is posible), 

Hi, are you talking about sparse or dense systems?

> i reading this article, but i dont understand
> 
> http://ask.sagemath.org/question/467/solve-large-system-of-linear-equations
> -over-gf2

Note that 20,000 x 20,000 isn't large for dense matrices over GF(2), you can 
do this in a few seconds on a modern computer.

However, Sage currently does not provide an interface to the fast code we have 
in M4RI, hence it will appear much slower than it should (it's my fault btw.). 

Someone should implement it and send us a patch :) cf. solve.h in M4RI:

http://m4ri.sagemath.org/doxygen/solve_8h.html

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Minimal set of Generators(basis) for an ideal/module

2011-09-29 Thread Martin Albrecht
On 29 September 2011 09:44, Volker Braun  wrote:
> I don't know if this particular function is wrapped in Sage.

Yes it is, as almost any function in Singular, thanks to the Singular function
interface :)

Using the example from

http://www.singular.uni-kl.de/Manual/latest/sing_266.htm

sage: P. = PolynomialRing(GF(181),order='neglex')
sage: I = Ideal(x^2+x*y*z,y^2-z^3*y,z^3+y^5*x*z)
sage: from sage.libs.singular.function_factory import singular_function
sage: maxideal = singular_function('maxideal')
sage: J = maxideal(3,ring=P)+I
sage: minbase = singular_function('minbase')
sage: minbase(J)
[x^2, x*y*z, x*z^2, y^2, y*z^2, z^3]

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: how does one do this in Cython?

2011-09-01 Thread Martin Albrecht
Funny you should ask because this was just fixed at SD32 where we ran
into each other:

http://trac.sagemath.org/sage_trac/ticket/11680

once it is merged you can write $SAGE_ROOT in these pragmas :)

On 31 August 2011 19:17, john_perry_usm  wrote:
> Hi Martin,
>
> Sorry for the long reply; I looked at the solution a long time ago &
> it seems to work. A natural question, naturally :-) is there an easier
> way to specify the include directory? after all, this changes by
> machine & version.
>
> john
>
> On Jul 25, 8:34 am, Martin Albrecht 
> wrote:
>> Hi John,
>>
>> see attachment. You'll have to change the cinclude path for it to work on 
>> your
>> machine.
>>
>> On Monday 25 July 2011, john_perry_usm wrote:
>>
>> > On Jul 25, 6:46 am, Martin Albrecht 
>>
>> > wrote:
>> > > You'll need to compile your extension module (i.e. your pyx file) with
>> > > C++ instead of C. See
>>
>> > >http://sagemath.org/doc/developer/coding_in_cython.html#special-pragmas
>>
>> > From that link, I understood that I need to prepend
>>
>> >     # clang: C++
>>
>> > to the file. I get the same errors.
>>
>> > john
>>
>> Cheers,
>> Martin
>>
>> --
>> name: Martin Albrecht
>> _pgp:http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
>> _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
>> _www:http://martinralbrecht.wordpress.com/
>> _jab: martinralbre...@jabber.ccc.de
>>
>>  singular.spyx
>> < 1KViewDownload
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Binary array to integer

2011-08-23 Thread Martin Albrecht
On Tuesday 23 August 2011, Tom Boothby wrote:
> Treat it as a binary number:
> 
> s = ''.join(str(i) for i in A)
> ZZ(s, base=2)

sage: Z((1,0),2)
1
sage: Z((1,1),2)
3
 
> On Tue, Aug 23, 2011 at 12:08 PM, Santanu Sarkar
> 
>  wrote:
> > Let A=(1,1,0,0,0,1) be an binary array. How efficiently can we calculate
> > the corresponding integer?
> > 
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/sage-support
> > URL: http://www.sagemath.org

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Bug: Finding kernel of a matrix over GF(2) seems to be broken.

2011-08-19 Thread Martin Albrecht
On Friday 19 August 2011, John H Palmieri wrote:
> On Friday, August 19, 2011 3:28:48 PM UTC-7, Simon King wrote:
> > Hi!
> > 
> > On 19 Aug., 23:32, Alastair Irving 
> > 
> > wrote:
> > > I get the same result as you so it does look like a bug.  I also tried
> > > putting algorithm="generic" into the call and got a different, but also
> > > wrong, answer.
> > 
> > What happens with the new version of M4RI? I gave it a positive review
> > a few hours ago (see #11574). Does it also fix that bug?
> 
> That seems to fix it for me!

Indeed, I can confirm this. I don't know which change in M4RI triggered the 
fix (i.e., we didn't explicitly work on kernels since 2009).

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: how does one do this in Cython?

2011-07-25 Thread Martin Albrecht
Hi John,

see attachment. You'll have to change the cinclude path for it to work on your 
machine.

On Monday 25 July 2011, john_perry_usm wrote:
> On Jul 25, 6:46 am, Martin Albrecht 
> 
> wrote:
> > You'll need to compile your extension module (i.e. your pyx file) with
> > C++ instead of C. See
> > 
> > http://sagemath.org/doc/developer/coding_in_cython.html#special-pragmas
> 
> From that link, I understood that I need to prepend
> 
> # clang: C++
> 
> to the file. I get the same errors.
> 
> john

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
#clang c++
#cinclude /home/malb/Sage/current/local/include/singular
#clib m readline singular givaro gmpxx gmp

from sage.rings.polynomial.multi_polynomial_libsingular cimport 
MPolynomial_libsingular

cpdef MPolynomial_libsingular add(MPolynomial_libsingular a, 
MPolynomial_libsingular b):
return a+b


Re: [sage-support] Re: how does one do this in Cython?

2011-07-25 Thread Martin Albrecht
On Monday 25 July 2011, john_perry_usm wrote:
> Thanks, William.
> 
> I don't know why I didn't try cimport on that other example; that
> certainly works with Rational.
> 
> But I shouldn't have simplified the example to that level. What I
> *really* want to cdef is MPolynomial_libsingular. Something like this:
> 
> from sage.rings.polynomial.multi_polynomial_libsingular cimport
> MPolynomial_libsingular
> 
> cpdef MPolynomial_libsingular add(MPolynomial_libsingular a,
> MPolynomial_libsingular b):
>   return a+b
> 
> But I get all kinds of errors. First a bunch like this:
> 
> -
> In file included from _Users_user_test_import_pyx_1.c:206:
> /Applications/Sage-4.6.2-OSX-64bit-10.6.app/Contents/Resources/sage/
> local/include/factory.h:29:20: error: iostream: No such file or
> directory
> In file included from /Applications/Sage-4.6.2-OSX-64bit-10.6.app/
> Contents/Resources/sage/local/include/factory.h:51,
>  from _Users_user_test_import_pyx_1.c:206:
> /Applications/Sage-4.6.2-OSX-64bit-10.6.app/Contents/Resources/sage/
> local/include/templates/ftmpl_array.h:19: error: expected ‘=’, ‘,’,
> ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
> /Applications/Sage-4.6.2-OSX-64bit-10.6.app/Contents/Resources/sage/
> local/include/templates/ftmpl_array.h:43: error: expected ‘=’, ‘,’,
> ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
> -
> 
> then more of other types.

You'll need to compile your extension module (i.e. your pyx file) with C++ 
instead of C. See

http://sagemath.org/doc/developer/coding_in_cython.html#special-pragmas

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Need arbitrary Singular term orders

2011-05-21 Thread Martin Albrecht
On Saturday 21 May 2011, Jeff Stroomer wrote:
> Kwankyu,
> 
> Thanks for the fix.  I tried to apply the patch against a clean copy
> of Sage-4.6.2, but ran into the following:
> 
> 
> sage: hg_sage.patch('trac_11316.patch')
> cd "/Applications/sage/devel/sage" && hg status
> cd "/Applications/sage/devel/sage" && hg status
> cd "/Applications/sage/devel/sage" && hg import   "/Users/jeff/
> trac_11316.patch"
> applying /Users/jeff/trac_11316.patch
> patching file sage/rings/polynomial/pbori.pyx
> Hunk #5 FAILED at 7057
> 1 out of 6 hunks FAILED -- saving rejects to file sage/rings/
> polynomial/pbori.pyx.rej
> abort: patch failed to apply
> sage:
> Exiting Sage (CPU time 0m0.07s, Wall time 11m54.95s).

The patch is meant to apply cleanly against the upcoming 4.7 release of Sage.

> I'm guessing you've been working against something other than plain
> sage-4.6.2, but don't know the details.  Can you give me any advice as
> to how I can get your patch to work?  Before a couple days ago I
> didn't realize it was possible to patch sage, so this is somewhat new
> to me.

You have two options:
1) Install 4.7 (either wait until it is out or install a release candidate)
2) Patch Sage like this

0) go to your sage directory
1) ./sage -sh # starts a Sage shell
2) cd ./devel/sage/sage/
3) hg qimport trac_11316.patch
4) hg qpush # it will print the same error as above, ignore it
5) ./sage -b

Essentially, you do the same thing as the Sage command you quote above, but 
you ignore the error (since it isn't really that important in this particular 
case)

For more details check:

http://sagemath.org/doc/developer/walk_through.html
http://hginit.com/

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Need arbitrary Singular term orders

2011-05-19 Thread Martin Albrecht
> Martin,

Hi Jeff,
 
> Thanks for getting back to me.  It might be possible for me to use the
> weighted orderings - I'll have to think about it a little.  I also
> thought I could use a matrix order, but when I try the following I
> don't get the answer I hoped to see:
> 
> T = TermOrder('M(-1,0,0,-1)')
> R = PolynomialRing(GF(101), names = 'x, y', order = T)
> x, y = R.gens()
> print '1 > x ? ' + str(1 > x)

Did you apply the patch?

> Suppose I hack the __init__ in term_order.py so that I force
> self.__singular_str to be what I want.  Would that solve my problem?
> And if the answer to that question is yes, then could a longer-term
> solution be to augment TermOrder objects so that a user can explicitly
> identify the underlying tool that the order is intended for?  The
> parsing that's currently done in the __init__ seems difficult.

The patch by Kwankyu Lee seems to allow that, i.e. you can give a Singular 
string an pass force=True, which *should* pass it through to Singular.

> No matter what, I am really grateful for the work that you and the
> rest of the Sage community have invested in this tool.  A lot of my
> research has come out of what I've been able to write in Sage.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Need arbitrary Singular term orders

2011-05-18 Thread Martin Albrecht
On Monday 16 May 2011, Jeff Stroomer wrote:
> Sage Folks,
> 
> I need to be able to use arbitrary Singular term orders.  This showed
> up as a Sage bug a couple years ago:
> 
> http://www.google.com/url?sa=D&q=http://trac.sagemath.org/sage_trac/ticket/
> 5326
> 
> Do you think this might get fixed soon?  I’m running Sage 4.6.2, which
> I think is the latest.The alternative for me is to code directly
> in Singular, or figure out how to hack around the limitation in
> term_order.py.

Hi, sorry for the late answer.

Somebody is working on weighted term orderings, not sure if that's sufficient 
for you:

http://trac.sagemath.org/sage_trac/ticket/11316

Furthermore, I was hoping the passing-the-term-order-through-to-singular-if-
it-is-unknown feature would just work, however, it seems our parsing gets in 
the way and throws an exception. However, it might be the case that the patch 
at #11316 fixes this issue as well.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] what's mpz_ function ?

2011-03-31 Thread Martin Albrecht
On Friday 01 April 2011, Justin C. Walker wrote:
> On Mar 31, 2011, at 14:45 , tvn wrote:
> > hi, I try to check the src code of some function, for example   gcd   --
> > and in the src implementation  I see references to  mpz_gcd   .  What is
> > mpz_* ? and how can I find it src code ?  thanks
> 
> Sounds like one of the multiprecision integer packages.  I'd start with
> libmpir, and maybe libntl, both of which are libraries used by Sage.

mpz_* are GMP functions or in Sage's case MPIR which is a fork of GMP:

See:

http://gmplib.org/
http://www.mpir.org/

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Multiple ideal membership

2011-03-27 Thread Martin Albrecht
AFAIK, there's no nice, Python-ic way to do this in Sage yet, since the 
relevant functionality of Singular has not been properly wrapped yet.

See

   http://www.singular.uni-kl.de/Manual/3-1-2/sing_131.htm#SEC171

for Singular's module capabilities. You can interact with Singular directly in 
Sage, by writing singular.eval("foo") to send the command foo.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Intersection of complex Ideals

2011-03-01 Thread Martin Albrecht
On Tuesday 01 March 2011, Simon King wrote:
> Hi Robert,
> 
> On 1 Mrz., 01:00, Robert Goss  wrote:
> > I have 2 ideals over the complex field and I would like to take their
> > intersection. If I try and use the intersection method on one of the
> > ideals i get an error message from singular stating the following type
> > error:
> > 
> > TypeError: Cannot call Singular function 'intersect' with ring
> > parameter of type ' > 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_dom
> > ain'>'
> 
> Sage uses a C-library version of Singular to do intersection
> (libSingular), but...
> 
> > This was generated by the code:
> > R. = PolynomialRing(CC, 2)
> 
> ... unfortunately it does not use libSingular for rings with complex
> coefficients:

I started changing that (only RR so far) in:

http://trac.sagemath.org/sage_trac/ticket/7577

but the ticket got stuck because we need to decide whether it's okay to use 
MPF instead of MPFR for multivariate polynomials.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: multivariate polynomial division

2011-02-28 Thread Martin Albrecht
On Monday 28 February 2011, dmharvey wrote:
> On Feb 27, 5:29 pm, Martin Albrecht 
> 
> wrote:
> > sage: R. = PolynomialRing(QQ)
> > sage: f = x0^2*x1 + x1^2*x2 + x2^2*x3 + x3^2*x0
> > sage: (f0, f1, f2, f3) = [f.derivative(v) for v in [x0, x1, x2, x3]]
> > sage: I = R.ideal(f0, f1, f2, f3)
> > sage: h = x0^5
> > sage: h.lift(I)
> > [-x0^2*x2 - 4/15*x0*x1*x3, x0^3 + 8/15*x1^2*x3 + x2*x3^2,
> > -16/15*x1*x2*x3, 2/15*x1*x3^2]
> 
> excellent, thanks Martin!
> 
> but what a funny name, "lift"...? I stared at the auto-complete lists
> for a while and never noticed that one.

AFAIK it's a standard name for this operation in commutative algebra. What 
name would have allowed you to spot it?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] multivariate polynomial division

2011-02-27 Thread Martin Albrecht
On Sunday 27 February 2011, dmharvey wrote:
> Hi,
> 
> sage: R. = PolynomialRing(QQ)
> sage: f = x0^2*x1 + x1^2*x2 + x2^2*x3 + x3^2*x0
> sage: (f0, f1, f2, f3) = [f.derivative(v) for v in [x0, x1, x2, x3]]
> sage: I = R.ideal(f0, f1, f2, f3)
> sage: h = x0^5
> sage: h in I
> sage: True

Hi David,

sage: R. = PolynomialRing(QQ)
sage: f = x0^2*x1 + x1^2*x2 + x2^2*x3 + x3^2*x0
sage: (f0, f1, f2, f3) = [f.derivative(v) for v in [x0, x1, x2, x3]]
sage: I = R.ideal(f0, f1, f2, f3)
sage: h = x0^5
sage: h.lift(I)
[-x0^2*x2 - 4/15*x0*x1*x3, x0^3 + 8/15*x1^2*x3 + x2*x3^2, -16/15*x1*x2*x3, 
2/15*x1*x3^2]

sage: h.lift(I.gens())
[-x0^2*x2 - 4/15*x0*x1*x3, x0^3 + 8/15*x1^2*x3 + x2*x3^2, -16/15*x1*x2*x3, 
2/15*x1*x3^2]

sage: h.lift(I.groebner_basis())
[0, 0, 0, 0, x0*x2, x0^3, -2*x0^2*x2, 0, 0]

sage: sum(map(prod,zip(I.groebner_basis(),h.lift(I.groebner_basis()
x0^5

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] GF(2) -Grobner Basis - How to force x^2 = x ?

2011-02-04 Thread Martin Albrecht
Hi, I know of no elegant way of doing that. There are a few ANF
(polynomials) to CNF (ORs and ANFs) strategies which are used for example in
cryptography. Those might be of interrest to you. I have a few pointers in
my thesis.

Cheers,
Martin
On Feb 4, 2011 6:12 PM, "Francois Maltey"  wrote:

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] GF(2) -Grobner Basis - How to force x^2 = x ?

2011-02-03 Thread Martin Albrecht
On Thursday 03 February 2011, Francois Maltey wrote:
> Thomas Gueuning wrote :
> > When I use this code, I don't understand why y^3 is still there
> > because I think this is equal to y for both 0 and 1. So why the
> > Groebner basis is [y^3 + y, x^2 + y^2 + 1, x*y] and not [x+y+1,x*y],
> > which should be reduced to [x+y+1]. I tried to add a modulus but it
> > does'nt seem to work. I am quite disappointed because all the interest
> > of Groebner basis in cryptanalysis is that the degree of polynomes
> > don't grow a lot due to the fact that x^2 + x =0.
> 
> You also can type :
> 
> sage: RR. = GF(2)[]  # it means that variables are x and y.
> 
> You may add ideal generators : y^2-y and x^2-x.
> In the polynomial space x^2 != x : degree aren't the same.
> But in the quotient you have x^2=x as you expect if x==0 or x==1.
> 
> Then the Groebner basis is almost what you want :
> 
> sage: ideal([x**2+y**2+1,x*y,x^2-x,y^2-y]).groebner_basis()
> [y^2 + y, x + y + 1]
> 
> The second polynom is x+y+1 and you may forgot y^2+y.
> 
> I don't know how you can proof that you get exactly the right result.
> Order over degree changes the Groebner basis...
> 
> 
> F. who maybe makes a mistake...

Hi,

perhaps a look at the introduction of

   http://www.sagemath.org/doc/reference/sage/rings/polynomial/pbori.html

will help to clarify things a bit (also in terms of what you use in Sage) 

Let P = F[x_1,...,x_n]. Essentially, there is a one-to-one correspondence 
between ideals I in P/Q and J = I + Q if Q is an ideal in P. 

Since the OP mentions cryptanalysis I assume he wants to solve systems of 
equations over the base field GF(2). In this case, the quotient P/ is precisely the right one to use since x_i^2 - x_i has the 
roots 0, 1 and no root in the extension. Thus, the only possible solutions to 
the common system have components in GF(2).

More details for example in my thesis (Section 3.6): 
http://martinralbrecht.files.wordpress.com/2010/10/phd.pdf

Cheers,
Martin


-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] GF(2) -Grobner Basis - How to force x^2 = x ?

2011-02-03 Thread Martin Albrecht
On Thursday 03 February 2011, Thomas Gueuning wrote:
> First of all, congratulations for this free and wonderfull software.
> 
> I have a question about GF(2).This is maybe a bit stupid but I cannot find
> the answer anywere.
> 
> When I use this code, I don't understand why y^3 is still there because I
> think this is equal to y for both 0 and 1. So why the Groebner basis is
> [y^3 + y, x^2 + y^2 + 1, x*y] and not [x+y+1,x*y], which should be reduced
> to [x+y+1]. I tried to add a modulus but it does'nt seem to work. I am
> quite disappointed because all the interest of Groebner basis in
> cryptanalysis is that the degree of polynomes don't grow a lot due to the
> fact that x^2 + x =0.
> 
> sage: Q. = PolynomialRing(GF(2))
> sage: R2 = GF(2,name='x,y')
> sage: R2
> Finite Field of size 2
> sage: e=[x**2+y**2+1,x*y]
> sage: e
> [x^2 + y^2 + 1, x*y]
> sage: I=ideal(e)
> sage: I
> Ideal (x^2 + y^2 + 1, x*y) of Multivariate Polynomial Ring in x, y over
> Finite Field of size 2
> sage: B=I.groebner_basis(); B
> [y^3 + y, x^2 + y^2 + 1, x*y]
> 
> So my question is : why SAGE doesn't take into account the fact that x^2 =
> x in GF(2) and how do force him to do it.

You are confusing the ring P = F_2[x,y] with the ring 

 Q = F_2[x,y]/,

that is the polynomial ring over GF(2) with the Boolean polynomial ring. In 
the former, x^2 is not reduced by x, but that happens in the latter. In sage 
you should construct 

B. = BooleanPolynomialRing()

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] polynomial interpolation

2010-12-24 Thread Martin Albrecht
On Friday 24 December 2010, lainme wrote:
> Hi, I want to do polynomial interpolation with sage, such as the
> Lagrange Interpolation
> 
> I searched the group and reference manual of sage, but only found the
> complex interpolation.
> 
> Does there a simple way to do this?

sage: K = GF(32003)
sage: P. = K[]
sage: P.lagrange_polynomial([(K.random_element(),K.random_element()) for _ in 
range(10)])
25484*x^9 + 16230*x^8 + 21258*x^7 + 5369*x^6 + 5329*x^5 + 26390*x^4 + 
18568*x^3 + 24278*x^2 + 26684*x + 4684

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Bug in genus of an ideal

2010-11-23 Thread Martin Albrecht
On Tuesday 23 November 2010, VictorMiller wrote:
> Thanks!  Then perhaps Sage should raise an exception when it gets back
> genus -1 from singular.

Here's what Hannes Schönemann from the Singular team replied to me when I 
reported this on [libsingular-devel]:

"""
Singular uses (currently) 32bit int on all platforms.
Here our overflow detection represents -1 as a result of a subtraction
as 4294967295.
Fix (in Singular/iparith.cc, routine jjMINUS_I):
--- iparith.cc  (Revision 13661)
+++ iparith.cc  (Arbeitskopie)
@@ -697,14 +697,18 @@
}
static BOOLEAN jjMINUS_I(leftv res, leftv u, leftv v)
{
-  unsigned int a=(unsigned int)(unsigned long)u->Data();
-  unsigned int b=(unsigned int)(unsigned long)v->Data();
+  void *ap=u->Data(); void *bp=v->Data();
+  int aa=(int)(long)ap;
+  int bb=(int)(long)bp;
+  int cc=aa-bb;
+  unsigned int a=(unsigned int)(unsigned long)ap;
+  unsigned int b=(unsigned int)(unsigned long)bp;
   unsigned int c=a-b;
  if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
  {
 WarnS("int overflow(-), result may be wrong");
  }
-  res->data = (char *)((long)c);
+  res->data = (char *)((long)cc);
   return jjPLUSMINUS_Gen(res,u,v);
}
"""

It seems with the new patch the overflow would at least be detected? Can you 
give it a try?

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: size of varities

2010-10-13 Thread Martin Albrecht
On Wednesday 13 October 2010, Simon King wrote:
> Hi Martin!
> 
> On 13 Okt., 15:12, Martin Albrecht 
> 
> wrote:
> > >   sage: I.radical().vector_space_dimension()
> > >   6
> > > which would raise a TypeError if the ideal was not zero dimensional.
> > 
> > We should probably change that to be a ValueError, since the "value" of
> > the ideal is wrong, not the type?
> 
> I think we should simply return +Infinity.

This is now

http://trac.sagemath.org/sage_trac/ticket/10128

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: size of varities

2010-10-13 Thread Martin Albrecht
>   sage: I.radical().vector_space_dimension()
>   6
> which would raise a TypeError if the ideal was not zero dimensional.

We should probably change that to be a ValueError, since the "value" of the 
ideal is wrong, not the type?

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] initial ideal

2010-10-10 Thread Martin Albrecht
On Sunday 10 October 2010, andrew ewart wrote:
> how do i generate the initial ideal of a reduced grobner basis?



sage: P. = PolynomialRing(QQ)
sage: I = sage.rings.ideal.Katsura(P)
sage: gb = I.groebner_basis()
sage: J = Ideal(f.lm() for f in gb)
sage: J
Ideal (z^3, y^2, y*z, x) of Multivariate Polynomial Ring in x, y, z over 
Rational Field

Is that what you want?
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] grobner bases

2010-10-09 Thread Martin Albrecht
On Saturday 09 October 2010, andrew ewart wrote:
> whats the best way to code the following
> I want a print out of a grobner basis for an ideal I generated by the
> polynomials
> 
> this is respect to the reverse lexicographic and lexicographic order

sage: P. = PolynomialRing(QQ,order='neglex')
sage: I = Ideal(x^5 + y^4 +z^3, x^3 + y^2 + z^2 -1)
sage: I.groebner_basis()
[1]

See

http://sagemath.org/doc/reference/sage/rings/polynomial/multi_polynomial_ideal.html

Martin


-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] converting RealLiteral to str without trailing zero's

2010-07-22 Thread Martin Albrecht
sage: str(0.53253453425).rstrip(".0")
'0.53253453425'
sage: str(2).rstrip(".0")
'2'


On 22 July 2010 22:26, tvn  wrote:
> is there a trick to convert RealLiteral  numbers to strings without
> the trailing zeros?  e.g., 2. and 0.050 become 2
> and 0.05 respectively  --
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


  1   2   3   >