[sage-support] Re: Plots using R in sage notebook appear later

2011-05-26 Thread ancienthart
And then there's Jason's beautiful little time-saving method if you use a 
lot of graphics:

*from contextlib import contextmanager @contextmanager def r_graphics(r): 
r.png() yield r.dev_off() with r_graphics(r): r.boxplot() 
r.some_other_plot()*

This and further discussion can be found at:
http://trac.sagemath.org/sage_trac/ticket/11266

Joal Heagney

-- 
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] Import Ellipse module?

2011-05-26 Thread Mel
Do I need to download/load something before I can import the ellipse
module?

When I type
from sage.plot.ellipse import Ellipse
I get ImportError: No module named ellipse

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] Error: Converting from p-adics to rationals.

2011-05-26 Thread William Stein
On Wed, May 25, 2011 at 5:53 PM, Mel chemmyg...@gmail.com wrote:
 I'm having an issue with converting between p-adic and rational
 numbers.

 Specifically, there are certain p-adic numbers that I cannot convert
 to rationals. As an example, if 1+7^3+O(7^5) is a 7-adic integer with
 capped relative precision 5, I cannot convert it to a rational. I get
 the error ValueError: Rational reconstruction of 344 (mod 16807) does
 not exist.

When asking such questions, it is helpful to give code that can
trivially pasted in that illustrates your problem.


 More generally, it seems that if the precision of the p-adic number is
 O(p^n), and the p-adic number includes powers of p greater than n/2,
 the number cannot be converted to a rational.

 Any info is appreciated. 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




-- 
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] Re: How use alternative authentication for notebook server?.(i.e. integrate with other web app?)..

2011-05-26 Thread Chris Seberino
Jason

Thanks.  Let me ask a related question.  If you do not do
authentication,
then does every student just go to their own personal URL to access
their notebook?  What is that URL?

In other words, I may be able to do what I want with URL magic.

cs

On May 26, 12:53 am, Jason Grout jason-s...@creativetrax.com wrote:
 On 5/26/11 12:35 AM, Chris Seberino wrote:

  My students authenticate themselves by signing into a classroom web
  app unrelated to Sage.

  Possible to integrate Sage notebook server with this classroom web app
  so students
  DO NOT have to authenticate a SECOND TIME with Sage login page?

 It depends on what webapp you are talking about.

 There is work to make the notebook work with OpenID, and there has been
 work before to make the notebook work with LDAP.  The OpenID work is
 nearly complete and will probably be merged into Sage sometime this summer.

 Jason

-- 
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] Not rebooting notebook server constantly leaves too many notebooks active?

2011-05-26 Thread Chris Seberino
Suppose different students sign into the same Sage server at different
times.

Won't that cause EVERY STUDENT's notebook to be in memory bogging down
the server?

I've been rebooting but maybe the smartest thing is to either...

1. Make students sign out? (Some will forget!!)

2. Autokill after 1 hour of inactivity?

cs

-- 
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] Re: Not rebooting notebook server constantly leaves too many notebooks active?

2011-05-26 Thread Jason Grout

On 5/26/11 12:19 PM, Chris Seberino wrote:

Suppose different students sign into the same Sage server at different
times.

Won't that cause EVERY STUDENT's notebook to be in memory bogging down
the server?

I've been rebooting but maybe the smartest thing is to either...

1. Make students sign out? (Some will forget!!)

2. Autokill after 1 hour of inactivity?


You can set a timeout that autokills worksheets after a certain period 
of time.  See the notebook command help:


notebook?

Jason


--
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] Re: How use alternative authentication for notebook server?.(i.e. integrate with other web app?)..

2011-05-26 Thread Jason Grout

On 5/26/11 12:15 PM, Chris Seberino wrote:

Jason

Thanks.  Let me ask a related question.  If you do not do
authentication,
then does every student just go to their own personal URL to access
their notebook?  What is that URL?


They need to log in to access their worksheets; there are session 
cookies that are set, for example.  If you try to go to the url 
representing a private worksheet without logging in, the system won't 
let you see the worksheet.


Jason

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


Re: [sage-support] Re: imposing commutation relation

2011-05-26 Thread Rajeev Singh
On Wed, May 25, 2011 at 11:55 AM, Simon King simon.k...@uni-jena.de wrote:

 Hi Rajeev,

 On 25 Mai, 06:14, Rajeev Singh rajs2...@gmail.com wrote:
  sage: R.a,b = FreeAlgebra(QQ, 2)
 
   sage: p = a*(a+2*b)
   sage: list(p)
   [(2, a*b), (1, a^2)]
 
  is there a simple way to reverse this last step?

 I thought that for many parents R holds that R(list(p))==p, but
 apparently I was mistaken.

 However, for example, in the case of polynomials, one has
  sage: P.x,y = QQ[]
  sage: p = P.random_element()
  sage: p
  x*y + 5*y^2 - x + 1
  sage: p.dict()
  {(1, 0): -1, (0, 0): 1, (1, 1): 1, (0, 2): 5}
  sage: P(p.dict()) == p
  True

 But apparently that does not hold for free algebras. Here is a work-
 around using the 'add' function:
   sage: R.a,b = FreeAlgebra(QQ, 2)
  sage: p = a*(a+2*b)
   sage: L = list(p)
  sage: add([c*R(m) for c,m in L], R(0))
  a^2 + 2*a*b

 Cheers,
 Simon

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


Thanks Simon,

One small querry -

sage: R.a,b = FreeAlgebra(QQ, 2)
sage: p = a*(a+2*b)
sage: p
a^2 + 2*a*b
sage: list(p)
[(2, a*b), (1, a^2)]

Why is the order of terms in the list not the same that in string of p (a^2
in string appears before a*b and the opposite happens for the list) ? What
can I do to make them in same order?

Rajeev

-- 
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] Re: imposing commutation relation

2011-05-26 Thread Simon King
Hi Rajeev,

On 26 Mai, 20:08, Rajeev Singh rajs2...@gmail.com wrote:
 Why is the order of terms in the list not the same that in string of p (a^2
 in string appears before a*b and the opposite happens for the list) ? What
 can I do to make them in same order?

One can sort lists in Python (see the Python docs), and one can also
state how the list elements shall be sorted.

Here, the list elements are pairs (coefficient,monomial), and we want
to sort so that the monomials increase, whereas the coefficients do
not matter.

Hence, you can do:

sage: p^3
a^6 + 2*a^5*b + 2*a^3*b*a^2 + 4*a^3*b*a*b + 2*a*b*a^4 + 4*a*b*a^3*b +
4*a*b*a*b*a^2 + 8*a*b*a*b*a*b
sage: L = list(p^3); L  # that's not ordered how you want it
[(1, a^6), (2, a^5*b), (2, a^3*b*a^2), (4, a*b*a*b*a^2), (4,
a*b*a^3*b), (2, a*b*a^4), (8, a*b*a*b*a*b), (4, a^3*b*a*b)]
sage: L.sort(cmp=lambda x,y:cmp(x[1],y[1]))  # sort by the monomials
sage: L
[(1, a^6), (2, a^5*b), (2, a^3*b*a^2), (4, a^3*b*a*b), (2, a*b*a^4),
(4, a*b*a^3*b), (4, a*b*a*b*a^2), (8, a*b*a*b*a*b)]

Remark: If you do
  sage: p._repr_??hit return after ??
then you see how printing p is implemented.

Cheers,
Simon

-- 
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] error installing Kash

2011-05-26 Thread jtyard
Hi,

I'm having trouble installing the optional kash package with
sage-4.7.  I'm using a recent issue macbook pro running 10.6.7.  Any
help would be appreciated.  Here is what happens:

$ sage -i kash3-2008-07-31.spkg
Installing kash3-2008-07-31.spkg
Calling sage-spkg on kash3-2008-07-31.spkg
Warning: Attempted to overwrite SAGE_ROOT environment variable
kash3-2008-07-31
Machine:
Darwin dhcp-141-198.caltech.edu 10.7.4 Darwin Kernel Version 10.7.4:
Mon Apr 18 21:24:17 PDT 2011; root:xnu-1504.14.12~3/RELEASE_X86_64
x86_64
Deleting directories from past builds of previous/current versions of
kash3-2008-07-31
Extracting package /Users/jtyard/sage-4.7/spkg/optional/
kash3-2008-07-31.spkg ...
-rw-r--r--  1 jtyard  staff  34877440 May 26 17:35 /Users/jtyard/
sage-4.7/spkg/optional/kash3-2008-07-31.spkg
Finished extraction

Host system
uname -a:
Darwin dhcp-141-198.caltech.edu 10.7.4 Darwin Kernel Version 10.7.4:
Mon Apr 18 21:24:17 PDT 2011; root:xnu-1504.14.12~3/RELEASE_X86_64
x86_64


CC Version
gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-
checking --enable-werror --prefix=/usr --mandir=/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/
$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-
prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-
apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

Usage:
  List:tar -tf archive-filename
  Extract: tar -xf archive-filename
  Create:  tar -cf archive-filename [filenames...]
  Help:tar --help
Error extracting kash.

real0m0.031s
user0m0.024s
sys 0m0.007s
sage: An error occurred while installing kash3-2008-07-31
Please email sage-devel http://groups.google.com/group/sage-devel
explaining the problem and send the relevant part of
of /Users/jtyard/sage-4.7/install.log.  Describe your computer,
operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/Users/jtyard/sage-4.7/spkg/build/kash3-2008-07-31 and type 'make
check' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
(cd '/Users/jtyard/sage-4.7/spkg/build/kash3-2008-07-31'  '/Users/
jtyard/sage-4.7/sage' -sh)
When you are done debugging, you can type exit to leave the
subshell.

-- 
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] Re: error installing Kash

2011-05-26 Thread John H Palmieri
On Thursday, May 26, 2011 5:41:24 PM UTC-7, jtyard wrote:

 Hi, 

 I'm having trouble installing the optional kash package with 
 sage-4.7.  I'm using a recent issue macbook pro running 10.6.7.  Any 
 help would be appreciated.  


It certainly looks like that spkg is broken.  In fact, this was reported as 
a bug almost a year ago, but no one has fixed it.  See 
http://trac.sagemath.org/sage_trac/ticket/9333.  I'll try to post a link 
to a new spkg soon.  Meanwhile, to fix it yourself: find the file 
kash3-2008-07-31.spkg, and from the terminal, run 

$ tar jxf kash3-2008-07-31.spkg

This will create a directory kash3-2008-07-31.  In that directory, edit 
the file spkg-install.  There is a line that says something like

  bunzip2 -c src/$PKG.tar.bz2 | tar fixmv -

and it should really say

  bunzip2 -c src/$PKG.tar.bz2 | tar jxf -

(Just the end is different, the characters after tar.)  Save the file, cd 
to the parent directory (the directory containing kash3-2008-07-31 as a 
subdirectory), and execute

$ sage -spkg kash3-2008-07-31

This will create a new file kash3-spkg, and then if you

$ sage -k kash3-2008-07-31.spkg

it should install.  Good luck.

-- 
John

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