Re: [sage-support] Question related to Sagemath permission on Github

2024-01-21 Thread Dima Pasechnik



On 21 January 2024 12:25:23 GMT, Juan Grados  wrote:
>I have a question about how you deal with deletion policies in Sagemath.
>Specifically, I plan to create a repository with many people involved. This
>repo MUST have several admins (who can potentially delete the repo). To
>protect the repo from arbitrary deletion, I need to know if Github allows
>adding a rule to avoid a repository being deleted by a single person. In
>other words, I need to know if there is a way to add a rule where others
>must agree each time one wants to delete a repo. Do you know that? or have
>you had the same question in Sagemath? If so, how do you solve it?

I don't know for sure (I would be surprised if they had this feature), but you 
can just 
have a mirror for this repository (which is a good idea regardless).

HTH
Dima

>
>Thanks in advance for your time.
>-
>D.Sc. Juan del Carmen Grados Vásquez
>Laboratório Nacional de Computação Científica
>Tel: +55 21 97633 3228
>(http://www.lncc.br/)
>http://juaninf.blogspot.com
>-
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/242C8FA2-0558-40B6-A186-932C39F80CBE%40gmail.com.


[sage-support] Question related to Sagemath permission on Github

2024-01-21 Thread Juan Grados
I have a question about how you deal with deletion policies in Sagemath.
Specifically, I plan to create a repository with many people involved. This
repo MUST have several admins (who can potentially delete the repo). To
protect the repo from arbitrary deletion, I need to know if Github allows
adding a rule to avoid a repository being deleted by a single person. In
other words, I need to know if there is a way to add a rule where others
must agree each time one wants to delete a repo. Do you know that? or have
you had the same question in Sagemath? If so, how do you solve it?

Thanks in advance for your time.
-
D.Sc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CABhJSp%3DZPf5dA%2BsZgD8pdwj3%2B_%3Dm-jepSrtQMs7mJ5DnwWxYxA%40mail.gmail.com.


[sage-support] Question about cysignals installation

2023-08-16 Thread JC
Dear Sage developers,

I'm trying to install the cysignals 1.11.2 package in Python 3.9.7 using 
pip (on a computer with macOS system and Apple M2 chip) and have already 
installed the prerequisite packages Cython and Sphinx, but still failed 
with some Cython compiling errors (please see the error message attached). 
Do you know what the problem might be and how I can fix it?

Thank you very much!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/efb78184-51f5-4ac3-aeca-7601b9f84191n%40googlegroups.com.


cysignals_output
Description: Binary data


[sage-support] Question about solving polynomial system over RR in sage

2021-08-22 Thread Juan Grados
I would like to solve a polynomial system over RR in sage. See the toy
example below

>>> var_names = ['xor_0_7_x0', 'xor_0_7_x12', 'xor_0_7_y0']
>>> nvars = 3
>>> R=PolynomialRing(RealField(53), nvars, var_names, order="degneglex")
>>> a=R.gens()[0]+R.gens()[1]+R.gens()[2]
>>> b=R.gens()[0]-R.gens()[1]*R.gens()[2]
>>> s=[a,b]
>>> s=Sequence([a,b])
>>> s.solve()

I just defined two polynomial from $R$. But when I tried to solve this
system I get AttributeError: 'Sequence_generic' object has no attribute
'solve'
-
D.Sc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CABhJSpkWEUnaud7nR4HcN1mpOjUa97JU9KPWEuPJRfu9d7%3D7bQ%40mail.gmail.com.


Re: [sage-support] question about exercise

2020-09-16 Thread Emmanuel Charpentier
Le mercredi 16 septembre 2020 à 23:39:33 UTC+2, rachel...@gmail.com a 
écrit :

> I dont know how to code in python
>

That may be the point  of the exercise, don't you think ?
 
HTH,


On Wednesday, September 16, 2020 at 5:27:01 PM UTC-4 dim...@gmail.com wrote:
>
>> On Wed, Sep 16, 2020 at 10:24 PM Rachel King  
>> wrote: 
>> > 
>> > The textbook for a course I am taking says the following, 
>> > Suppose you have three tests in your linear algebra class and your 
>> scores are 90, 100, and 98. In the Sage cell below, add your scores 
>> together and call the result total. On the next line, find the average of 
>> your test scores and print it. 
>> > 
>> > How would this look typed in sage? 
>>
>> basically, the same as if it was typed in Python. 
>>
>> > 
>> > -- 
>> > 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...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/7edcc588-657f-4589-bcf7-9fa526e06949n%40googlegroups.com.
>>  
>>
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/bab531f4-f025-46db-ba49-ab51f47461een%40googlegroups.com.


Re: [sage-support] question about exercise

2020-09-16 Thread Rachel King
I dont know how to code in python

On Wednesday, September 16, 2020 at 5:27:01 PM UTC-4 dim...@gmail.com wrote:

> On Wed, Sep 16, 2020 at 10:24 PM Rachel King  wrote:
> >
> > The textbook for a course I am taking says the following,
> > Suppose you have three tests in your linear algebra class and your 
> scores are 90, 100, and 98. In the Sage cell below, add your scores 
> together and call the result total. On the next line, find the average of 
> your test scores and print it.
> >
> > How would this look typed in sage?
>
> basically, the same as if it was typed in Python.
>
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/7edcc588-657f-4589-bcf7-9fa526e06949n%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/3d6878c2-0280-4016-aaa8-1f73fefde334n%40googlegroups.com.


Re: [sage-support] question about exercise

2020-09-16 Thread Dima Pasechnik
On Wed, Sep 16, 2020 at 10:24 PM Rachel King  wrote:
>
> The textbook for a course I am taking says the following,
> Suppose you have three tests in your linear algebra class and your scores are 
> 90, 100, and 98. In the Sage cell below, add your scores together and call 
> the result total. On the next line, find the average of your test scores and 
> print it.
>
> How would this look typed in sage?

basically, the same as if it was typed in Python.

>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/7edcc588-657f-4589-bcf7-9fa526e06949n%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq1Qme9xqsUGJDjGXKUiq9T5pkvknQSQeTq_vDMf68M39A%40mail.gmail.com.


[sage-support] question about exercise

2020-09-16 Thread Rachel King
The textbook for a course I am taking says the following,
Suppose you have three tests in your linear algebra class and your scores 
are 90, 100, and 98. In the Sage cell below, add your scores together and 
call the result total. On the next line, find the average of your test 
scores and print it.

How would this look typed in sage?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/7edcc588-657f-4589-bcf7-9fa526e06949n%40googlegroups.com.


[sage-support] Question about a deprecation warning

2020-07-01 Thread John H Palmieri
This puzzles me: evaluating '\i' in Python 3 just gives '\i'. Same with 
IPython. Evaluating it in Sage prints many warning messages: the following 
is from a fresh Sage session, and I only evaluated '\i' once, despite the 
appearance:


% sage
┌┐
│ SageMath version 9.2.beta2, Release Date: 2020-06-26   │
│ Using Python 3.7.7. Type "help()" for help.│
└┘
┏┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗┛
sage: '\i':1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
sage: '\i'
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape 
sequence \i
  '\i'
'\\i'
sage: 


Why so many deprecation warnings? I think they're coming from plain Python; 
why doesn't Python print the warnings?

-- 
John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/0a45ea8f-0062-4aad-b4d9-0b12a175daf9o%40googlegroups.com.


[sage-support] Question about upgrading.

2017-01-13 Thread Thierry Dumont
Today, I have tried to upgrade from 7.4 to 7.5 (git pull; make ...)

I have a problem with the optional package coxeter3 (it does not compile).

Before trying to solve this problem with coxeter, I would like to know
if there is a canonical way to remove coxeter3 from sage tree to finish
the build correctly. coxeter3 appears there:

./upstream/coxeter3-1.1.tar.gz
./local/var/tmp/sage/build/coxeter3-1.1
./local/lib/python2.7/site-packages/sage/libs/coxeter3
./logs/pkgs/coxeter3-1.1.log
./build/pkgs/coxeter3
./src/sage/libs/coxeter3
./src/build/cythonized/sage/libs/coxeter3
./src/build/temp.linux-x86_64-2.7/sage/libs/coxeter3
./src/build/lib.linux-x86_64-2.7/sage/libs/coxeter3

Is is ok to remove all this before doing make again or is there
something cleaner ?

t.

-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
<>

Re: [sage-support] Question regarding normalization of modular symbols.

2016-11-09 Thread John Cremona
On 9 November 2016 at 00:25, francisco  wrote:
> Hello,
>
> I have been computing modular symbols for distinct curves on the Cremona
> data base.
> But, in a few curves, I recived a WARNING messages like this:
>
> Warning : Could not normalize the modular symbols, maybe all further
> results will be multiplied by -1, 2 or -2.
>
> Why sage does not give the exact normalization? Is there a theoretical
> reason?
> How sage normalize modular symbols?

This may be related to https://trac.sagemath.org/ticket/10256 .  The
answer to your last question is that it depends on whether they are
computed using Sage itself (slower) or my code (=eclib).

John Cremona

>
>
> --
> 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 https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

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


[sage-support] Question regarding normalization of modular symbols.

2016-11-08 Thread francisco
Hello,

I have been computing modular symbols for distinct curves on the Cremona 
data base.
But, in a few curves, I recived a WARNING messages like this:

Warning : Could not normalize the modular symbols, maybe all further
results will be multiplied by -1, 2 or -2.

Why sage does not give the exact normalization? Is there a theoretical 
reason?
How sage normalize modular symbols? 


-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Question about write_lp

2016-06-07 Thread Jernej
Hello,

I think there might be a bug in how write_lp handles the objective 
function. Consider the following simple ILP formulation for signed 
domination 

===
def signed(G):
I = MixedIntegerLinearProgram(maximization=false)
x = I.new_variable(binary=True)
for u in G:
I.add_constraint(I.sum(2*x[v]-1 for v in (G[u]+[u])) >=1 )
I.set_objective(I.sum(2*x[u]-1 for u in G))
return I
===

The respective formulation for the Petersen graph gives the following 
objective function,

===
G = graphs.PetersenGraph()
I = signed(G)
I.show()

Minimization:

2.0 x_0 + 2.0 x_1 + 2.0 x_2 + 2.0 x_3 + 2.0 x_4 + 2.0 x_5 + 2.0 x_6 + 2.0 x_7 + 
2.0 x_8 + 2.0 x_9 - 10.0

.

===


which is fine. Now if we write the LP problem to a file the subtracted constant 
is missed:


===

I.write_lp('foo')

$ cat foo.lp

Minimize
obj: 2 x0 + 2 x1 + 2 x2 + 2 x3 + 2 x4 + 2 x5 + 2 x6 + 2 x7 + 2 x8 + 2 x9

.

===


Hence by solving this LP in Sage or with a *.lp solver, one obtains different 
results. Am I missing something or is this a bug in write_lp?


Best,


Jernej






-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Question about Boolean Formulas

2015-12-09 Thread Juan Grados
Dears members,
I have two question about the package sage.logic.booleval of SAGE.

1.-In the documentation of that package I have found a similar formula of
this "t = ['&', ['|', 'a', 'b'], ['|', 'a', 'c']]". My question is it is
posible to write three literals in each clause?
2.-In that documentation I have found too the next code,

> import sage.logic.booleval as booleval
> t = ['|', ['&', 'a', 'b'], ['|', 'a', 'c']]

d = {'a' : True, 'b' : False}
> print booleval.eval_formula(t', d)
>

my question is if I want to evaluate that formula, it is possible to
evaluate that without all assignments for each variable of the formula? I
make this question because when I run that codeI obtain the next error, but
it is easy to see that it is only necessary to know that 'a' : True, to say
that t is True.Is there some other package to simulate reductions of this
type?

Traceback (click to the left of this block for traceback)
...
KeyError: 'c'





-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about Casting over Finite Field

2015-08-09 Thread Juan Grados
I have declared the finite Field K and the equation e. How I can
cast the equation e to finite field K.?

K=GF(2)
e = 0==r1405 + 97557948918122409/154603142862411371*r1406 -
26113332388244438/463809428587234113*r1408 +
180996540766820643/154603142862411371*r1409

thanks

-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 Casting over Finite Field

2015-08-09 Thread Justin C. Walker

On Aug 9, 2015, at 13:31 , Juan Grados wrote:

 I have declared the finite Field K and the equation e. How I can
 cast the equation e to finite field K.?
 
 K=GF(2)
 e = 0==r1405 + 97557948918122409/154603142862411371*r1406 -
 26113332388244438/463809428587234113*r1408 +
 180996540766820643/154603142862411371*r1409

Does this help?

K=GF(2)
Kz.z=PolynomialRing(K)
Qx.x=PolynomialRing(Rationals())
f=x^3-1
f1=Kz(f)

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income

When LuteFisk is outlawed,
Only outlaws will have LuteFisk




-- 
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] Question about Free algebra

2015-06-08 Thread Viviane Pons
Hi everyone,

I'm doing this:

sage: FreeA.a,b,c,d,e,f = FreeAlgebra(QQ,implementation=letterplace)
sage: P = a*b*a*c*c*b + a*b*a*d*d*b + a*c*a*d*d*c + b*c*b*d*d*c
sage: X = P.lm()
sage: X
a*b*a*c*c*b

And now I would like a way to cut my element X into two factors of a
given size. Something like

sage: u,v = X[:2],X[2:]

with then u=a*b and v = a*c*c*d

except this doesn't work (no __getitem__ on X). I have looked a bit, but I
cannot find how to do this even though it seems quite a natural operation.
I must say, I don't even understand the datastructure of X, list(X) doesn't
give me something I can easily read or transform into a word or anything...

If someone knows about this, I would appreciate the help.

Thank you

Best

Viviane

-- 
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] Question mark failed on Sage toplevel

2015-06-08 Thread François Colas
Hello everyone,

I'm facing an error with the question mark after any kind of function. Here 
is an error log with 'PolynomialRing' : 
https://gist.github.com/anonymous/f9adbc3ec08dac0892a6

I cannot access the documentation with '?' but it works with :

sage: help(PolynomialRing)

I'm running Manjaro Linux (an arch-based distribution) with these packages 
installed :

- community/sagemath 6.7-1
- extra/python2 2.7.10-1
- community/ipython2 3.1.0-1

Everything used to work before some updates... (Sage 6.6 - 6.7?)

Any ideas on how I could fix that?

-- 
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 subs in PolynomialSequence

2014-08-31 Thread Vincent Delecroix
Hi Juan,

 I'm trying to use subs method in PolynomialSequence, but when I doing that
 I get the same PolynomialSequence. For example in code below my polynomial
 sequence PS has only one polynomial (P) ... I'm trying to use subs but I
 get the same polynomial. Where is wrong?

The thing is that PS.subs(...) does *not* modify PS. It only returns a
new polynomial sequence with the substitution done. You should have
done at the end

PS_sub = PS.subs({R.gens()[0]:1,R.gens()[1]:1})
print PS_sub

Vincent

-- 
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] Question about subs in PolynomialSequence

2014-08-30 Thread Juan Grados
Dears members,

I'm trying to use subs method in PolynomialSequence, but when I doing that
I get the same PolynomialSequence. For example in code below my polynomial
sequence PS has only one polynomial (P) ... I'm trying to use subs but I
get the same polynomial. Where is wrong?

reset()
from sage.rings.polynomial.multi_polynomial_sequence import
PolynomialSequence
namesP=[X%d%i for i in [0..2]]
R = BooleanPolynomialRing(len(namesP), namesP)
P = R.random_element()
PS = PolynomialSequence([P],R)
print PS
PS.subs({R.gens()[0]:1,R.gens()[1]:1})
print PS

-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question About Finite Field propertie in polynomial ring

2014-08-28 Thread Juan Grados
Dears members,

Let be the field
q = 2
K.t = GF(q^n)
and the Polynomial Ring
PR = PolynomialRing(K,X)
Let be a random monomial of PR for example
P = t*X^(q^a).
Is there any method in sage to reduce X degree of polynomial P, such that
equivalent polynomial is t*X^(q^b) where b = mod(P.degree(X)-1,n)

-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about solve_sat

2014-08-27 Thread Juan Grados
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
-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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.


polynomialSequece
Description: Binary data


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.


[sage-support] Question about SAT solver

2014-08-12 Thread Juan Grados
Dears members,

I'm trying to understand why the solver not found solution in this code

R.x,y,z,w = 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

-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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.x,y,z,w = 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.


[sage-support] Question about ortogonal subspaces

2014-07-15 Thread Juan Grados
Dears members,

I trying to solve the next problem. Let be the chain of subspaces
J1 \subset J2 \subset J3 \subset J4 over the finite field GF(3), where
dim(J1) = 2, dim(J2) = 4, dim(J3) = 6 and dim(J4)=8. I want extract the
basis vector of the subspace J4-J3, J3-J2 and J2-J1. For J4-J3 I get using
the next code

K.t = GF(3)
J3vectors
= 
[[1,0,0,0,0,1,0,1],[0,1,0,0,0,1,0,0],[0,0,1,0,0,2,0,2],[0,0,0,1,0,0,0,2],[0,0,0,0,1,1,0,1],[0,0,0,0,0,0,1,1]]
J3 = span(K,J3vectors)
transpose(J3.basis_matrix()).kernel()

But I don't know How I will be able to obtain J3-J2 and J2-J1, with J3, J2 .




-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] question about hg (newbie)

2014-05-12 Thread J.A. Ketch
I install sage in ubuntu using the following commands:

$apt-add-repository -y ppa:aims/sagemath
$apt-get update
$apt-get install sagemath-upstream-binary

I run sage and gave
sage: hg_sage.status()

NameError Traceback (most recent call last)
ipython-input-1-adb4d8729242 in module()
 1 hg_sage.status()

why?

-- 
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 hg (newbie)

2014-05-12 Thread Kannappan Sampath
Hi Ketch,

What version of Sage have you installed? I ask because Sage has since v6.0
moved to using GIT for version control...

--Kannappan.


On Mon, May 12, 2014 at 1:12 AM, J.A. Ketch jketch12...@gmail.com wrote:

 I install sage in ubuntu using the following commands:

 $apt-add-repository -y ppa:aims/sagemath
 $apt-get update
 $apt-get install sagemath-upstream-binary

 I run sage and gave
 sage: hg_sage.status()

 NameError Traceback (most recent call last)
 ipython-input-1-adb4d8729242 in module()
  1 hg_sage.status()

 why?

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


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


Re: [sage-support] question about hg (newbie)

2014-05-12 Thread kcrisman


On Monday, May 12, 2014 6:48:24 AM UTC-4, KnS wrote:

 Hi Ketch, 

 What version of Sage have you installed? I ask because Sage has since v6.0 
 moved to using GIT for version control...

 --Kannappan. 


And more importantly, where did you find documentation still using hg? That 
will work fine for older versions of Sage, but will not work at all in 
newer ones, and as far as I know isn't in the latest documentation online.

- kcrisman

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


Re: [sage-support] question about hg (newbie)

2014-05-12 Thread J.A. Ketch
thank you all for the answers
the version of my sage is : Sage Version 6.1.1, Release Date: 2014-02-04, 
so I can not use hg. Some sites for the development refers to hg and not to 
git. For instance
http://combinat.sagemath.org/doc/thematic_tutorials/tutorial-how-to-contribute.html,
 
but is old. Yes the official documentations refers to git not to hg.  Thank 
you.


On Monday, May 12, 2014 4:42:31 PM UTC+3, kcrisman wrote:



 On Monday, May 12, 2014 6:48:24 AM UTC-4, KnS wrote:

 Hi Ketch, 

 What version of Sage have you installed? I ask because Sage has since 
 v6.0 moved to using GIT for version control...

 --Kannappan. 


 And more importantly, where did you find documentation still using hg? 
 That will work fine for older versions of Sage, but will not work at all in 
 newer ones, and as far as I know isn't in the latest documentation online.

 - kcrisman


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


[sage-support] question

2014-03-24 Thread Wilcox, Walter

Is anyone there?

I am trying to get sage to understand latex input. I get an error saying that 
pdflatex is not installed. How do I do this on a Mac? I have texlive and 
texshop installed.

-Walter Wilcox

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

2014-03-24 Thread David Joyner
On Mon, Mar 24, 2014 at 10:05 AM, Wilcox, Walter
walter_wil...@baylor.edu wrote:

 Is anyone there?

 I am trying to get sage to understand latex input. I get an error saying
 that pdflatex is not installed. How do I do this on a Mac? I have texlive
 and texshop installed.

I'm not sure what you mean.

Can you give an example of the input and expected output?



 -Walter Wilcox

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

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


Re: [sage-support] Question about FastFourierTransform

2013-05-28 Thread David Joyner
On Tue, May 28, 2013 at 10:46 AM, Thierry Dumont
tdum...@math.univ-lyon1.fr wrote:
 Hi,
 I am experimenting with fast Fourier Transform in Sage.
 It seems there are different possibilities.

 1) There is: FastFourierTransform
 FastFourierTransform(size, base_ring=None)

 2) One can simply do:
 v = vector(CDF,[1..10]);
 v.fft()

 3) One can directly use scipy/numpy which seems to use the gsl code.

 My experiments show very different performances at least with large
 sequences (10^6).
 My questions:

 a) Do all these methods call the same routine (gsl/)?
   In that case, different performances are certainly a consequence of the
 data management, input data types...

 b) Where is FastFourierTransform defined? I could not find any script with
 this name.

In sage/gsl/dft.py there are some docstrings which give a hint as to a
description of the fft.



 Yours
 t.d.

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



-- 
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.




[sage-support] Question on Partitions/Compositions/IntegerVectors

2013-04-29 Thread Andrew Juell
Suppose I want to generate partitions that are in an arithmetic progression 
with a particular step size...seems straightforward enough, so I just set 
max_slope and min_slope to that step size.  Is this interpretation correct?

Ps=Partitions(11,max_slope=-1, min_slope=-1)
print Ps.cardinality()
for P in Ps:
print P

I expected this to produce

2
[11]   
[5,6]

but it also appears to include the partition
[4,3,3]

and this behavior seems to persist in IntegerVectors and Compositions as 
well.  Am I using the functions correctly?  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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Question about MPI4PY + SAGE

2012-09-09 Thread juaninf
Dears members,

I want know if SAGE, used with mpi4py, support distribuited programming i.e 
distruited memory for example ...


atte

Juan


-- 
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.




[sage-support] Question about sage-5.1-linux-64bit-ubuntu_8.04.4_lts-x86_64-Linux.tar.gz

2012-07-25 Thread Daniel M.
Any one knows if *
sage-5.1-linux-64bit-ubuntu_8.04.4_lts-x86_64-Linux.tar.gz*http://sagemath.c3sl.ufpr.br/linux/64bit/sage-5.1-linux-64bit-ubuntu_8.04.4_lts-x86_64-Linux.tar.gz
 
precompiled binaries needs the libc6 version 2.14 to run?

I'm using Debian Testing and the (latest) version avaible of the library *
libc6* is the 2.13, and i would like to use a sage version that i don't 
have to compile in my netbook, i would take hours!

Many thanks for your help!


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

2012-06-30 Thread Juan Grados
Dears members,

How I will can get the coefficients list in Fraction Field. When I write
p.lis() i obtained this message:

'FractionFieldElement_1poly_field' object has no attribute 'list'

-- 
-
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about sorted

2012-04-29 Thread juaninf
Hi Everybody,

I want sort in lexicographic order a binary strings (numpy array), I can 
use sorted function?

best regards

-- 
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] Question about representation GF

2012-03-03 Thread juaninf
Dears members.

Give F.a = GF(2^self.m,modulus=a^4+a+1); and let p(X), g(X) belong
F[X], I want know, if is there any function to obtain the xgcd of p(X)
and g(X), but when these are in log representation?

thanks

-- 
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] Question about plot

2012-03-03 Thread juaninf
Dears members

I need axes_labels in vertical and horizontal form in side sideways od
axis, how make this?. example
http://www.personal.psu.edu/egp11/Eric_Paterson/Blog/Entries/2009/11/18_Open-Source_alternatives_for_MATLAB_in_teaching_and_research_files/ericPlot.jpg

#P is list_plot tipe
P.set_legend_options(loc='upper left')
show(P, figsize=6,axes_labels=('log(grau(g(X)))','log(Decifragem
cost(seg))'),gridlines=True)

-- 
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] Question about polynomials roots

2012-03-02 Thread juaninf
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.

-- 
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.x = 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=getsearch=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 Juan Grados
My question is for the support algorithm, for example: Chien,
Berlekamp-Trace ... etc

2012/3/2 Martin Albrecht martinralbre...@googlemail.com

 Have you read the documentation? It's massive as I just found out:

 sage: F = GF(3)
 sage: P.x = 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=getsearch=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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about QuadraticForm polynomial method.

2012-02-24 Thread Jacob Hicks
When I run:

sage: q = QuadraticForm(ZZ,2,[3,2,5])
sage: q.polynomial()
6*x0^2 + 4*x0*x1 + 10*x1^2

I would expect to get half of this result, which is the quadratic form
as a polynomial.  The doc tests say this is what the behavior should
be, but I don't understand why.  Is this actually the desired behavior
and if so what am I misunderstanding?

Thanks,
-- 
Jacob Hicks

-- 
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 QuadraticForm polynomial method.

2012-02-24 Thread Justin C. Walker

On Feb 24, 2012, at 08:04 , Jacob Hicks wrote:

 When I run:
 
 sage: q = QuadraticForm(ZZ,2,[3,2,5])
 sage: q.polynomial()
 6*x0^2 + 4*x0*x1 + 10*x1^2
 
 I would expect to get half of this result, which is the quadratic form
 as a polynomial.  The doc tests say this is what the behavior should
 be, but I don't understand why.  Is this actually the desired behavior
 and if so what am I misunderstanding?

You're in the middle of a centuries-old debate, stemming from the 
Lagrange-Gauss smackdown (or maybe it was Legendre; it's been a while).  The 
issue stems from the desire to equate quadratic forms and symmetric matrices 
(b*x0*x1 vs b/2*x0*x1+b/2*x1*x0).  If you don't use the above, you end up 
having to deal with the ring ZZ[1/2].  This is discussed in the Wikipedia 
article on quadratic forms (and in other places, like Cassels' Rational 
Quadratic Forms).

HTH

Justin

--
Justin C. Walker, Curmudgeon at Large
Director
Institute for the Enhancement of the Director's Income
---
Nobody knows the trouble I've been
---



-- 
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 QuadraticForm polynomial method.

2012-02-24 Thread John Cremona
Justin,

I don't think that is the issue here: you are referring to the debate
between using a,2*b,c as coefficeints rather than a,b,c.  But here
*all* the coefficients have been doubled.

Note that we also have

sage: BinaryQF([1,2,3])
x^2 + 2*x*y + 3*y^2

john

On 24 February 2012 16:04, Jacob Hicks jhi...@math.uga.edu wrote:
 When I run:

 sage: q = QuadraticForm(ZZ,2,[3,2,5])
 sage: q.polynomial()
 6*x0^2 + 4*x0*x1 + 10*x1^2

 I would expect to get half of this result, which is the quadratic form
 as a polynomial.  The doc tests say this is what the behavior should
 be, but I don't understand why.  Is this actually the desired behavior
 and if so what am I misunderstanding?

 Thanks,
 --
 Jacob Hicks

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

-- 
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 QuadraticForm polynomial method.

2012-02-24 Thread Justin C. Walker

On Feb 24, 2012, at 09:49 , John Cremona wrote:

 I don't think that is the issue here: you are referring to the debate
 between using a,2*b,c as coefficeints rather than a,b,c.  But here
 *all* the coefficients have been doubled.

I haven't looked at this code in detail yet, but I'm pretty sure that this is 
the issue.  Cassels (I think) remarks that the two approaches are equivalent by 
noting that 2f and f are equivalent.  Of course, I'm going from memory here.

Gotta go catch a plane :-}

Justin

--
Justin C. Walker
Curmudgeon at Large
Director
Institute for the Enhancement of the Director's Income
--
Build a man a fire and he'll be warm
 for a night.
Set a man on fire and he'll be warm
 for the rest of his life.



-- 
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 plot

2012-02-24 Thread Juan Grados
Jason Grout idea is good for me, but I need empiler several plots, i
after use show(plot1+plot2+...). How do this?.

2012/2/24 Dan Drake dr...@kaist.edu

 On Fri, 24 Feb 2012 at 01:39AM -0200, Juan Grados wrote:
  I need smooth line, (interpolation the points), line(vec) plot line
 without
  smoth

 If a regression line is good enough, see:
 http://markmail.org/message/lipt7edldscsaaqb (another one of Jason's
 messages!)


 Dan

 --
 ---  Dan Drake
 -  http://mathsci.kaist.ac.kr/~drake
 ---




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about plot

2012-02-23 Thread juaninf

Dear members

I am a two-tuple vector, vet=[(1,2),(3,4),(5,6),..], i want plot
this data with a line aproximation, (interpolation this points), exist
any parameter in list_plot function for this.

Juan

-- 
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 plot

2012-02-23 Thread D. S. McNeil
 I am a two-tuple vector, vet=[(1,2),(3,4),(5,6),..], i want plot
 this data with a line aproximation, (interpolation this points), exist
 any parameter in list_plot function for this.

Maybe

line(vet)

does what you want?  You can look at
http://www.sagemath.org/doc/reference/sage/plot/plot.html for other
possibilities.


Doug

-- 
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 plot

2012-02-23 Thread Juan Grados
I need smooth line, (interpolation the points), line(vec) plot line without
smoth

2012/2/24 D. S. McNeil dsm...@gmail.com

  I am a two-tuple vector, vet=[(1,2),(3,4),(5,6),..], i want plot
  this data with a line aproximation, (interpolation this points), exist
  any parameter in list_plot function for this.

 Maybe

line(vet)

 does what you want?  You can look at
 http://www.sagemath.org/doc/reference/sage/plot/plot.html for other
 possibilities.


 Doug

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 plot

2012-02-23 Thread Dan Drake
On Fri, 24 Feb 2012 at 01:39AM -0200, Juan Grados wrote:
 I need smooth line, (interpolation the points), line(vec) plot line without
 smoth

If a regression line is good enough, see:
http://markmail.org/message/lipt7edldscsaaqb (another one of Jason's
messages!)


Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


[sage-support] Question about perfomance

2012-02-19 Thread Juan Grados
Dear members.

is there a way to know how much is lost, in computing time, using python
instead of C/ansi to program an algorithm?
-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 perfomance

2012-02-19 Thread William Stein
On Sun, Feb 19, 2012 at 11:24 AM, Juan Grados juan...@gmail.com wrote:
 Dear members.

 is there a way to know how much is lost, in computing time, using python
 instead of C/ansi to program an algorithm?

It depends entirely on the algorithm and what that algorithm uses from
Python/Sage.
The difference in speed is between 1 and a 100, usually.


 -- William

 --
 -
 Juan del Carmen Grados Vásquez
 Laboratório Nacional de Computação Científica
 Tel: +55 24 2233-6260
 (http://www.lncc.br/)
 http://juaninf.blogspot.com
 -

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



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

-- 
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 perfomance

2012-02-19 Thread Juan Grados
William thanks for your answer, this information where I can read? ... I'm
doing a good job and I would reference it

2012/2/19 William Stein wst...@gmail.com

 On Sun, Feb 19, 2012 at 11:24 AM, Juan Grados juan...@gmail.com wrote:
  Dear members.
 
  is there a way to know how much is lost, in computing time, using python
  instead of C/ansi to program an algorithm?

 It depends entirely on the algorithm and what that algorithm uses from
 Python/Sage.
 The difference in speed is between 1 and a 100, usually.


  -- William

  --
  -
  Juan del Carmen Grados Vásquez
  Laboratório Nacional de Computação Científica
  Tel: +55 24 2233-6260
  (http://www.lncc.br/)
  http://juaninf.blogspot.com
  -
 
  --
  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



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

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about rdtsc()

2012-02-18 Thread juaninf
Dear members

Exist any function in SAGE with same goal of rdtsc() in C?.

For example:

tmp_ini = rdtsc()
...
instructions ..
...
tmp_dec = rdtsc() - tmp_ini;

-- 
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 cycles per second in SAGE

2012-02-15 Thread Harald Schilly


On Wednesday, February 15, 2012 7:12:20 AM UTC+1, juaninf wrote:

 sorry, the measure is cycles/byte. sorry again, how obtain this measure in 
 SAGE?


I am a bit  confused, what is cycles/byte? It would really help if you 
could expand this to a full example and explain us in detail what you want 
to measure or if you already have related examples.

H

-- 
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] Question about UniqueFactory

2012-02-15 Thread Starx
Here is a small example that illustrates my question:
http://pastebin.com/GmPhFmT6

Why doesn't this print True?

I believe the answer has something to do with the version of sage.  If
you access G1._factory_data or G2._factory_data you get:

(class '__main__.UniqueGraphFactory', (4, 8), (2, (1, 2, 'a')), {})
(class '__main__.UniqueGraphFactory', 'Sage Version 4.8, Release
Date: 2012-01-20', (2, (1, 2, 'a')), [])

so it appears that the version of sage is being saved in two different
ways.  Is version() not what get_object is expecting?

-Jim

-- 
Die Dunkelheit... leitet die Musik.
Die Musik... leitet die Seele.

-- 
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 cycles per second in SAGE

2012-02-14 Thread David Kirkby
On 14 February 2012 03:40, juaninf juan...@gmail.com wrote:

 Hi everybody.

 Exists any command in SAGE to get the spent cpu-cycles per second in
 SAGE?


What do you mean by spent cycles per second? Time must be measured in
seconds, not inverse seconds, so I assume you don't mean time.

I believe you will find that bencharkes that try to measure MFLOPS (million
floating point operatiions per second), is a bit meaningless. In facts,
MFLOPS is also known as Meaningless Indicator of Performance).

http://books.google.co.uk/books?id=R8RLniX5DNQCpg=PA14lpg=PA14dq=MFLOPS++meaninglesssource=blots=iqHzUuFrxxsig=4pVcA_oX7G_RKuGmLpwLsKxwICMhl=ensa=Xei=rkM6T--KJOem0QWR3_meCwved=0CCUQ6AEwAA#v=onepageq=MFLOPS%20%20meaninglessf=false

What are you actually trying to achieve by knowing whatever you want to
know?

Dave

-- 
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] Question about download SAGE

2012-02-14 Thread juaninf
Hi everybody

Please I want download the SAGE math for fedora-32bits, but i need the
file with extension *.tar not tar.lzmaa, because my tar program no
have support fot this extension, ...  
http://ftp.iitm.ac.in/sage/linux/32bit/index.html.
You know where are url? to download this, (without make).

-- 
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 cycles per second in SAGE

2012-02-14 Thread Juan Grados
sorry, the measure is cycles/byte. sorry again, how obtain this measure in
SAGE?

2012/2/14 David Kirkby david.kir...@onetel.net

 On 14 February 2012 03:40, juaninf juan...@gmail.com wrote:

 Hi everybody.

 Exists any command in SAGE to get the spent cpu-cycles per second in
 SAGE?


 What do you mean by spent cycles per second? Time must be measured in
 seconds, not inverse seconds, so I assume you don't mean time.

 I believe you will find that bencharkes that try to measure MFLOPS
 (million floating point operatiions per second), is a bit meaningless. In
 facts, MFLOPS is also known as Meaningless Indicator of Performance).


 http://books.google.co.uk/books?id=R8RLniX5DNQCpg=PA14lpg=PA14dq=MFLOPS++meaninglesssource=blots=iqHzUuFrxxsig=4pVcA_oX7G_RKuGmLpwLsKxwICMhl=ensa=Xei=rkM6T--KJOem0QWR3_meCwved=0CCUQ6AEwAA#v=onepageq=MFLOPS%20%20meaninglessf=false

 What are you actually trying to achieve by knowing whatever you want to
 know?

 Dave

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about cycles per second in SAGE

2012-02-13 Thread juaninf
Hi everybody.

Exists any command in SAGE to get the spent cpu-cycles per second in
SAGE?

-- 
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] Question about scoping

2012-01-17 Thread Ed Scheinerman
I'm confused by the fact that variables defined inside functions can
leak out and become global variables. Here's what I've noticed.

(1) I create a file called steiner.py for finding the Steiner point
given three points in the plane. Here's my code:


def dist(p,q):

Eulidean distance between two points

n = len(p)
d2 = sum( (p[k]-q[k])**2 for k in range(n) )
return sqrt(d2)

def steiner(a,b,c):

Given three points in the plane, find the point p that minimizes
the sum of the distances to those three points.

x = var('x')
y = var('y')
p = (x,y)  # unknown point

# objective function to minimize
obj = dist(p,a) + dist(p,b) + dist(p,c)

# start search at center of mass of the three points
p0 = ( (a[0]+b[0]+c[0])/3., (a[1]+b[1]+c[1])/3. )

print Starting optimiztion at, p0
print obj.subs(x=p0[0], y=p0[1])

return minimize(obj,p0)


(2) I attach this file in a Sage session. If I have global variables x
or y, they are wiped out when I invoke the steiner function. Here's a
transcript.


$ sage
--
| Sage Version 4.7.2, Release Date: 2011-10-29   |
| Type notebook() for the GUI, and license() for information.|
--
sage: attach steiner.py
sage: x = [1,2,3]
sage: y = [4,5,6]
sage: x
[1, 2, 3]
sage: y
[4, 5, 6]
sage: steiner((1,1), (2,3), (5,2))
Starting optimiztion at (2.6665, 2.0)
5.4788343901030965
Optimization terminated successfully.
 Current function value: 5.303240
 Iterations: 6
 Function evaluations: 7
 Gradient evaluations: 7
(2.20179756615, 2.46316721759)
sage: x
x
sage: y
y

My apologies if this is something already covered, but it's confusing
and not the behavior I would expect. Other variables defined inside
functions don't leak out like this.


-- 
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] Question about minimal polynomial to build GF

2011-12-11 Thread juaninf
Hi everybody

I want choose different minimal polynomial to build a Galois Field
2^m, how?

For example: m = 8


sageF.a=GF(2^8)
sage:print a.minpoly()
I get ...
x^8 + x^4 + x^3 + x^2 + 1
but I want now other polynomial for example
x^8+x^7+x^4+x^3+x+1
How?

thanks

-- 
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] Question about MPI and SAGE

2011-11-05 Thread juaninf
Dears

I want create a new datatype,
sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX, to use
comm.Reduce method,

comm.Reduce([PROD,sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX],
[RESUL,sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX],op=MPI.SUM,
root=0)

how i can make this?

thanks, by your attention

-- 
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=getsearch=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 sagenb.org

2011-10-12 Thread Robert Bradshaw
No. Also note that sagenb.org is on a single computer shared among
tens of thousands of users, so if you want to do something
computationally expensive you're better of installing Sage on your own
hardware.

On Tue, Oct 11, 2011 at 8:38 AM, juaninf juan...@gmail.com wrote:
 Exist sagenb.org with openmpi module?

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


-- 
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 sagenb.org

2011-10-12 Thread Juan Grados
yes I trying but ...

http://groups.google.com/group/sage-support/browse_thread/thread/b581f46aad988472#

2011/10/12 Robert Bradshaw rober...@math.washington.edu

 No. Also note that sagenb.org is on a single computer shared among
 tens of thousands of users, so if you want to do something
 computationally expensive you're better of installing Sage on your own
 hardware.

 On Tue, Oct 11, 2011 at 8:38 AM, juaninf juan...@gmail.com wrote:
  Exist sagenb.org with openmpi module?
 
  --
  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
 

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 sagenb.org

2011-10-12 Thread Juan Grados
help me please

2011/10/12 Juan Grados juan...@gmail.com

 yes I trying but ...


 http://groups.google.com/group/sage-support/browse_thread/thread/b581f46aad988472#


 2011/10/12 Robert Bradshaw rober...@math.washington.edu

 No. Also note that sagenb.org is on a single computer shared among
 tens of thousands of users, so if you want to do something
 computationally expensive you're better of installing Sage on your own
 hardware.

 On Tue, Oct 11, 2011 at 8:38 AM, juaninf juan...@gmail.com wrote:
  Exist sagenb.org with openmpi module?
 
  --
  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
 

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




 --
 -
 Juan del Carmen Grados Vásquez
 Laboratório Nacional de Computação Científica
 Tel: +55 24 2233-6260
 (http://www.lncc.br/)
 http://juaninf.blogspot.com
 -




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about Groener Basis

2011-10-12 Thread juaninf
I want implement a efficient linear solve system over GF(2) (and too
parallel if this is posible), i reading this article, but i dont
understand

http://ask.sagemath.org/question/467/solve-large-system-of-linear-equations-over-gf2

please I like please a example how, make this?

for example with this matrix

[1 0 0]
[1 1 0]

thanks

-- 
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] Question about sagenb.org

2011-10-11 Thread juaninf
Exist sagenb.org with openmpi module?

-- 
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] Question about Kernel Matrix

2011-10-11 Thread juaninf
Hi everyone

I want know if exist a parallel implementation to kernels of matrices
with openmpi
in sage


thanks

-- 
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] Question about legend place in plot

2011-10-10 Thread juaninf
Dears

I am having a problem with legend place in plot please see this URL

http://juaninf.blogspot.com/2011/10/pronto-comparacion-de-algoritmos-para.html

I want that legend is in left side, ... how?

-- 
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 legend place in plot

2011-10-10 Thread D. S. McNeil
 I want that legend is in left side, ... how?

Try something like:

p = plot(sin,legend_label=sin)
p.set_legend_options(loc='upper left')
p.show()

After making some plot p, you can type help(p.set_legend_options) to
see more information about the various things you can configure.


Doug

-- 
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 legend place in plot

2011-10-10 Thread Juan Grados
thanks

2011/10/10 D. S. McNeil dsm...@gmail.com

  I want that legend is in left side, ... how?

 Try something like:

 p = plot(sin,legend_label=sin)
 p.set_legend_options(loc='upper left')
 p.show()

 After making some plot p, you can type help(p.set_legend_options) to
 see more information about the various things you can configure.


 Doug

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question about Convert Polynomial

2011-10-08 Thread juaninf
Hi everyone

I have two polynomial p,q, when I make

sage:print polynomial, type(polynomial)

get
a*X type 'sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX'
X^4 + (a + 1)*X^3 + (a^3 + a)*X^2 + a*X + 1 class
'sage.rings.fraction_field_element.FractionFieldElement_1poly_field'

I want convert polynomial in
sage.rings.fraction_field_element.FractionFieldElement_1poly_field to
sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX is posible?,
how?

thanks by your answers

-- 
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] Question about Plot

2011-10-04 Thread juaninf
Hi everyone

I am have 4 vectors, and I want plot 2 graphics in the same place,

vector1 vs vector2 color = red
vector3 vs vector4 color = yelow
How?
please help me,

-- 
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] Question about eclipse + pydev + sage

2011-10-03 Thread juaninf
Hi everyone

I want use eclipse + pydev IDE for SAGE, I see this
https://groups.google.com/forum/#!topic/sage-support/HTPssIMKMHw/discussion

I got set sage-python as interpreter, but when run the *. sage, it
returns Error
File / home/juaninf/workspace/goppa1/src/test.sage, line 28
 F. x = GF (2)
   ^
SyntaxError: invalid syntax

Used Anyelse eclipse for this?

--
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 xgcd method

2011-10-01 Thread Juan Grados
fixed

2011/9/30 juaninf juan...@gmail.com

 Hi everybody,

 I want implement a modified extend Euclidean Algorithm, (egcd
 function), but this give wrong results, below my egcd, please help me
 to fix ...
 def egcd(p1,p2):
if p2 == PR(0):
return (p1,1,0)
else:
(q1, r1) = (p1).quo_rem(p2)
(d,s1,t1) = egcd(p2, r1)
return (d,t1,(s1 - q1 * t1))
 m = 4
 F.x = GF(2)
 Phi.x = GF(2^m);
 PR = PolynomialRing(Phi,'z');
 N = 2^m - 1;
 X = PolynomialRing(Phi,repr('z')).gen();
 g = X^4+X^3+X^2+1+x^2; # goppa polynomial
 R = (x^3 + x^2 + 1)*X^3 + (x^3 + x^2 + x)*X^2 + (x^2 + 1)*X + x^3 + x
 (a11,b11,c11) = egcd(g,R)
 print 'testing',((c11.mod(g)*(R))).mod(g)
 (a11,b11,c11) = xgcd(g,R)
 print 'testing',((c11.mod(g)*(R))).mod(g)

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




-- 
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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] Question About Primitive Element

2011-09-29 Thread Maarten Derickx
Phi(z) since by in your example the reduction of z will be primitive by 
definition. 

-- 
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] Question about congruence

2011-09-29 Thread juaninf
How do a(x) congruence b(x)R(x) mod (g(x)) in sage?

thanks by your answers

-- 
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] Question about xgcd method

2011-09-29 Thread juaninf
Hi everybody,

I want implement a modified extend Euclidean Algorithm, (egcd
function), but this give wrong results, below my egcd, please help me
to fix ...
def egcd(p1,p2):
if p2 == PR(0):
return (p1,1,0)
else:
(q1, r1) = (p1).quo_rem(p2)
(d,s1,t1) = egcd(p2, r1)
return (d,t1,(s1 - q1 * t1))
m = 4
F.x = GF(2)
Phi.x = GF(2^m);
PR = PolynomialRing(Phi,'z');
N = 2^m - 1;
X = PolynomialRing(Phi,repr('z')).gen();
g = X^4+X^3+X^2+1+x^2; # goppa polynomial
R = (x^3 + x^2 + 1)*X^3 + (x^3 + x^2 + x)*X^2 + (x^2 + 1)*X + x^3 + x
(a11,b11,c11) = egcd(g,R)
print 'testing',((c11.mod(g)*(R))).mod(g)
(a11,b11,c11) = xgcd(g,R)
print 'testing',((c11.mod(g)*(R))).mod(g)

-- 
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] Question About Primitive Element

2011-09-28 Thread juaninf
Hi

How I will get a primite element ...

F = GF(2)
PRF.z = PolynomialRing(F);
print PRF
Phi = PRF.quotient(z^4+z+1);
Phi.primitive_element() .   ?

--
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 Patterson Algorithm Implementation

2011-09-28 Thread D. S. McNeil
 This is definitely not a bug.   The definition of the _add_ method
 absolutely demands that both inputs have exactly the same parent.  In
 the above instance, the left hand input (=1) has parent ZZ, and the
 right hand input (=SR(2)) has parent the symbolic ring.

Yeah, I know that-- it's the violation of that assumption which
ultimately crashed the OP's code, after all.

I guess I've inherited the bias from Python that users shouldn't be
able to segfault the interpreter from pure Python code.
Anything Cythonic probably falls into the Sage equivalent of the
ctypes exception class, and I guess you can get the same crash with
any non-typechecking cpdef'd object, but it still feels wrong.

Meh.


Doug

-- 
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 Patterson Algorithm Implementation

2011-09-28 Thread Juan Grados
Hi thanks for your answers,

I used _inverter_, _mul_, _add_ etc, because apparently
the implementation work fine but only apparently,
i think that the essencial problem is with _invert_ method,
but now I used inverse_mod , but I dont
where are the error, I implemented Berlekamp Algorithm too, from [Ict2011],
its inside worksheet,
this work fine, but Patterson Algorithm no,

please help me with this implementation

'''
ALGORITHM:

The following two algorithms are in [Ict2011]

REFERENCES:

.. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece PKCSs
   URL :
http://www.google.com/url?sa=tsource=webcd=2ved=0CCUQFjABurl=http%3A%2F%2Fwww.weblearn.hs-bremen.de%2Frisse%2Fpapers%2FICIT11%2FRisse526ICIT11.pdfei=Q-yCTpK5C82cgQfj3803usg=AFQjCNGEZ7SuMf1WKPrdkxvJMfiSaSqO1wsig2=3RM25hfPNHCveQvdjTn4Iw

'''

def encode(u):
return u*G_Goppa;

#this is the Berlekamp
def decode(y,m,N,H_gRS):
tt = var('z')
s = H_gRS*y.transpose();
if s==matrix(Phi,H_gRS.nrows(),1):
return y;
b = PR([s[_,0] for _ in range(s.nrows())]);

#
bigN = m;
sigma = vector(PolynomialRing(Phi,tt),bigN+2);
omega = vector(PolynomialRing(Phi,tt),bigN+2);
delta = vector(PolynomialRing(Phi,tt),bigN+2);
sigma[-1+1] = PR(0);
sigma[0+1] = PR(1);
flag = 2*bigN; # exponent flags rational 1/z
omega[-1+1] = z**flag;
omega[0+1] = PR(0);
# init mu and delta
mu = -1; delta[-1+1] = 1;
for i in range(bigN):
delta[i+1] = (sigma[i+1]*b).coeffs()[i];
sigma[i+1+1] =
sigma[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*sigma[mu+1](z);
if (omega[mu+1].degree()==flag):
omega[i+1+1] =
omega[i+1](z)-(delta[i+1]/delta[mu+1])*z**(i-mu-1);
else:
omega[i+1+1]
=omega[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*omega[mu+1](z);
ord = max(sigma[i+1].degree(),1+omega[i+1].degree());
if (delta[i+1]0)and(2*ord=i):
mu = i;
ELP = sigma[bigN+1]; # ErrorLocatorPolynomial
n = G_Goppa.nrows();
ee = vector(F,[0 for _ in range(n)]);
for i in range(N):
if (ELP(x**i)==Phi(0)): # an error occured
print 'error position',N-i
return 0;

def split(p):
# split polynomial p over F into even part po
# and odd part p1 such that p(z) = p2 (z) + z p2 (z)
Phi = p.parent()
p0 = Phi([sqrt(c) for c in p.list()[0::2]]);
p1 = Phi([sqrt(c) for c in p.list()[1::2]]);
return (p0,p1);

m = 4
F.x = GF(2)
Phi.x = GF(2^m);
PR = PolynomialRing(Phi,'z');
print 'PR is',PR;
N = 2^m - 1;
codelocators = [x^i for i in range(N)]
print(codelocators)
X = PolynomialRing(Phi,repr('z')).gen();
g = X^2+X+x^3; # goppa polynomial
print 'goppa polinomial',g
if g.is_irreducible():
print 'g(z) =',g,'is irreducible';
for i in range(N):
if g(codelocators[i])==Phi(0):
print 'alarm: g(alpha_'+str(i)+')=0';
 H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
range(m)]);
H_gRS = H_gRS*diagonal_matrix([ 1/g(codelocators[i]) for i in range(N)]);
print H_gRS
H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
for i in range(H_gRS.nrows()):
for j in range(H_gRS.ncols()):
be = bin(eval(H_gRS[i,j].int_repr()))[2:];
 be = '0'*(m-len(be))+be; be = list(be);
H_Goppa[m*i:m*(i+1),j]=vector(map(int,be));
Krnl = H_Goppa.right_kernel();
G_Goppa = Krnl.basis_matrix();
print H_Goppa
k = G_Goppa.nrows()
u = vector(F,[randint(0,1) for _ in range(k)]);
c = encode(u);
e = vector(F,H_gRS.ncols()); # e = zero vector
e[3]=1
y = vector(F,H_gRS.ncols());
y = c + e
print 'berlekamp algorithm'
decode(y,m,N,H_gRS)
print 'patterson algorithm'
#adicionando error
s = H_gRS*y.transpose();
sP = PR([s[_,0] for _ in range(s.nrows())]);
print 'g=',g
g0g1 = split(g);
w = g0g1[0]*(((g0g1[1]).inverse_mod(g)))
print 'w=',w
T0T1 = split(sP.inverse_mod(g) + X);
R = T0T1[0]+(w)*(T0T1[1])
print 'R',R
(d1,u,v) = xgcd(1,R); # where d = gcd(1,R) = 1
a = g*u; b = g*v;
sigma = (a^2+X*(b^2));
print sigma.roots()



2011/9/28 D. S. McNeil dsm...@gmail.com

  This is definitely not a bug.   The definition of the _add_ method
  absolutely demands that both inputs have exactly the same parent.  In
  the above instance, the left hand input (=1) has parent ZZ, and the
  right hand input (=SR(2)) has parent the symbolic ring.

 Yeah, I know that-- it's the violation of that assumption which
 ultimately crashed the OP's code, after all.

 I guess I've inherited the bias from Python that users shouldn't be
 able to segfault the interpreter from pure Python code.
 Anything Cythonic probably falls into the Sage equivalent of the
 ctypes exception class, and I guess you can get the same crash with
 any non-typechecking cpdef'd object, but it still feels wrong.

 Meh.


 Doug

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

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-28 Thread Juan Grados
in the end line

print sigma.roots(),

always give empty vector, here sigma.roots()  should nonzero vector

2011/9/28 Juan Grados juan...@gmail.com

 Hi thanks for your answers,

 I used _inverter_, _mul_, _add_ etc, because apparently
 the implementation work fine but only apparently,
 i think that the essencial problem is with _invert_ method,
 but now I used inverse_mod , but I dont
 where are the error, I implemented Berlekamp Algorithm too, from [Ict2011],
 its inside worksheet,
 this work fine, but Patterson Algorithm no,

 please help me with this implementation

 '''
 ALGORITHM:

 The following two algorithms are in [Ict2011]

 REFERENCES:

 .. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece PKCSs
URL :
 http://www.google.com/url?sa=tsource=webcd=2ved=0CCUQFjABurl=http%3A%2F%2Fwww.weblearn.hs-bremen.de%2Frisse%2Fpapers%2FICIT11%2FRisse526ICIT11.pdfei=Q-yCTpK5C82cgQfj3803usg=AFQjCNGEZ7SuMf1WKPrdkxvJMfiSaSqO1wsig2=3RM25hfPNHCveQvdjTn4Iw

 '''

 def encode(u):
 return u*G_Goppa;

 #this is the Berlekamp
 def decode(y,m,N,H_gRS):
 tt = var('z')
 s = H_gRS*y.transpose();
 if s==matrix(Phi,H_gRS.nrows(),1):
 return y;
 b = PR([s[_,0] for _ in range(s.nrows())]);

 #
 bigN = m;
 sigma = vector(PolynomialRing(Phi,tt),bigN+2);
 omega = vector(PolynomialRing(Phi,tt),bigN+2);
 delta = vector(PolynomialRing(Phi,tt),bigN+2);
 sigma[-1+1] = PR(0);
  sigma[0+1] = PR(1);
 flag = 2*bigN; # exponent flags rational 1/z
 omega[-1+1] = z**flag;
 omega[0+1] = PR(0);
 # init mu and delta
 mu = -1; delta[-1+1] = 1;
 for i in range(bigN):
 delta[i+1] = (sigma[i+1]*b).coeffs()[i];
 sigma[i+1+1] =
 sigma[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*sigma[mu+1](z);
 if (omega[mu+1].degree()==flag):
 omega[i+1+1] =
 omega[i+1](z)-(delta[i+1]/delta[mu+1])*z**(i-mu-1);
 else:
 omega[i+1+1]
 =omega[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*omega[mu+1](z);
 ord = max(sigma[i+1].degree(),1+omega[i+1].degree());
 if (delta[i+1]0)and(2*ord=i):
 mu = i;
 ELP = sigma[bigN+1]; # ErrorLocatorPolynomial
 n = G_Goppa.nrows();
 ee = vector(F,[0 for _ in range(n)]);
  for i in range(N):
 if (ELP(x**i)==Phi(0)): # an error occured
 print 'error position',N-i
 return 0;

 def split(p):
 # split polynomial p over F into even part po
 # and odd part p1 such that p(z) = p2 (z) + z p2 (z)
 Phi = p.parent()
 p0 = Phi([sqrt(c) for c in p.list()[0::2]]);
 p1 = Phi([sqrt(c) for c in p.list()[1::2]]);
  return (p0,p1);

 m = 4
 F.x = GF(2)
 Phi.x = GF(2^m);
 PR = PolynomialRing(Phi,'z');
 print 'PR is',PR;
 N = 2^m - 1;
 codelocators = [x^i for i in range(N)]
 print(codelocators)
 X = PolynomialRing(Phi,repr('z')).gen();
 g = X^2+X+x^3; # goppa polynomial
 print 'goppa polinomial',g
 if g.is_irreducible():
 print 'g(z) =',g,'is irreducible';
 for i in range(N):
 if g(codelocators[i])==Phi(0):
 print 'alarm: g(alpha_'+str(i)+')=0';
  H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
 range(m)]);
 H_gRS = H_gRS*diagonal_matrix([ 1/g(codelocators[i]) for i in range(N)]);
 print H_gRS
 H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
 for i in range(H_gRS.nrows()):
 for j in range(H_gRS.ncols()):
 be = bin(eval(H_gRS[i,j].int_repr()))[2:];
  be = '0'*(m-len(be))+be; be = list(be);
 H_Goppa[m*i:m*(i+1),j]=vector(map(int,be));
 Krnl = H_Goppa.right_kernel();
 G_Goppa = Krnl.basis_matrix();
 print H_Goppa
 k = G_Goppa.nrows()
 u = vector(F,[randint(0,1) for _ in range(k)]);
 c = encode(u);
 e = vector(F,H_gRS.ncols()); # e = zero vector
 e[3]=1
 y = vector(F,H_gRS.ncols());
 y = c + e
 print 'berlekamp algorithm'
 decode(y,m,N,H_gRS)
 print 'patterson algorithm'
 #adicionando error
  s = H_gRS*y.transpose();
 sP = PR([s[_,0] for _ in range(s.nrows())]);
 print 'g=',g
 g0g1 = split(g);
 w = g0g1[0]*(((g0g1[1]).inverse_mod(g)))
 print 'w=',w
 T0T1 = split(sP.inverse_mod(g) + X);
 R = T0T1[0]+(w)*(T0T1[1])
 print 'R',R
 (d1,u,v) = xgcd(1,R); # where d = gcd(1,R) = 1
 a = g*u; b = g*v;
 sigma = (a^2+X*(b^2));
 print sigma.roots()



 2011/9/28 D. S. McNeil dsm...@gmail.com

  This is definitely not a bug.   The definition of the _add_ method
  absolutely demands that both inputs have exactly the same parent.  In
  the above instance, the left hand input (=1) has parent ZZ, and the
  right hand input (=SR(2)) has parent the symbolic ring.

 Yeah, I know that-- it's the violation of that assumption which
 ultimately crashed the OP's code, after all.

 I guess I've inherited the bias from Python that users shouldn't be
 able to segfault the interpreter from pure Python code.
 Anything Cythonic probably falls into the Sage equivalent of the
 ctypes exception class, and I guess you can get the same crash with
 any non-typechecking cpdef'd object, but it still feels wrong.

 

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-28 Thread Juan Grados
help please!

2011/9/28 Juan Grados juan...@gmail.com

 in the end line

 print sigma.roots(),

 always give empty vector, here sigma.roots()  should nonzero vector

 2011/9/28 Juan Grados juan...@gmail.com

 Hi thanks for your answers,

 I used _inverter_, _mul_, _add_ etc, because apparently
 the implementation work fine but only apparently,
 i think that the essencial problem is with _invert_ method,
 but now I used inverse_mod , but I dont
 where are the error, I implemented Berlekamp Algorithm too, from
 [Ict2011], its inside worksheet,
 this work fine, but Patterson Algorithm no,

 please help me with this implementation

 '''
 ALGORITHM:

 The following two algorithms are in [Ict2011]

 REFERENCES:

 .. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece PKCSs
URL :
 http://www.google.com/url?sa=tsource=webcd=2ved=0CCUQFjABurl=http%3A%2F%2Fwww.weblearn.hs-bremen.de%2Frisse%2Fpapers%2FICIT11%2FRisse526ICIT11.pdfei=Q-yCTpK5C82cgQfj3803usg=AFQjCNGEZ7SuMf1WKPrdkxvJMfiSaSqO1wsig2=3RM25hfPNHCveQvdjTn4Iw

 '''

 def encode(u):
 return u*G_Goppa;

 #this is the Berlekamp
 def decode(y,m,N,H_gRS):
 tt = var('z')
 s = H_gRS*y.transpose();
 if s==matrix(Phi,H_gRS.nrows(),1):
 return y;
 b = PR([s[_,0] for _ in range(s.nrows())]);

 #
 bigN = m;
 sigma = vector(PolynomialRing(Phi,tt),bigN+2);
 omega = vector(PolynomialRing(Phi,tt),bigN+2);
 delta = vector(PolynomialRing(Phi,tt),bigN+2);
 sigma[-1+1] = PR(0);
  sigma[0+1] = PR(1);
 flag = 2*bigN; # exponent flags rational 1/z
 omega[-1+1] = z**flag;
 omega[0+1] = PR(0);
 # init mu and delta
 mu = -1; delta[-1+1] = 1;
 for i in range(bigN):
 delta[i+1] = (sigma[i+1]*b).coeffs()[i];
 sigma[i+1+1] =
 sigma[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*sigma[mu+1](z);
 if (omega[mu+1].degree()==flag):
 omega[i+1+1] =
 omega[i+1](z)-(delta[i+1]/delta[mu+1])*z**(i-mu-1);
 else:
 omega[i+1+1]
 =omega[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*omega[mu+1](z);
 ord = max(sigma[i+1].degree(),1+omega[i+1].degree());
 if (delta[i+1]0)and(2*ord=i):
 mu = i;
 ELP = sigma[bigN+1]; # ErrorLocatorPolynomial
 n = G_Goppa.nrows();
 ee = vector(F,[0 for _ in range(n)]);
  for i in range(N):
 if (ELP(x**i)==Phi(0)): # an error occured
 print 'error position',N-i
 return 0;

 def split(p):
 # split polynomial p over F into even part po
 # and odd part p1 such that p(z) = p2 (z) + z p2 (z)
 Phi = p.parent()
 p0 = Phi([sqrt(c) for c in p.list()[0::2]]);
 p1 = Phi([sqrt(c) for c in p.list()[1::2]]);
  return (p0,p1);

 m = 4
 F.x = GF(2)
 Phi.x = GF(2^m);
 PR = PolynomialRing(Phi,'z');
 print 'PR is',PR;
 N = 2^m - 1;
 codelocators = [x^i for i in range(N)]
 print(codelocators)
 X = PolynomialRing(Phi,repr('z')).gen();
 g = X^2+X+x^3; # goppa polynomial
 print 'goppa polinomial',g
 if g.is_irreducible():
 print 'g(z) =',g,'is irreducible';
 for i in range(N):
 if g(codelocators[i])==Phi(0):
 print 'alarm: g(alpha_'+str(i)+')=0';
  H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
 range(m)]);
 H_gRS = H_gRS*diagonal_matrix([ 1/g(codelocators[i]) for i in range(N)]);
 print H_gRS
 H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
 for i in range(H_gRS.nrows()):
 for j in range(H_gRS.ncols()):
 be = bin(eval(H_gRS[i,j].int_repr()))[2:];
  be = '0'*(m-len(be))+be; be = list(be);
 H_Goppa[m*i:m*(i+1),j]=vector(map(int,be));
 Krnl = H_Goppa.right_kernel();
 G_Goppa = Krnl.basis_matrix();
 print H_Goppa
 k = G_Goppa.nrows()
 u = vector(F,[randint(0,1) for _ in range(k)]);
 c = encode(u);
 e = vector(F,H_gRS.ncols()); # e = zero vector
 e[3]=1
 y = vector(F,H_gRS.ncols());
 y = c + e
 print 'berlekamp algorithm'
 decode(y,m,N,H_gRS)
 print 'patterson algorithm'
 #adicionando error
  s = H_gRS*y.transpose();
 sP = PR([s[_,0] for _ in range(s.nrows())]);
 print 'g=',g
 g0g1 = split(g);
 w = g0g1[0]*(((g0g1[1]).inverse_mod(g)))
 print 'w=',w
 T0T1 = split(sP.inverse_mod(g) + X);
 R = T0T1[0]+(w)*(T0T1[1])
 print 'R',R
 (d1,u,v) = xgcd(1,R); # where d = gcd(1,R) = 1
 a = g*u; b = g*v;
 sigma = (a^2+X*(b^2));
 print sigma.roots()



 2011/9/28 D. S. McNeil dsm...@gmail.com

  This is definitely not a bug.   The definition of the _add_ method
  absolutely demands that both inputs have exactly the same parent.  In
  the above instance, the left hand input (=1) has parent ZZ, and the
  right hand input (=SR(2)) has parent the symbolic ring.

 Yeah, I know that-- it's the violation of that assumption which
 ultimately crashed the OP's code, after all.

 I guess I've inherited the bias from Python that users shouldn't be
 able to segfault the interpreter from pure Python code.
 Anything Cythonic probably falls into the Sage equivalent of the
 ctypes exception class, and I guess you can get the same crash with
 any 

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-28 Thread Juan Grados
Hi David,


Yes I understand, but now I think that have a logic problem in algorithm,
but I don't know where ... i copying lines from [Ict2011], ...

2011/9/28 David Joyner wdjoy...@gmail.com

 On Wed, Sep 28, 2011 at 5:58 PM, Juan Grados juan...@gmail.com wrote:
  help please!


 They did seem to solve your problem, didn't they?
 Do you not understand the English? Do you simply disagree?
 If you don't understand the English, please find someone who can translate.

 Did you find another error after fixing the problem they told about?

 Please be very clear exactly what it is you are having a problem
 understanding in this thread.


 
  2011/9/28 Juan Grados juan...@gmail.com
 
  in the end line
  print sigma.roots(),
  always give empty vector, here sigma.roots()  should nonzero vector
  2011/9/28 Juan Grados juan...@gmail.com
 
  Hi thanks for your answers,
  I used _inverter_, _mul_, _add_ etc, because apparently
  the implementation work fine but only apparently,
  i think that the essencial problem is with _invert_ method,
  but now I used inverse_mod , but I dont
  where are the error, I implemented Berlekamp Algorithm too, from
  [Ict2011], its inside worksheet,
  this work fine, but Patterson Algorithm no,
  please help me with this implementation
  '''
  ALGORITHM:
  The following two algorithms are in [Ict2011]
  REFERENCES:
  .. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece PKCSs
 URL
  :
 http://www.google.com/url?sa=tsource=webcd=2ved=0CCUQFjABurl=http%3A%2F%2Fwww.weblearn.hs-bremen.de%2Frisse%2Fpapers%2FICIT11%2FRisse526ICIT11.pdfei=Q-yCTpK5C82cgQfj3803usg=AFQjCNGEZ7SuMf1WKPrdkxvJMfiSaSqO1wsig2=3RM25hfPNHCveQvdjTn4Iw
  '''
  def encode(u):
  return u*G_Goppa;
  #this is the Berlekamp
  def decode(y,m,N,H_gRS):
  tt = var('z')
  s = H_gRS*y.transpose();
  if s==matrix(Phi,H_gRS.nrows(),1):
  return y;
  b = PR([s[_,0] for _ in range(s.nrows())]);
 
  #
  bigN = m;
  sigma = vector(PolynomialRing(Phi,tt),bigN+2);
  omega = vector(PolynomialRing(Phi,tt),bigN+2);
  delta = vector(PolynomialRing(Phi,tt),bigN+2);
  sigma[-1+1] = PR(0);
  sigma[0+1] = PR(1);
  flag = 2*bigN; # exponent flags rational 1/z
  omega[-1+1] = z**flag;
  omega[0+1] = PR(0);
  # init mu and delta
  mu = -1; delta[-1+1] = 1;
  for i in range(bigN):
  delta[i+1] = (sigma[i+1]*b).coeffs()[i];
  sigma[i+1+1] =
  sigma[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*sigma[mu+1](z);
  if (omega[mu+1].degree()==flag):
  omega[i+1+1] =
  omega[i+1](z)-(delta[i+1]/delta[mu+1])*z**(i-mu-1);
  else:
  omega[i+1+1]
  =omega[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*omega[mu+1](z);
  ord = max(sigma[i+1].degree(),1+omega[i+1].degree());
  if (delta[i+1]0)and(2*ord=i):
  mu = i;
  ELP = sigma[bigN+1]; # ErrorLocatorPolynomial
  n = G_Goppa.nrows();
  ee = vector(F,[0 for _ in range(n)]);
  for i in range(N):
  if (ELP(x**i)==Phi(0)): # an error occured
  print 'error position',N-i
  return 0;
  def split(p):
  # split polynomial p over F into even part po
  # and odd part p1 such that p(z) = p2 (z) + z p2 (z)
  Phi = p.parent()
  p0 = Phi([sqrt(c) for c in p.list()[0::2]]);
  p1 = Phi([sqrt(c) for c in p.list()[1::2]]);
  return (p0,p1);
  m = 4
  F.x = GF(2)
  Phi.x = GF(2^m);
  PR = PolynomialRing(Phi,'z');
  print 'PR is',PR;
  N = 2^m - 1;
  codelocators = [x^i for i in range(N)]
  print(codelocators)
  X = PolynomialRing(Phi,repr('z')).gen();
  g = X^2+X+x^3; # goppa polynomial
  print 'goppa polinomial',g
  if g.is_irreducible():
  print 'g(z) =',g,'is irreducible';
  for i in range(N):
  if g(codelocators[i])==Phi(0):
  print 'alarm: g(alpha_'+str(i)+')=0';
  H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
  range(m)]);
  H_gRS = H_gRS*diagonal_matrix([ 1/g(codelocators[i]) for i in
 range(N)]);
  print H_gRS
  H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
  for i in range(H_gRS.nrows()):
  for j in range(H_gRS.ncols()):
  be = bin(eval(H_gRS[i,j].int_repr()))[2:];
  be = '0'*(m-len(be))+be; be = list(be);
  H_Goppa[m*i:m*(i+1),j]=vector(map(int,be));
  Krnl = H_Goppa.right_kernel();
  G_Goppa = Krnl.basis_matrix();
  print H_Goppa
  k = G_Goppa.nrows()
  u = vector(F,[randint(0,1) for _ in range(k)]);
  c = encode(u);
  e = vector(F,H_gRS.ncols()); # e = zero vector
  e[3]=1
  y = vector(F,H_gRS.ncols());
  y = c + e
  print 'berlekamp algorithm'
  decode(y,m,N,H_gRS)
  print 'patterson algorithm'
  #adicionando error
  s = H_gRS*y.transpose();
  sP = PR([s[_,0] for _ in range(s.nrows())]);
  print 'g=',g
  g0g1 = split(g);
  w = g0g1[0]*(((g0g1[1]).inverse_mod(g)))
  print 'w=',w
  T0T1 = split(sP.inverse_mod(g) + X);
  R = T0T1[0]+(w)*(T0T1[1])
  print 'R',R
  (d1,u,v) = xgcd(1,R); # where d = gcd(1,R) = 1
  a = g*u; b = g*v;
  

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-28 Thread Juan Grados
I have already sent, but I dont answer ... because I expect please only if
anyelse can help me iff a time ...

2011/9/28 David Joyner wdjoy...@gmail.com

 On Wed, Sep 28, 2011 at 6:12 PM, Juan Grados juan...@gmail.com wrote:
  Hi David,
 
  Yes I understand, but now I think that have a logic problem in algorithm,
  but I don't know where ... i copying lines from [Ict2011], ...


 I would just email the author of the paper and ask him.


  2011/9/28 David Joyner wdjoy...@gmail.com
 
  On Wed, Sep 28, 2011 at 5:58 PM, Juan Grados juan...@gmail.com wrote:
   help please!
 
 
  They did seem to solve your problem, didn't they?
  Do you not understand the English? Do you simply disagree?
  If you don't understand the English, please find someone who can
  translate.
 
  Did you find another error after fixing the problem they told about?
 
  Please be very clear exactly what it is you are having a problem
  understanding in this thread.
 
 
  
   2011/9/28 Juan Grados juan...@gmail.com
  
   in the end line
   print sigma.roots(),
   always give empty vector, here sigma.roots()  should nonzero vector
   2011/9/28 Juan Grados juan...@gmail.com
  
   Hi thanks for your answers,
   I used _inverter_, _mul_, _add_ etc, because apparently
   the implementation work fine but only apparently,
   i think that the essencial problem is with _invert_ method,
   but now I used inverse_mod , but I dont
   where are the error, I implemented Berlekamp Algorithm too, from
   [Ict2011], its inside worksheet,
   this work fine, but Patterson Algorithm no,
   please help me with this implementation
   '''
   ALGORITHM:
   The following two algorithms are in [Ict2011]
   REFERENCES:
   .. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece
   PKCSs
  URL
  
   :
 http://www.google.com/url?sa=tsource=webcd=2ved=0CCUQFjABurl=http%3A%2F%2Fwww.weblearn.hs-bremen.de%2Frisse%2Fpapers%2FICIT11%2FRisse526ICIT11.pdfei=Q-yCTpK5C82cgQfj3803usg=AFQjCNGEZ7SuMf1WKPrdkxvJMfiSaSqO1wsig2=3RM25hfPNHCveQvdjTn4Iw
   '''
   def encode(u):
   return u*G_Goppa;
   #this is the Berlekamp
   def decode(y,m,N,H_gRS):
   tt = var('z')
   s = H_gRS*y.transpose();
   if s==matrix(Phi,H_gRS.nrows(),1):
   return y;
   b = PR([s[_,0] for _ in range(s.nrows())]);
  
   #
   bigN = m;
   sigma = vector(PolynomialRing(Phi,tt),bigN+2);
   omega = vector(PolynomialRing(Phi,tt),bigN+2);
   delta = vector(PolynomialRing(Phi,tt),bigN+2);
   sigma[-1+1] = PR(0);
   sigma[0+1] = PR(1);
   flag = 2*bigN; # exponent flags rational 1/z
   omega[-1+1] = z**flag;
   omega[0+1] = PR(0);
   # init mu and delta
   mu = -1; delta[-1+1] = 1;
   for i in range(bigN):
   delta[i+1] = (sigma[i+1]*b).coeffs()[i];
   sigma[i+1+1] =
   sigma[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*sigma[mu+1](z);
   if (omega[mu+1].degree()==flag):
   omega[i+1+1] =
   omega[i+1](z)-(delta[i+1]/delta[mu+1])*z**(i-mu-1);
   else:
   omega[i+1+1]
   =omega[i+1](z)-z**(i-mu)*(delta[i+1]/delta[mu+1])*omega[mu+1](z);
   ord = max(sigma[i+1].degree(),1+omega[i+1].degree());
   if (delta[i+1]0)and(2*ord=i):
   mu = i;
   ELP = sigma[bigN+1]; # ErrorLocatorPolynomial
   n = G_Goppa.nrows();
   ee = vector(F,[0 for _ in range(n)]);
   for i in range(N):
   if (ELP(x**i)==Phi(0)): # an error occured
   print 'error position',N-i
   return 0;
   def split(p):
   # split polynomial p over F into even part po
   # and odd part p1 such that p(z) = p2 (z) + z p2 (z)
   Phi = p.parent()
   p0 = Phi([sqrt(c) for c in p.list()[0::2]]);
   p1 = Phi([sqrt(c) for c in p.list()[1::2]]);
   return (p0,p1);
   m = 4
   F.x = GF(2)
   Phi.x = GF(2^m);
   PR = PolynomialRing(Phi,'z');
   print 'PR is',PR;
   N = 2^m - 1;
   codelocators = [x^i for i in range(N)]
   print(codelocators)
   X = PolynomialRing(Phi,repr('z')).gen();
   g = X^2+X+x^3; # goppa polynomial
   print 'goppa polinomial',g
   if g.is_irreducible():
   print 'g(z) =',g,'is irreducible';
   for i in range(N):
   if g(codelocators[i])==Phi(0):
   print 'alarm: g(alpha_'+str(i)+')=0';
   H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
   range(m)]);
   H_gRS = H_gRS*diagonal_matrix([ 1/g(codelocators[i]) for i in
   range(N)]);
   print H_gRS
   H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
   for i in range(H_gRS.nrows()):
   for j in range(H_gRS.ncols()):
   be = bin(eval(H_gRS[i,j].int_repr()))[2:];
   be = '0'*(m-len(be))+be; be = list(be);
   H_Goppa[m*i:m*(i+1),j]=vector(map(int,be));
   Krnl = H_Goppa.right_kernel();
   G_Goppa = Krnl.basis_matrix();
   print H_Goppa
   k = G_Goppa.nrows()
   u = vector(F,[randint(0,1) for _ in range(k)]);
   c = encode(u);
   e = vector(F,H_gRS.ncols()); # e = zero vector
   e[3]=1
   y = vector(F,H_gRS.ncols());
   y = c 

[sage-support] Question about Patterson Algorithm Implementation

2011-09-27 Thread juaninf
Hi everybody,

I am implement Patterson Algorithm for Goppa code,


I am copying lines from paper How SAGE helps to implement Goppa
Codes and McEliece PKCSs [attach], and my test is a random vector .
the error are in Line 77,
I expect get roots from \sigma (locator polynomial), but
implementation have a fail before.

thanks by your attention.

'''
Patterson Implementation:

The following algorithm are in [Ict2011]

REFERENCES:

.. [Ict2011] How SAGE helps to implement Goppa Codes and McEliece
PKCSs

'''

def encode(u):
return u*G_Goppa

def split1(p):
# split polynomial p over F into even part po
# and odd part p1 such that p(z) = p2 (z) + z p2 (z)
Phi1 = p.parent()
p0 = Phi1([sqrt(c) for c in p.list()[0::2]])
p1 = Phi1([sqrt(c) for c in p.list()[1::2]])
return (p0,p1)

m = 4
N = 2^m - 1;
F.x = GF(2)
Phi.x = GF(2^m);
PR = PolynomialRing(Phi,'z');
print 'PR is',PR;
codelocators = [x^i for i in range(N)]
print(codelocators)
X = PolynomialRing(F,repr('z')).gen()
#defining Goppa Polynomial
g = X^2+X+x^3
print 'goppa polinomial=',g
#verifing if g is irreducible over F
if g.is_irreducible():
print 'g(z) =',g,'is irreducible'
#verifing g(codelocators[i])0
for i in range(N):
if g(codelocators[i])==Phi(0):
print 'alarm: g(alpha_'+str(i)+')=0'
#creating Parity Check Matrix
H_gRS = matrix([[codelocators[j]^(i) for j in range(N)] for i in
range(m)])
H_Goppa = matrix(F,m*H_gRS.nrows(),H_gRS.ncols());
for i in range(H_gRS.nrows()):
for j in range(H_gRS.ncols()):
be = bin(eval(H_gRS[i,j].int_repr()))[2:]
be = '0'*(m-len(be))+be
be = list(be)
H_Goppa[m*i:m*(i+1),j]=vector(map(int,be))
#creating Generator Matrix
Krnl = H_Goppa.right_kernel()
G_Goppa = Krnl.basis_matrix()
print 'H_Goppa=',H_Goppa
print 'G_Goppa=',G_Goppa
#code dimension
k = G_Goppa.nrows()
#TEST##
#creating a random vector 'u' to test decode
u = vector(F,[randint(0,1) for _ in range(k)])
print 'u=',u
#coding random vector 'u' with G_Goppa
c = encode(u)
#creating error vector
e = vector(F,H_gRS.ncols())
e[5]=1;
y = vector(F,H_gRS.ncols())
#vector to test decode
y = c+e;
#creating syndrome polynomial
s = H_gRS*y.transpose()
sP = PR([s[_,0] for _ in range(s.nrows())])

#steps to Patterson Algorithm from paper
g0g1 = split1(g);
w = (g0g1[0])._mul_(((g0g1[1])).__invert__())
T0T1 = split1((sP).__invert__()._add_(X)) # here ERROR
R = T0T1[0]+((w)*(T0T1[1]))
print 'R=',R
(d1,u,v) =xgcd(1,R)
print 'egcd',(d1,u,v)
a = g*u
b = g*v
#creating locator polynomial
sigma = (a^2+X*(b^2))
print 'sigma',sigma
#verifing roots
for i in range(N):
if((sigma((x^i))) == 0): # an error occured
print 'error'
print N-i

--
-
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
-

-- 
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 Patterson Algorithm Implementation

2011-09-27 Thread D. S. McNeil
I don't think you should need to call _add_, but this looks like a bug to me:

--
| Sage Version 4.7.1, Release Date: 2011-08-11   |
| Type notebook() for the GUI, and license() for information.|
--
sage: 1+SR(2)
3
sage: 1.__add__(SR(2))
3
sage: 1._add_(SR(2))


Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.



Similarly for _sub_ and _mul_.  _div_ gives a slightly different result:


sage: 1._div_(SR(2))
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', (3258, 0))

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', (3244, 0))

---
TypeError Traceback (most recent call last)

/Users/mcneil/ipython console in module()

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11866)()

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11824)()

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer_ring.so
in sage.rings.integer_ring.IntegerRing_class._div
(sage/rings/integer_ring.c:5158)()

TypeError: Argument 'right' has incorrect type (expected
sage.rings.integer.Integer, got sage.symbolic.expression.Expression)


Doug

-- 
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 Patterson Algorithm Implementation

2011-09-27 Thread William Stein
On Tue, Sep 27, 2011 at 7:15 PM, D. S. McNeil dsm...@gmail.com wrote:
 I don't think you should need to call _add_, but this looks like a bug to me:

 --
 | Sage Version 4.7.1, Release Date: 2011-08-11                       |
 | Type notebook() for the GUI, and license() for information.        |
 --
 sage: 1+SR(2)
 3
 sage: 1.__add__(SR(2))
 3
 sage: 1._add_(SR(2))

 
 Unhandled SIGSEGV: A segmentation fault occurred in Sage.
 This probably occurred because a *compiled* component of Sage has a bug
 in it and is not properly wrapped with sig_on(), sig_off(). You might
 want to run Sage under gdb with 'sage -gdb' to debug this.
 Sage will now terminate.

This is definitely not a bug.   The definition of the _add_ method
absolutely demands that both inputs have exactly the same parent.  In
the above instance, the left hand input (=1) has parent ZZ, and the
right hand input (=SR(2)) has parent the symbolic ring.

 -- William




 Similarly for _sub_ and _mul_.  _div_ gives a slightly different result:


 sage: 1._div_(SR(2))
 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', (3258, 0))

 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', (3244, 0))

 ---
 TypeError                                 Traceback (most recent call last)

 /Users/mcneil/ipython console in module()

 /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
 in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11866)()

 /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
 in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11824)()

 /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer_ring.so
 in sage.rings.integer_ring.IntegerRing_class._div
 (sage/rings/integer_ring.c:5158)()

 TypeError: Argument 'right' has incorrect type (expected
 sage.rings.integer.Integer, got sage.symbolic.expression.Expression)


 Doug

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




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

-- 
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] question about radical

2011-08-17 Thread pong
Hum...

[radical(k) for k in [1..30]] produces the expected list however

[radical(k) for k in range(1,31)] rises an error

AttributeError: 'int' object has no attribute 'factor'

Wouldn't it be nice if the 2nd comprehension also give the desire
list? Any reason why shouldn't SAGE take that?



-- 
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 radical

2011-08-17 Thread Justin C. Walker
Hi,

On Aug 17, 2011, at 00:20 , pong wrote:

 [radical(k) for k in [1..30]] produces the expected list however
 
 [radical(k) for k in range(1,31)] rises an error
 
 AttributeError: 'int' object has no attribute 'factor'

The problem here is the distinction between Python 'int's and Sage 'Integer's.  
You can get the effect you want by using 'srange' (which returns a list of the 
latter instead of the former):

sage: [radical(k) for k in srange(1,31)] 
 [1, 2, 3, 2, ... 3, 14, 29, 30]

(there's also an 'xsrange' (or 'sxrange').

I don't know that there is a good way to fix this issue.

HTH

Justin

--
Justin C. Walker
Curmudgeon at Large
Director
Institute for the Enhancement of the Director's Income
--
Build a man a fire and he'll be warm
 for a night.
Set a man on fire and he'll be warm
 for the rest of his life.



-- 
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] question on integration of piecewise related function

2011-08-15 Thread linouc
Hello, Sage groups, I have a problem, please see the example below, I
wonder anyone can help me solve this problem:

f = Piecewise([[(0,pi/2),-1],[(pi/2,pi),2]])
a=pi*integrate(f,x,0,pi)
a.show()
b=pi*integrate(sin(x),x,0,pi)
b.show()
integrate(f*sin(x),x,0,pi)

---
The first two integrations are right, but for the last one, I got the
following error message:


Traceback (click to the left of this block for traceback)
...
AttributeError: 'sage.symbolic.expression.Expression' object has no
attribute 'domain'

-- 
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] question about creating homomorphisms

2011-08-02 Thread Johannes
Hi list
i need to construct two morphisms
f:ZZ^n \to Z given by a diagonalmatrix
and g: ZZ - Z/dZ

because I have to find the kernel of the compositoin.
consturcting g was no problem by g = ZZ.hom(ZZ.quotient(ZZ.ideal(d)))
father, getting the kernel of f as matrix worked too.
but how to get the kernel of the compositoin?

greatz Johanens

-- 
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 creating homomorphisms

2011-08-02 Thread William Stein
On Tue, Aug 2, 2011 at 12:21 PM, Johannes dajo.m...@web.de wrote:
 Hi list
 i need to construct two morphisms
 f:ZZ^n \to Z given by a diagonalmatrix
 and g: ZZ - Z/dZ

 because I have to find the kernel of the compositoin.
 consturcting g was no problem by g = ZZ.hom(ZZ.quotient(ZZ.ideal(d)))
 father, getting the kernel of f as matrix worked too.
 but how to get the kernel of the compositoin?


I'll speak in code:

sage: f = Hom(ZZ^3, ZZ^1)([1,2,3])
sage: g = Hom(ZZ^1, ZZ.quotient_ring(7)^1)([1])
sage: g * f
Free module morphism defined by the matrix
[1]
[2]
[3]
Domain: Ambient free module of rank 3 over the principal ideal domain ...
Codomain: Vector space of dimension 1 over Ring of integers modulo 7
sage: h = g * f
sage: h.kernel()
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1  1 -1]
[ 0  3 -2]

 -- william

-- 
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 polynomial rings and their fraction fields

2010-09-25 Thread Robert Bradshaw
On Fri, Sep 24, 2010 at 6:56 PM, kcrisman kcris...@gmail.com wrote:
 If I make a polynomial ring using

 sage: b = PolynomialRing(ZZ, 'x')

 I get some odd behavior.  Namely,

 sage: bool(b(x)==x)
 True
 sage: b(x)
 x
 sage: type(b(x))
 something about element of the ring
 sage: type(x)
 symbolic expression

 This isn't really that odd, but still I don't know whether it is good
 that one can still use x as a symbolic variable.  Probably this was a
 design decision.

There is the distinction between x the Python variable and x the
symbol (aka symbolic variable). For example, in the code below x and y
both store the symbol x.

sage: y = x
sage: y
x

x just happens to start out as a symbolic variable with the same name
as the Python variable. In general, we try to avoid overwriting the
namespace, so when you do

sage: x = 3
sage: PolynomialRing(ZZ, 'x')
Univariate Polynomial Ring in x over Integer Ring
sage: x
3

you don't have any surprises. You can change this with inject_on()

sage: inject_on()
Redefining: FiniteField Frac FractionField FreeMonoid GF
LaurentSeriesRing NumberField PolynomialRing quo quotient
sage: PolynomialRing(ZZ, 'x')
Defining x
Univariate Polynomial Ring in x over Integer Ring
sage: x
x
sage: type(x)
type 
'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'


(And whatever used to be in x is now gone.) Of course most people just write

sage: R.x = ZZ[]

which defines the ring and assigns the generator in one step.

 Anyway, what I really don't like is when you make

 sage: a = FractionField(PolynomialRing(ZZ, 'x'))
 sage: a(1/x)
 weird error that seems to imply it has not coerced x to the
 polynomial ring

We should certainly raise a better error here (or accept it).
Automatic coercion is always a compromise between convenience and
surprise. For example, if we didn't have any coercions there than

sage: a = ZZ['x'].gen()
sage: a = ZZ['x'](2)
sage: b = SR(2)
sage: a
2
sage: b
2
sage: bool(a == b)
False# hypothetically

would be especially confusing, especially if the context weren't so
clear (e.g. trying to debug something when a and b were generated by
completely different functions at completely different times.) Even if
one made an exception for constants

sage: a
x
sage: b
x
sage: bool(a == b)
False# hypothetically

I think would still cause more confusion than the current behavior.

 Did I do something wrong, or is this a bug?  Because of the initial
 behavior, maybe I shouldn't expect to be able to do this.

 Thanks,
 - kcrisman

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


-- 
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 polynomial rings and their fraction fields

2010-09-25 Thread Burcin Erocal
On Fri, 24 Sep 2010 18:56:14 -0700 (PDT)
kcrisman kcris...@gmail.com wrote:

 sage: a = FractionField(PolynomialRing(ZZ, 'x'))
 sage: a(1/x)
 weird error that seems to imply it has not coerced x to the
 polynomial ring
 
 Did I do something wrong, or is this a bug?  Because of the initial
 behavior, maybe I shouldn't expect to be able to do this.

This is #7741:

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

It is waiting for review with a patch by Robert Bradshaw. :)

Cheers,
Burcin

-- 
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] Question about polynomial rings and their fraction fields

2010-09-24 Thread kcrisman
If I make a polynomial ring using

sage: b = PolynomialRing(ZZ, 'x')

I get some odd behavior.  Namely,

sage: bool(b(x)==x)
True
sage: b(x)
x
sage: type(b(x))
something about element of the ring
sage: type(x)
symbolic expression

This isn't really that odd, but still I don't know whether it is good
that one can still use x as a symbolic variable.  Probably this was a
design decision.  Anyway, what I really don't like is when you make

sage: a = FractionField(PolynomialRing(ZZ, 'x'))
sage: a(1/x)
weird error that seems to imply it has not coerced x to the
polynomial ring

Did I do something wrong, or is this a bug?  Because of the initial
behavior, maybe I shouldn't expect to be able to do this.

Thanks,
- kcrisman

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