[sage-support] Re: Passing graphics objects

2014-03-24 Thread kcrisman
Hi!  Can you give a more explicit example of what you'd like to have happen?

I want to create a plot by traversing a tree where some leaves of the data 
> structure add line segments. I am trying to pass one graphics object to a 
> function that adds a line segment to the graphics object. I assumed the 
> graphics object is passed by reference so that changes inside the function 
> would affect the original graphics object. However, that is not the case. 
> How can one build up a graphics object via function calls?
>

I'm wondering, since you just want to add, whether you could just use the + 
operator for this?  But I may be misunderstanding this.

- 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] Passing graphics objects

2014-03-24 Thread steven . v . wilkinson
I want to create a plot by traversing a tree where some leaves of the data 
structure add line segments. I am trying to pass one graphics object to a 
function that adds a line segment to the graphics object. I assumed the 
graphics object is passed by reference so that changes inside the function 
would affect the original graphics object. However, that is not the case. How 
can one build up a graphics object via function calls?

-- 
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: xlrd, xlwt, xlutils with sage

2014-03-24 Thread Shaifali Agrawal
Hey John Thanks alot!!

-- 
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: xlrd, xlwt, xlutils with sage

2014-03-24 Thread John H Palmieri
Here's the answer I just posted to your question on Stack Overflow 
(http://stackoverflow.com/questions/22612301/xlrd-xlwt-with-sagemath):

Rather than installing them with the system Python, install them with 
Sage's Python: you can either do sage --sh: this starts a subshell with 
various environment variables set appropriately for use with Sage, in 
particular $PATH will have $SAGE_ROOT/local/bin first. Then install the 
packages with python setup.py install etc. Or you can just run Sage's 
Python directly with sage --python setup.py install 

-- 
John



On Monday, March 24, 2014 7:07:23 AM UTC-7, Shaifali Agrawal wrote:
>
> Hello everyone
>
> I want to use xlrd, xlwt, xlutils with sagemath. I have installed them in 
> my system's Python but sage environment is not recognizing them. Any idea 
> how can I make them work inside sage?? I am using Ubuntu 12(quantal) with 
> 32 bits and Sage Version 5.8 with Python 2.7.5
>
> Got same problem with Tkinter too but solved it using " sudo apt-get 
> install tk8.5-dev " got solution form 
> http://www.sagemath.org/doc/faq/faq-usage.html#how-to-get-sage-s-python-to-recognize-my-system-s-tcl-tk-install
>
> But what for other libraries?
>
> I tried to install them manually inside 
> /usr/lib/sagemath/local/lib/python2.7/site-packages/ folder by putting tar 
> files then extract them and then sudo python setup.py install
> but still not working
>
>

-- 
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] Polynomial division without remainder

2014-03-24 Thread martin . vgagern
Working in a stack of multivariate polynomial rings, how can I compute the 
quotient of two polynomials in those cases where I know the remainder to be 
zero?

Reading the docs I found two likely approaches, but neither seems to work 
as I'd have hoped. See below for error messages.

Example:

sage: PR1.=QQ[]
sage: PR2.=PR1[]
sage: n=(x-y)*(x+3*y)
sage: d=(x-y)
sage: n/d
(x^2 + 2*x*y + (-3)*y^2)/(x - y)
sage: PR2(n/d)
---
TypeError Traceback (most recent call last)
 in ()
> 1 PR2(n/d)

…/sage/rings/polynomial/multi_polynomial_ring.pyc in __call__(self, x, 
check)
449 return x.numerator()
450 else:
--> 451 raise TypeError, "unable to coerce since the 
denominator is not 1"
452 
453 elif is_SingularElement(x) and self._has_singular:

TypeError: unable to coerce since the denominator is not 1
sage: n.quo_rem(d)
---
TypeError Traceback (most recent call last)
 in ()
> 1 n.quo_rem(d)

…/sage/structure/element.so in 
sage.structure.element.NamedBinopMethod.__call__ 
(sage/structure/element.c:24924)()

…/sage/rings/polynomial/multi_polynomial_element.pyc in quo_rem(self, right)
   1730 return self.quo_rem(right)  # this looks like 
recursion, but, in fact, it may be that self, right are a totally new 
composite type
   1731 R = self.parent()
-> 1732 R._singular_().set_ring()
   1733 X = self._singular_().division(right._singular_())
   1734 return R(X[1][1,1]), R(X[2][1])

…/sage/rings/polynomial/polynomial_singular_interface.pyc in 
_singular_(self, singular)
213 return R
214 except (AttributeError, ValueError):
--> 215 return self._singular_init_(singular)
216 
217 def _singular_init_(self, singular=singular_default):

…/sage/rings/polynomial/polynomial_singular_interface.pyc in 
_singular_init_(self, singular)
229 """
230 if not can_convert_to_singular(self):
--> 231 raise TypeError, "no conversion of this ring to a 
Singular ring defined"
232 
233 if self.ngens()==1:

TypeError: no conversion of this ring to a Singular ring defined

-- 
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: int() on real numbers broken?

2014-03-24 Thread Peter Bruin
Hello,

> I am working on a Z80 project and I needed 72 bits of precision for 64
> elements of the form log2(1+2^-i) (so log2(3/2), log2(5/4),...). I
> needed to convert these to hexadecimal, and it worked until I tried
> the following for i=56:
> int(256*log(1+2^-56,2))
>
> This returns 1, when in fact it should be 0. Actually, instead of
> multiplying by 256, multiplying by 65536, or 600, or many other
> numbers would also return the integer part as 1.
>
> As a note, I used RealField(80) as my precision.

Typing log(1 + 2^-56, 2) gives the result as a symbolic expression, not
as an element of a real field.  Applying int() to this internally uses a
RealIntervalField with 53 bits of precision, which is not enough in this
case.  Here is a way to get the desired precision:

sage: x = RealField(80)(256*log(1+2^-56,2))
sage: x
5.1254824061038682620123e-15
sage: int(x)
0

Peter

-- 
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: extension de corps

2014-03-24 Thread Peter Bruin
Bonjour,

Il est malheureusement un peu problématique de construire des tours
(extensions successives) de corps.  Sage sait bien vérifier que votre F6
est un corps, mais F6 est toujours représenté comme anneau quotient et
non comme corps fini ; c'est pourquoi certaines opérations naturelles ne
marchent pas.

Une solution possible est de commencer par construire F12 et de voir les
autres corps comme des sous-corps de F12.  Un calcul montre que le
polynôme minimal de l'élément primitif w de F12 est x^12 - 2x^6 + 2.  On
peut maintenant faire

sage: t=-(2^62 + 2^55 +1)
sage: p=36*t^4+36*t^3+24*t^2+6*t+1
sage: F=GF(p)
sage: R. = PolynomialRing(F)
sage: f = x^12 - 2*x^6 + 2
sage: F12. = FiniteField(p^12, modulus=f)
sage: v = w^2
sage: i = v^3 - 1
sage: i^2 == -1
True

En principe, il est possible de construire explicitement les sous-corps
et les plongements F2 -> F6 -> F12, mais il est sans doute plus facile
de faire tous les calculs directement dans F12.

Peter


> بتاريخ الأربعاء، 19 مارس، 2014 UTC+1 9:26:58 م، كتب ghamma...@gmail.com:
> > Bonsoir
> > SVP, j'ai besoin de definir sur Sage 3 extensions de corps, mais je
> > n'arrive pas. Je peux definir que deux extensions.

> When i find the test F6.is field() the answer is true,

> in this representation i have Fp^2, Fp^6 and Fp^12 are fields. But I
> need that Fp^2 be a field extension bacause I need to seperate his
> elements(a in Fp^2=a0+i*a1 and i need the value of a0=a[0] and
> a1=a[1])
> #t=2^62-2^54+2^44
> t=-(2^62 + 2^55 +1)
> #t=2^63-2^49
> p=36*t^4+36*t^3+24*t^2+6*t+1
> r=36*t^4+36*t^3+18*t^2+6*t+1
> tr=6*t^2+1
> #-- Fp--
> F=GF(p)
> #---
> b=2
> #--Fp^2--
> K2.=PolynomialRing(F)
> F2.=FiniteField(p^2,modulus=x^2+1)
> #
> #-Fp^6-
> K6.=PolynomialRing(F2)
> F6.=F2.extension(y^3-i-1)
> #-

> #---Fp^12---

> K12.=PolynomialRing(F6)
> F12.=F6.extension(z^2-v)
> F12.is_field=lambda:True
> #

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


[sage-support] xlrd, xlwt, xlutils with sage

2014-03-24 Thread Shaifali Agrawal
Hello everyone

I want to use xlrd, xlwt, xlutils with sagemath. I have installed them in my 
system's Python but sage environment is not recognizing them. Any idea how can 
I make them work inside sage?? I am using Ubuntu 12(quantal) with 32 bits and 
Sage Version 5.8 with Python 2.7.5

Got same problem with Tkinter too but solved it using " sudo apt-get install 
tk8.5-dev " got solution form 
http://www.sagemath.org/doc/faq/faq-usage.html#how-to-get-sage-s-python-to-recognize-my-system-s-tcl-tk-install

But what for other libraries?

I tried to install them manually inside 
/usr/lib/sagemath/local/lib/python2.7/site-packages/ folder by putting tar 
files then extract them and then sudo python setup.py install
but still not working

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


[sage-support] int() on real numbers broken?

2014-03-24 Thread Zeda Thomas
I am working on a Z80 project and I needed 72 bits of precision for 64 elements 
of the form log2(1+2^-i) (so log2(3/2), log2(5/4),...). I needed to convert 
these to hexadecimal, and it worked until I tried the following for i=56:
int(256*log(1+2^-56,2))

This returns 1, when in fact it should be 0. Actually, instead of multiplying 
by 256, multiplying by 65536, or 600, or many other numbers would also return 
the integer part as 1.

As a note, I used RealField(80) as my precision.

-- 
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] Correctness of Extended Quadratic Residue Code over GF(4)

2014-03-24 Thread Gerli Viikmaa
Hi,

Thank you for your reply. I will look into the implementation of QR codes over 
non-prime fields. 

All the best,
Gerli

esmaspäev, 24. märts 2014 12:54.29 UTC+2 kirjutas David Joyner:
> On Mon, Mar 24, 2014 at 6:28 AM, Gerli Viikmaa wrote:
> 
> > Hi,
> 
> >
> 
> > I'm working on vectors of varying sizes on GF(4) and I'm currently trying 
> > to implement the code given in 
> > http://www.iks.kit.edu/home/grassl/codetables/BKLC/BKLC.php?q=4&n=8&k=2
> 
> >
> 
> > The first step (Extend the QRCode over GF(4) of length 11) should give me a 
> > [12, 6, 6] linear code - vectors of length 12, dimension 6, minimum 
> > (Hamming) distance 6.
> 
> >
> 
> > But the execution
> 
> > sage: codes.ExtendedQuadraticResidueCode(11, GF(4,'a'))
> 
> > Linear code of length 12, dimension 11 over Finite Field in a of size 2^2
> 
> >
> 
> > gives me a linear code of dimension 11. If my field size is prime, then I 
> > do get a code with dimension 6. According to that source, the dimension 
> > should be 6 with field size 4 as well. Why isn't it?
> 
> >
> 
> 
> 
> Quadratic residue codes are defined over prime fields:
> 
> http://en.wikipedia.org/wiki/Quadratic_residue_code
> 
> If there is a generalization of QR codes to the extension field case,
> 
> it is not implemented in Sage. Sorry.
> 
> Feel free to implement it and submit a patch:-)  (Alternatively, share
> 
> your code on sage-devel.)
> 
> 
> 
> > I'm running Sage Version 6.1.1, Release Date: 2014-02-04 on Ubuntu 12.04.
> 
> >
> 
> > Thank you in advance,
> 
> > Gerli
> 
> >
> 
> > --
> 
> > 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] Correctness of Extended Quadratic Residue Code over GF(4)

2014-03-24 Thread David Joyner
On Mon, Mar 24, 2014 at 6:28 AM, Gerli Viikmaa  wrote:
> Hi,
>
> I'm working on vectors of varying sizes on GF(4) and I'm currently trying to 
> implement the code given in 
> http://www.iks.kit.edu/home/grassl/codetables/BKLC/BKLC.php?q=4&n=8&k=2
>
> The first step (Extend the QRCode over GF(4) of length 11) should give me a 
> [12, 6, 6] linear code - vectors of length 12, dimension 6, minimum (Hamming) 
> distance 6.
>
> But the execution
> sage: codes.ExtendedQuadraticResidueCode(11, GF(4,'a'))
> Linear code of length 12, dimension 11 over Finite Field in a of size 2^2
>
> gives me a linear code of dimension 11. If my field size is prime, then I do 
> get a code with dimension 6. According to that source, the dimension should 
> be 6 with field size 4 as well. Why isn't it?
>

Quadratic residue codes are defined over prime fields:
http://en.wikipedia.org/wiki/Quadratic_residue_code
If there is a generalization of QR codes to the extension field case,
it is not implemented in Sage. Sorry.
Feel free to implement it and submit a patch:-)  (Alternatively, share
your code on sage-devel.)

> I'm running Sage Version 6.1.1, Release Date: 2014-02-04 on Ubuntu 12.04.
>
> Thank you in advance,
> Gerli
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

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


[sage-support] Correctness of Extended Quadratic Residue Code over GF(4)

2014-03-24 Thread Gerli Viikmaa
Hi,

I'm working on vectors of varying sizes on GF(4) and I'm currently trying to 
implement the code given in 
http://www.iks.kit.edu/home/grassl/codetables/BKLC/BKLC.php?q=4&n=8&k=2

The first step (Extend the QRCode over GF(4) of length 11) should give me a 
[12, 6, 6] linear code - vectors of length 12, dimension 6, minimum (Hamming) 
distance 6.

But the execution
sage: codes.ExtendedQuadraticResidueCode(11, GF(4,'a'))
Linear code of length 12, dimension 11 over Finite Field in a of size 2^2

gives me a linear code of dimension 11. If my field size is prime, then I do 
get a code with dimension 6. According to that source, the dimension should be 
6 with field size 4 as well. Why isn't it?

I'm running Sage Version 6.1.1, Release Date: 2014-02-04 on Ubuntu 12.04.

Thank you in advance,
Gerli

-- 
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] Contents of notebook vanished

2014-03-24 Thread Dennis Eichhorn
Running 'Sage Version 5.1, Release Date: 2012-07-09' in Windows 7 using Oracle 
VM VirtualBox Manager as suggested.

A notebook that had a lot of very important stuff in it has turned into a blank 
notebook.  I had been saving frequently, but was in the middle of making a 
bunch of 3D graphic images when they stopped showing up.  I decided that maybe 
I had too many at once, so I saved and restarted my VM VirtualBox session as 
usual (clicked save button, then clicked the red X on my window, which gives me 
3 choices as usual, I chose #2, "send the shutdown signal".  Then after 
shutdown, clicked on the sage machine in VM VirtualBox, and the whole sage 
thing restarts, and shows me a list of my notebooks).  I did this once or twice 
and it reopened my notebook as usual, but I still had the problem of after a 
few 3D images, they stopped showing up (Jmol just gave me a black square, I 
think).  So, I followed the same steps to restart, but now my notebook is empty!

I do not understand the VM VirtualBox well at all.  I think it's creating it's 
own file system on my hard drive.  I do not know how to access my sage files 
from windows directly, for example.  

How can I recover my notebook in any form?

ALSO, I WAS able to find some older copies of the notebook.  I also frequently 
save not by hitting the save button, but by going to File, Save worksheet to a 
file, then OK.  I think this is creating tons of copies of my notebook (is it a 
notebook or a worksheet?).  I went to File, Load worksheet from a file, then 
clicked on the "choose file" button, then went to File System, 
home/gui/Downloads , and sure enough there are tons of copies of my notebook.  
But, for some reason all of them are over 4 months old, although I feel pretty 
certain I've saved via the file button many times since then.  The file names 
are listed like this:

filename.sws
filename (1).sws
filename (2).sws
etc. (filename is the same throughout) all the way down to 
filename (100).sws

There's exactly 100 of them!  Coincidence?

Can anyone help me find a more recent copy in any way?

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