[sage-support] Re: Several Substitution

2014-08-18 Thread Emmanuel Charpentier
If I follow your cpde correctly, you are working on polynoms in X0,..,X3. 
What you attempt to create would be a polynom in x00,..,x03,x10..x33.

Doubleplusungood...

You should probaby use expressions in SR and cast the resultant expression 
in the ring of polynoms in x00,..x33.

BTW, you don't have to loop on your substitution : create a dictionary.

This gives :

p = 3
k.t = GF(2^p)
nvars = 4
vars_GF = []
vars_gf2 = []
vars_gf2subs = []
l = 0
for i in range(nvars):
vars_GF.append(var(X+str(i)))
sum1 = 0
for j in range(p):
vars_gf2.append(var(x+str(i)+str(j)))
sum1 = sum1 + vars_gf2[i*p+j]*(t^j)
l = l + 1
vars_gf2subs.append(sum1)
PR = PolynomialRing(k, nvars, names = vars_GF)
p = PR.random_element(degree=2)
Dic={vars_GF[i]:vars_gf2subs[i] for i in range(nvars)}
PR2=PolynomialRing(k, nvars*p, names = vars_gf2)
p2=PR2(SR(p).subs(Dic))

p2 might or might not be what you want.

There are probably more steamlined ways to accomplish what you want, but 
I'm only discovering Sage...

HTH,

--
Emmanuel Charpentier

Le lundi 18 août 2014 07:18:26 UTC+2, juaninf a écrit :

 Dears members I need doing substitution of values vars_gf2subs in vars_GF 
 variables on p polynomial. I'm trying p.subs(vars_GF[i]=vars_gf2subs[i]) bu 
 tI get error. How I will be able to doing that?

 p = 3
 k.t = GF(2^p)
 nvars = 4
 vars_GF = []
 vars_gf2 = []
 vars_gf2subs = []
 l = 0
 for i in range(nvars):
 vars_GF.append(var(X+str(i)))
 sum1 = 0
 for j in range(p):
 vars_gf2.append(var(x+str(i)+str(j)))
 sum1 = sum1 + vars_gf2[i*p+j]*(t^j)
 l = l + 1
 vars_gf2subs.append(sum1)

 PR = PolynomialRing(k, nvars, names = vars_GF)
 p = PR.random_element(degree=2)
 for i in range(nvars):
 print vars_GF[i]
 p.subs(vars_GF[i]=vars_gf2subs[i])

 -- 
 -
 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] Re: Several Substitution

2014-08-18 Thread Juan Grados
Dear Emmanuel,
Thank, ... one last question ... How I will be able to extract the
coefficients of t^0,t^1,...,t^(p-1)


2014-08-18 5:49 GMT-03:00 Emmanuel Charpentier 
emanuel.charpent...@gmail.com:

 If I follow your cpde correctly, you are working on polynoms in X0,..,X3.
 What you attempt to create would be a polynom in x00,..,x03,x10..x33.

 Doubleplusungood...

 You should probaby use expressions in SR and cast the resultant expression
 in the ring of polynoms in x00,..x33.

 BTW, you don't have to loop on your substitution : create a dictionary.

 This gives :

 p = 3
 k.t = GF(2^p)
 nvars = 4
 vars_GF = []
 vars_gf2 = []
 vars_gf2subs = []
 l = 0
 for i in range(nvars):
 vars_GF.append(var(X+str(i)))
 sum1 = 0
 for j in range(p):
 vars_gf2.append(var(x+str(i)+str(j)))
 sum1 = sum1 + vars_gf2[i*p+j]*(t^j)
 l = l + 1
 vars_gf2subs.append(sum1)
 PR = PolynomialRing(k, nvars, names = vars_GF)
 p = PR.random_element(degree=2)
 Dic={vars_GF[i]:vars_gf2subs[i] for i in range(nvars)}
 PR2=PolynomialRing(k, nvars*p, names = vars_gf2)
 p2=PR2(SR(p).subs(Dic))

 p2 might or might not be what you want.

 There are probably more steamlined ways to accomplish what you want, but
 I'm only discovering Sage...

 HTH,

 --
 Emmanuel Charpentier

 Le lundi 18 août 2014 07:18:26 UTC+2, juaninf a écrit :

 Dears members I need doing substitution of values vars_gf2subs in vars_GF
 variables on p polynomial. I'm trying p.subs(vars_GF[i]=vars_gf2subs[i])
 bu tI get error. How I will be able to doing that?

 p = 3
 k.t = GF(2^p)
 nvars = 4
 vars_GF = []
 vars_gf2 = []
 vars_gf2subs = []
 l = 0
 for i in range(nvars):
 vars_GF.append(var(X+str(i)))
 sum1 = 0
 for j in range(p):
 vars_gf2.append(var(x+str(i)+str(j)))
 sum1 = sum1 + vars_gf2[i*p+j]*(t^j)
 l = l + 1
 vars_gf2subs.append(sum1)

 PR = PolynomialRing(k, nvars, names = vars_GF)
 p = PR.random_element(degree=2)
 for i in range(nvars):
 print vars_GF[i]
 p.subs(vars_GF[i]=vars_gf2subs[i])

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




-- 
-
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] sage-6.3-x86_64-Darwin-OSX_10.6_x86_64-app.dmg won't be built?

2014-08-18 Thread Daniel Friedan
For OS X 10.6, there is no -app build of Sage 6.3 available for download, 
only
  sage-6.3-x86_64-Darwin-OSX_10.9_x86_64-app.dmg
  sage-6.2-x86_64-Darwin-OSX_10.6_x86_64-app.dmg

Is this a new policy?  Will those of us who don't like OS X 10.6 have to 
learn to build the OS X 10.6 -app versions ourselves?

thanks,
Daniel

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


[sage-support] Re: sage-6.3-x86_64-Darwin-OSX_10.6_x86_64-app.dmg won't be built?

2014-08-18 Thread Volker Braun
Maybe you want to review this ticket: http://trac.sagemath.org/ticket/16796


On Monday, August 18, 2014 3:26:27 PM UTC+1, Daniel Friedan wrote:

 For OS X 10.6, there is no -app build of Sage 6.3 available for download, 
 only
   sage-6.3-x86_64-Darwin-OSX_10.9_x86_64-app.dmg
   sage-6.2-x86_64-Darwin-OSX_10.6_x86_64-app.dmg

 Is this a new policy?  Will those of us who don't like OS X 10.6 have to 
 learn to build the OS X 10.6 -app versions ourselves?

 thanks,
 Daniel



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


Re: [sage-support] Re: Several Substitution

2014-08-18 Thread Nils Bruin


On Monday, August 18, 2014 7:11:53 AM UTC-7, juaninf wrote:

 Dear Emmanuel,
 Thank, ... one last question ... How I will be able to extract the 
 coefficients of t^0,t^1,...,t^(p-1)

 I wouldn't trust SR with anything in positive characteristic. It is not 
designed for it and it is hard to control what it will do at any particular 
moment (many algebraic operations will work out fine, but I wouldn't be 
confident that I can predict that it will only use those).

The substitution you want to do is just a polynomial evaluation, so it 
should be fairly easy to work out what to do in terms of polynomial rings, 
without touching SR at all:

k.t=GF(2^3)
namesR=[x%d%d%(j,i) for j in [0..3] for i in [0..2]]
R=PolynomialRing(k,names=namesR)
subsvar=[sum((t^i*R.gen(i+3*j) for i in [0..2])) for j in [0..3]]

//now we have your substitution

namesP=[X%d%i for i in [0..3]]
P=PolynomialRing(k,names=namesP)
p=P.random_element(degree=2)

//this gives your example polynomial. Evaluating:

p(subsvar)

q=p(subsvar) #let's give it a name

//to split according to coefficients wrt. t we need t to be the outer 
variable:

A=PolynomialRing(GF(2),namesR)
At=A['t']

//unfortunately, sage cannot figure out the coercion from R to At by 
itself, so we need to help it. We just extract coefficient-monomial pairs 
//and map them over individually and then assemble as a polynomial again:
//we run into a bad bug here as well:

qAt=sum(At(b.polynomial())*A(a) for b,a in dict(q).iteritems())

dict(q) unfortunately has the coefficients for keys and monomials for 
values. That must be a stupid typo in the source. e.g.

dict(R.0+R.1)

gives garbage back. After the bugfix the invocation should be

 a,b in dict(q).iteritems() ...

//to get the coefficients you want:

qAt.list()

however, currently that will only give you the correct answer if all the 
non-zero coefficients in q happen to be distinct.

You could use q.dict() instead which has the appropriate order, but encodes 
the monomials as exponent vectors, which are hard to convert to At. [you 
should go that route, though, because the other method can give you wrong 
answers]

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


Re: [sage-support] Re: Several Substitution

2014-08-18 Thread Nils Bruin
On Monday, August 18, 2014 9:25:56 AM UTC-7, Nils Bruin wrote:


 You could use q.dict() instead which has the appropriate order, but 
 encodes the monomials as exponent vectors, which are hard to convert to At. 
 [you should go that route, though, because the other method can give you 
 wrong answers]


Workaround (relying on .monomials() and .coefficients() returning their 
results in compatible order):

 sum([b.polynomial()*At(a) for a,b in 
zip(q.monomials(),q.coefficients())]).list()

You should file tickets for the bugs in dict(q) and the uselessness of 
q.dict().

-- 
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] Strange characters in sage terminal

2014-08-18 Thread Oscar Lazo
Hi!

I used to see some straight lines when I started the sage command-line (the 
ones surrounding the header), but now I see some question marks of the kind 
you see when your system doesn't recognize some character. What do you 
think I'm missing? I have an Ubuntu system.

http://i.imgur.com/NItMB21.png

Thank you!

Oscar Lazo

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


[sage-support] Re: Strange characters in sage terminal

2014-08-18 Thread Dima Pasechnik
On 2014-08-18, Oscar Lazo algebraicame...@gmail.com wrote:
 --=_Part_1633_1643381375.1408388447844
 Content-Type: text/plain; charset=UTF-8

 Hi!

 I used to see some straight lines when I started the sage command-line (the 
 ones surrounding the header), but now I see some question marks of the kind 
 you see when your system doesn't recognize some character. What do you 
 think I'm missing? I have an Ubuntu system.

probably your terminal is not UTF-8 - aware.
(these symbols are from UTF-8, not just ASCII)

Try opening uxterm and running Sage there.
If you still see these, this would indicate weird locale settings...



 http://i.imgur.com/NItMB21.png

 Thank you!

 Oscar Lazo


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


[sage-support] Re: Strange characters in sage terminal

2014-08-18 Thread Oscar Lazo
Yes, I ran uxterm and I still see strange characters there. Any ideas?

Thank you,

Oscar.

El lunes, 18 de agosto de 2014 14:41:42 UTC-5, Dima Pasechnik escribió:

 On 2014-08-18, Oscar Lazo algebra...@gmail.com javascript: wrote: 
  --=_Part_1633_1643381375.1408388447844 
  Content-Type: text/plain; charset=UTF-8 
  
  Hi! 
  
  I used to see some straight lines when I started the sage command-line 
 (the 
  ones surrounding the header), but now I see some question marks of the 
 kind 
  you see when your system doesn't recognize some character. What do you 
  think I'm missing? I have an Ubuntu system. 

 probably your terminal is not UTF-8 - aware. 
 (these symbols are from UTF-8, not just ASCII) 

 Try opening uxterm and running Sage there. 
 If you still see these, this would indicate weird locale settings... 


  
  http://i.imgur.com/NItMB21.png 
  
  Thank you! 
  
  Oscar Lazo 
  



-- 
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] Sage giving wrong answer to simple question.

2014-08-18 Thread Ron Bannon
solve( (x^2-9)/(x-3) = 0, x) should yield x = -3, x neq 3, but Sage just 
gives x = -3. Any thoughts?

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


[sage-support] Re: Sage giving wrong answer to simple question.

2014-08-18 Thread Oscar Lazo
Well, the limit of your expression as x goes to 3 does exist.

Oscar.

El lunes, 18 de agosto de 2014 15:07:47 UTC-5, Ron Bannon escribió:

 solve( (x^2-9)/(x-3) = 0, x) should yield x = -3, x neq 3, but Sage just 
 gives x = -3. Any thoughts?


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


[sage-support] Re: sage-6.3-x86_64-Darwin-OSX_10.6_x86_64-app.dmg won't be built?

2014-08-18 Thread kcrisman


 Maybe you want to review this ticket: 
 http://trac.sagemath.org/ticket/16796


What Volker means by this is that he doesn't have access to a 10.6 buildbot 
to try this out.  Apparently the machine that was there gave up the 
ghost... ?  (Volker, did anyone get back to you on the status of bsd?)

 

 For OS X 10.6, there is no -app build of Sage 6.3 available for download, 
 only
   sage-6.3-x86_64-Darwin-OSX_10.9_x86_64-app.dmg
   sage-6.2-x86_64-Darwin-OSX_10.6_x86_64-app.dmg

 Is this a new policy?  Will those of us who don't like OS X 10.6 have to 
 learn to build the OS X 10.6 -app versions ourselves?


Hopefully not, but it may require volunteers to create them.  It might even 
be possible for you to make your own version of it, true.  I have a 10.7 
binary which I have offered to upload but of course that wouldn't help you.

- 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] Re: partitioned graphs in Sage?

2014-08-18 Thread kcrisman


 Thanks, Dima, I will continue to experiment.  At the moment I am 
 having fun with show3d(color_by_label=True)! 


 There are two helper functions you may like, buried in a module because I 
 did not know how to write a nice user interface for that:

 sage: from sage.graphs.graph_plot import _circle_embedding
 sage: from sage.graphs.graph_plot import _line_embedding


Wow that would be very useful to expose more generally!  I just did a 
tutorial where I did this by hand as an example of how useful lambda 
functions are.

 

 The first one sets a list of vertices on a circle (you chose the center, 
 you chose the radius, and you can rotate it a bit too)
 The second one sets a list of vertices on a segment for (x1,y1) to (x2,y2)

 An example that might interest you, if you have a graph whose interesting 
 components are S1 and S2:

 sage: g = graphs.CubeGraph(4)
 sage: S1 = [x for x in g if x[-1] == '0']
 sage: S2 = [x for x in g if x[-1] == '1']
 sage: _circle_embedding(g,S1,center=(-1.5,0))
 sage: _circle_embedding(g,S2,center=(1.5,0))
 sage: g.show()

 Of course some edge may be drawn on top of each other and you don't like 
 that. That's why you can rotate one of these circles a bit:

 sage: _circle_embedding(g,S2,center=(1.5,0),shift=.5)
 sage: g.show()

 Nathann


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


Re: [sage-support] Re: Strange characters in sage terminal

2014-08-18 Thread Michael Orlitzky
On 08/18/2014 04:05 PM, Oscar Lazo wrote:
 Yes, I ran uxterm and I still see strange characters there. Any ideas?
 
 Thank you,
 

You also need to be using a font which supplies those glyphs. I think
the DejaVu family should have them if you want to test using 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.