[sage-support] installing optional R package without Internet connection
Hi folks, I want to install an optional R package from source that I've downloaded from CRAN, say the package /home/mvngu/sna_1.5.tar.gz. Here's my first attempt on Sage 3.2.3: begin-error-message sage: r.install_packages(/home/mvngu/sna_1.5.tar.gz) R version 2.6.1 (2007-11-26) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. options(repos=http://cran.r-project.org/;); install.packages(/home/mvngu/sna_1.5.tar.gz) Warning: unable to access index for repository http://cran.r-project.org/src/contrib Warning message: In install.packages(/home/mvngu/sna_1.5.tar.gz) : package '/home/mvngu/sna_1.5.tar.gz' is not available real0m1.147s user0m0.952s sys 0m0.036s Please restart Sage or restart the R interface (via r.restart()) in order to use '/home/mvngu/sna_1.5.tar.gz'. end-error-message All I understand from the above error message is that I need an Internet connection, especially to http://cran.r-project.org/src/contrib. But the machine I'm using doesn't have Internet connection. OK, no problem. I looked into the Sage R interface file sage-3.2.3/local/lib/python2.5/site-packages/sage/interfaces/r.py and modified the function install_packages() to be as follows: begin-modified-r.py def install_packages(self, package_name): Install an R package into Sage's R installation. EXAMPLES: sage: r.install_package('Hmisc') #optional requires internet [1] 4 5 6 if UNAME == Darwin: warn = ** You are using OS X. Unfortunately, the R optional package system currently doesn't support OS X very well. We are working on this. ** else: warn = None if warn is not None: print warn cmd = options(repos=%s); #install.packages(%s)%(RRepositoryURL, package_name) #os.system(time echo '%s' | R --vanilla%cmd) os.system(/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/bin/R CMD INSTALL /home/mvngu/sna_1.5.tar.gz) print Please restart Sage or restart the R interface (via r.restart()) in order to use '%s'.%package_name if warn is not None: print warn #s = r.eval('install.packages(%s)'%package_name) #print s end-modified-r.py Notice that I uncommented out these lines: install.packages(%s)%(RRepositoryURL, package_name) os.system(time echo '%s' | R --vanilla%cmd) and added the following quick-and-dirty fix: os.system(/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/bin/R CMD INSTALL /home/mvngu/sna_1.5.tar.gz) I exited Sage and issued a re-build of modified Sage library files with $ sage -br main Then I loaded Sage again for another attempt at installing sna_1.5.tar.gz: begin-error-message sage: r.install_packages(abc doesn't matter what name you put here!) * Installing to library '/home/mvngu/usr/bin/sage-3.2.3/local/lib/R//library' WARNING: ignoring environment value of R_HOME * Installing *source* package 'sna' ... ** libs gcc -std=gnu99 -I/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/include -I/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/include -I/home/mvngu/usr/bin/sage-3.2.3/local/inlcude WARNING: ignoring environment value of R_HOME -fpic -I/home/mvngu/usr/bin/sage-3.2.3/local/include -L/home/mvngu/usr/bin/sage-3.2.3/local/lib/ -c components.c -o components.o gcc: WARNING:: No such file or directory gcc: ignoring: No such file or directory gcc: environment: No such file or directory gcc: value: No such file or directory gcc: of: No such file or directory gcc: R_HOME: No such file or directory make: *** [components.o] Error 1 ERROR: compilation failed for package 'sna' ** Removing '/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/library/sna' Please restart Sage or restart the R interface (via r.restart()) in order to use 'abc'. end-error-message The closest problems to mine that I can locate are http://groups.google.com/group/sage-support/browse_thread/thread/2c0ef9eb24e8dd53/2c559b00b3585b18 in sage-devel and this one in sage-support: http://groups.google.com/group/sage-support/browse_thread/thread/881b23030c56f48d/4d28b33aa01bfb63 But they don't seem to have any work around I can use, especially when the tickets #4959 and #1476 they spawned as yet either haven't been resolved or closed as worksforme. Does anyone have a suggestion I can try to install sna_1.5.tar.gz? -- Regards Minh Van Nguyen
[sage-support] Re: does Sage work for finfing Groebner basis for a very large system?
Dear Adela, On Feb 4, 11:46 pm, Adela adisev...@gmail.com wrote: I need to solve a big system of nonlinear equations(it consists of 114 equations, with 61 indeterminates, all of them can be only 0 and 1 and I work modulo 2). I solve it using Groebner bases. So, my problem coms to finding the reduced Groebner base for an ideal generated by 114 polynomials. Can you tell me if Sage can face it, or approximatively how long would take to do that? I'm afraid only of a crush; I can wait long, it's not so important, if in the end I have a result. When computing Gröbner bases, one never knows... In some application, I had to compute a Gröbner basis for a system of about 3 non-homogenous polynomials of degree 3 with 42 variables and with rational coefficients. But Singular (which does the Gröbner basis computation in Sage) only needed a few hours. If you really have the property x^2==x for all your variables then of course it would considerably simplify the computation. So, I encourage you to try it. Best regards 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: does Sage work for finfing Groebner basis for a very large system?
On Feb 5, 10:20 am, Simon King k...@mathematik.uni-jena.de wrote: In some application, I had to compute a Gröbner basis for a system of about 3 non-homogenous polynomials of degree 3 with 42 variables and with rational coefficients. But Singular (which does the Gröbner basis computation in Sage) only needed a few hours. I forgot to add: Of course, there are systems that look much smaller, but for which it is practically impossible to compute a Gröbner basis. So, my positive experience is no guarantee for your case... 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: does Sage work for finfing Groebner basis for a very large system?
On Feb 5, 1:26 am, Simon King k...@mathematik.uni-jena.de wrote: On Feb 5, 10:20 am, Simon King k...@mathematik.uni-jena.de wrote: In some application, I had to compute a Gröbner basis for a system of about 3 non-homogenous polynomials of degree 3 with 42 variables and with rational coefficients. But Singular (which does the Gröbner basis computation in Sage) only needed a few hours. I forgot to add: Of course, there are systems that look much smaller, but for which it is practically impossible to compute a Gröbner basis. So, my positive experience is no guarantee for your case... Well, but given the restrictions it sounds like PolyBoRi ought to be involved in the GB computation, so if any program can compute the GB it would be PolyBoRi IMHO. Given that Michael B. and Alexander D. are around here they might have some input on how to do this in case there are clever tricks. Other people with large machines might also be helpful in running the computation in case the ideal can be made available to some people. Cheers Simon Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: does Sage work for finfing Groebner basis for a very large system?
On Thursday 05 February 2009, Adela wrote: Thanks to everyone for your support! I already tried to do the big computation leaving the computer all night long to work but I still don't know if it finished.. I still don't understand Sage very well because I don't see any feedback from it.. I fed him the ideal, I pushed evaluate button and it seems to have been working all night long and never ending. In this estate, in the morning I tried to compute the Groebner base but I obtained the following error: Traceback (most recent call last): File stdin, line 1, in module File /home/sage/sagenb/sage_notebook/worksheets/MyUser/12/code/ 1.py, line 6, in module G=I.groebner_basis() File /home/sage/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/, line 1, in module AttributeError: 'I_class' object has no attribute 'groebner_basis' That means I is not defined (i.e. you didn't run I = B.ideal(...)). I is a variable that is predefined by Sage which doesn't know anything about Gröbner bases of course. You should learn about Python, e.g. here: http://diveintopython.org/ to learn what an AttributeError is. As you said, the computations should not take so long because I work in the ring Z / 2 so I have as solutions only 1 and 0 (they represent bits). Well since you have 61 variables not so long means O(2^61) in the worst case. You can't really know a priori. Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www: http://www.informatik.uni-bremen.de/~malb _jab: martinralbre...@jabber.ccc.de --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Which Version of Sage to Use?
Here is the end of the output that make produced: periods.cc: In constructor `periods_via_lfchi::periods_via_lfchi(const level*, const newform*)': periods.cc:382: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc:383: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc: In member function `virtual void periods_direct::compute ()': periods.cc:459: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc:460: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc: In member function `virtual void part_period::compute()': periods.cc:554: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc: In member function `void ldash1::init(const level*, const std::vectorlong int, std::allocatorlong int , long int, const rational)': periods.cc:593: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc: In constructor `lfchi::lfchi(const level*, const newform*)': periods.cc:635: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) periods.cc: In function `NTL::RR G(int, NTL::RR)': periods.cc:975: error: call of overloaded `log(int)' is ambiguous /usr/include/bits/mathcalls.h:110: error: candidates are: double log (double) /usr/include/g++/cmath:419: error: long double std::log (long double) /usr/include/g++/cmath:411: error: float std::log (float) make[3]: *** [periods_n.o] Error 1 make[3]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src/g0n' make[2]: *** [all] Error 2 make[2]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src' Error building cremona real6m2.424s user5m43.250s sys 0m18.600s sage: An error occurred while installing eclib-20080310.p7 Please email sage-devel http://groups.google.com/group/sage-devel explaining the problem and send the relevant part of of /usr/local/sage-3.2.3/install.log. Describe your computer, operating system, etc. If you want to try to fix the problem, yourself *don't* just cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 and type 'make'. Instead type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 (When you are done debugging, you can type exit to leave the subshell.) make[1]: *** [installed/eclib-20080310.p7] Error 1 make[1]: Leaving directory `/usr/local/sage-3.2.3/spkg' real18m53.767s user16m59.400s sys 1m43.340s I see now the instructions at the end that tell me to type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 Will /usr/local/sage-3.2.3/sage -sh auto fix everything? thanks again. On Feb 4, 11:31 pm, mabshoff michael.absh...@mathematik.uni- dortmund.de wrote: On Feb 4, 7:26 pm, mrotsliah mrotsl...@gmail.com wrote: ok, I found the source code, I used tar to open it, and I used make. It ran its course and finished. Sage starts to run, but then it outputs the following and then quits: -- | Sage Version 3.2.3, Release Date: 2009-01-05 | | Type notebook() for the GUI, and license() for information. |
[sage-support] constructing polynomials via coefficient vectors?
Hi, is there a way to construct a polynomial using a coefficient vector? If I construct a polynomial ring ( R = BooleanPolynomialRing(5,'x') ), I want to be able to construct, for example, a polynomial x0 +x0*x1 by using the coefficients vector [0,1,0,0,0,0,1,0,0,0,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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: constructing polynomials via coefficient vectors?
You can use dictionaries, like this: sage: R.x,y = PolynomialRing(GF(2),2,'xy') sage: coeffs = {(1, 0): 1, (1, 1): 1} sage: R(coeffs) x*y + x On Thu, Feb 5, 2009 at 12:31 PM, Christophe Oosterlynck tif...@gmail.com wrote: Hi, is there a way to construct a polynomial using a coefficient vector? If I construct a polynomial ring ( R = BooleanPolynomialRing(5,'x') ), I want to be able to construct, for example, a polynomial x0 +x0*x1 by using the coefficients vector [0,1,0,0,0,0,1,0,0,0,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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Which Version of Sage to Use?
On Feb 5, 8:30 am, mrotsliah mrotsl...@gmail.com wrote: Here is the end of the output that make produced: SNIP make[3]: *** [periods_n.o] Error 1 make[3]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src/g0n' make[2]: *** [all] Error 2 make[2]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src' Error building cremona real 6m2.424s user 5m43.250s sys 0m18.600s sage: An error occurred while installing eclib-20080310.p7 See, Sage did not finish building, even by a long shot. Please email sage-develhttp://groups.google.com/group/sage-devel explaining the problem and send the relevant part of of /usr/local/sage-3.2.3/install.log. Describe your computer, operating system, etc. If you want to try to fix the problem, yourself *don't* just cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 and type 'make'. Instead type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 (When you are done debugging, you can type exit to leave the subshell.) make[1]: *** [installed/eclib-20080310.p7] Error 1 make[1]: Leaving directory `/usr/local/sage-3.2.3/spkg' real 18m53.767s user 16m59.400s sys 1m43.340s I see now the instructions at the end that tell me to type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 Will /usr/local/sage-3.2.3/sage -sh auto fix everything? Nope, your compiler is too old, i.e. pre gcc 3.4. We need at least gcc 3.4 since building Sage requires C99 support. There is a ticket in trac that would error out right at the start of the build, but no one has implemented that yet. Sorry, you cannot build Sage on that system without at least having a gcc 3.4 or higher and that is not especially hard if you have build gcc before, but usually a lot more work than the average Linux user does these days. Is there any reason you are sticking with that old SuSE 9.0 release? thanks again. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] How can you read a .txt/csv file in Sage?
My .txt/csv -file looks like in Vim: 1,4 2,5 3,6 I can have both filetypes. I am not sure, which one Sage supports. Open two columns in Sage: - I know that the file needs be at Sageroot. My Sage is installed at ~/ apps/Sage in Mac. Where in ~/apps/Sage do I need to put the file? This question is based on the following discussions: 1. http://groups.google.com/group/sage-support/browse_thread/thread/4600e491955f4960 2. http://stackoverflow.com/questions/494116/how-can-you-move-a-list-from-excel-to-sage/514835#514835 --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can you read a .txt/csv file in Sage?
Possibly I'm not understanding your English. Python can read in any text file, for example csv. So, the answer to your question seems to be in the thread you cited. Also, if you want to know which directory Sageroot is, type SAGE_ROOT. For example: sage: SAGE_ROOT '/home/wdj/sagefiles/sage-3.3.alpha1' Hope this helps. On Thu, Feb 5, 2009 at 2:11 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: My .txt/csv -file looks like in Vim: 1,4 2,5 3,6 I can have both filetypes. I am not sure, which one Sage supports. Open two columns in Sage: - I know that the file needs be at Sageroot. My Sage is installed at ~/ apps/Sage in Mac. Where in ~/apps/Sage do I need to put the file? This question is based on the following discussions: 1. http://groups.google.com/group/sage-support/browse_thread/thread/4600e491955f4960 2. http://stackoverflow.com/questions/494116/how-can-you-move-a-list-from-excel-to-sage/514835#514835 --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can you read a .txt/csv file in Sage?
Thank you for your response! The problem is now in the following codes: 1. f = open(list2.txt) l1 = f.readline() ls1 = l1.split( ) l1 gives: Traceback (click to the left for traceback) ... IOError: [Errno 2] No such file or directory: 'list2.txt' Similarly, the eval function, eval(ls1), in (1) and the following code (2) causes the previous error. 2. f = open('list2.txt') varList = [x.split(' // ') for x in f.readlines()] I have the file list2.txt at SageRoot. On Feb 5, 9:28 pm, David Joyner wdjoy...@gmail.com wrote: Possibly I'm not understanding your English. Python can read in any text file, for example csv. So, the answer to your question seems to be in the thread you cited. Also, if you want to know which directory Sageroot is, type SAGE_ROOT. For example: sage: SAGE_ROOT '/home/wdj/sagefiles/sage-3.3.alpha1' Hope this helps. On Thu, Feb 5, 2009 at 2:11 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: My .txt/csv -file looks like in Vim: 1,4 2,5 3,6 I can have both filetypes. I am not sure, which one Sage supports. Open two columns in Sage: - I know that the file needs be at Sageroot. My Sage is installed at ~/ apps/Sage in Mac. Where in ~/apps/Sage do I need to put the file? This question is based on the following discussions: 1.http://groups.google.com/group/sage-support/browse_thread/thread/4600... 2.http://stackoverflow.com/questions/494116/how-can-you-move-a-list-fro... --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can you read a .txt/csv file in Sage?
On Thu, Feb 5, 2009 at 2:48 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: Thank you for your response! The problem is now in the following codes: 1. f = open(list2.txt) l1 = f.readline() ls1 = l1.split( ) l1 gives: Traceback (click to the left for traceback) ... IOError: [Errno 2] No such file or directory: 'list2.txt' Similarly, the eval function, eval(ls1), in (1) and the following code (2) causes the previous error. 2. f = open('list2.txt') varList = [x.split(' // ') for x in f.readlines()] I have the file list2.txt at SageRoot. Does it help to give it the abs path? f = open(/full/path/to/list2.txt) On Feb 5, 9:28 pm, David Joyner wdjoy...@gmail.com wrote: Possibly I'm not understanding your English. Python can read in any text file, for example csv. So, the answer to your question seems to be in the thread you cited. Also, if you want to know which directory Sageroot is, type SAGE_ROOT. For example: sage: SAGE_ROOT '/home/wdj/sagefiles/sage-3.3.alpha1' Hope this helps. On Thu, Feb 5, 2009 at 2:11 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: My .txt/csv -file looks like in Vim: 1,4 2,5 3,6 I can have both filetypes. I am not sure, which one Sage supports. Open two columns in Sage: - I know that the file needs be at Sageroot. My Sage is installed at ~/ apps/Sage in Mac. Where in ~/apps/Sage do I need to put the file? This question is based on the following discussions: 1.http://groups.google.com/group/sage-support/browse_thread/thread/4600... 2.http://stackoverflow.com/questions/494116/how-can-you-move-a-list-fro... --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can you read a .txt/csv file in Sage?
Thank you! It works now :) On Feb 5, 9:54 pm, David Joyner wdjoy...@gmail.com wrote: On Thu, Feb 5, 2009 at 2:48 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: Thank you for your response! The problem is now in the following codes: 1. f = open(list2.txt) l1 = f.readline() ls1 = l1.split( ) l1 gives: Traceback (click to the left for traceback) ... IOError: [Errno 2] No such file or directory: 'list2.txt' Similarly, the eval function, eval(ls1), in (1) and the following code (2) causes the previous error. 2. f = open('list2.txt') varList = [x.split(' // ') for x in f.readlines()] I have the file list2.txt at SageRoot. Does it help to give it the abs path? f = open(/full/path/to/list2.txt) On Feb 5, 9:28 pm, David Joyner wdjoy...@gmail.com wrote: Possibly I'm not understanding your English. Python can read in any text file, for example csv. So, the answer to your question seems to be in the thread you cited. Also, if you want to know which directory Sageroot is, type SAGE_ROOT. For example: sage: SAGE_ROOT '/home/wdj/sagefiles/sage-3.3.alpha1' Hope this helps. On Thu, Feb 5, 2009 at 2:11 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: My .txt/csv -file looks like in Vim: 1,4 2,5 3,6 I can have both filetypes. I am not sure, which one Sage supports. Open two columns in Sage: - I know that the file needs be at Sageroot. My Sage is installed at ~/ apps/Sage in Mac. Where in ~/apps/Sage do I need to put the file? This question is based on the following discussions: 1.http://groups.google.com/group/sage-support/browse_thread/thread/4600... 2.http://stackoverflow.com/questions/494116/how-can-you-move-a-list-fro... --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Which Version of Sage to Use?
The machine is a server, and I am now the one that takes care of it. I kind of just got handed the job. A few users wanted an updated version of Sage for research purposes. I can look into updating gcc. So, if I update gcc, do you think there will be other problems? Thanks On Feb 5, 1:43 pm, mabshoff michael.absh...@mathematik.uni- dortmund.de wrote: On Feb 5, 8:30 am, mrotsliah mrotsl...@gmail.com wrote: Here is the end of the output that make produced: SNIP make[3]: *** [periods_n.o] Error 1 make[3]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src/g0n' make[2]: *** [all] Error 2 make[2]: Leaving directory `/usr/local/sage-3.2.3/spkg/build/ eclib-20080310.p7/src' Error building cremona real 6m2.424s user 5m43.250s sys 0m18.600s sage: An error occurred while installing eclib-20080310.p7 See, Sage did not finish building, even by a long shot. Please email sage-develhttp://groups.google.com/group/sage-devel explaining the problem and send the relevant part of of /usr/local/sage-3.2.3/install.log. Describe your computer, operating system, etc. If you want to try to fix the problem, yourself *don't* just cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 and type 'make'. Instead type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 (When you are done debugging, you can type exit to leave the subshell.) make[1]: *** [installed/eclib-20080310.p7] Error 1 make[1]: Leaving directory `/usr/local/sage-3.2.3/spkg' real 18m53.767s user 16m59.400s sys 1m43.340s I see now the instructions at the end that tell me to type /usr/local/sage-3.2.3/sage -sh in order to set all environment variables correctly, then cd to /usr/local/sage-3.2.3/spkg/build/eclib-20080310.p7 Will /usr/local/sage-3.2.3/sage -sh auto fix everything? Nope, your compiler is too old, i.e. pre gcc 3.4. We need at least gcc 3.4 since building Sage requires C99 support. There is a ticket in trac that would error out right at the start of the build, but no one has implemented that yet. Sorry, you cannot build Sage on that system without at least having a gcc 3.4 or higher and that is not especially hard if you have build gcc before, but usually a lot more work than the average Linux user does these days. Is there any reason you are sticking with that old SuSE 9.0 release? thanks again. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Which Version of Sage to Use?
On Feb 5, 12:26 pm, mrotsliah mrotsl...@gmail.com wrote: Hi, The machine is a server, and I am now the one that takes care of it. I kind of just got handed the job. Ok, I used to maintain some HPUX 10 systems and it was a scary experience to touch anything since it just broke existing stuff, so I can see a case of keeping an old system running, i.e. if it ain't broken don't fix it to never change a running system. :) A few users wanted an updated version of Sage for research purposes. I can look into updating gcc. So, if I update gcc, do you think there will be other problems? Nope. I would suggest to pick either gcc 3.4.6 or gcc 4.2.3 or higher. Install with some prefix, i.e. --prefix=/usr/local/gcc-3.4.6. Given the age of the distro you are using I would go with gcc 3.4.6 since the newer gcc 4.2.x and higher might require a more current glibc than you have. You need at least C and C++ support. Then before building Sage set PATH and LD_LIBRARY_PATH to pick up the gcc in $PREFIX, i.e. do not set CC and CXX to point to absolute paths of gcc and g++. Then building Sage will work with high probability, i.e. I have done the above on at least a dozen different boxen that had crappy gcc releases. You need to change the sage script then to set PATH and LD_LIBRARY_PATH so that if a user starts sage it automatically picks the right gcc and libstdc++.so runtime. Not doing that will make sage fail to start or in some cases might introduce subtle crashes. And from experience not having to user to remember to source some env makes it much easier on you when you have to debug mysterious Sage segfaulted calls for help. :) And advanced scenario is to install gcc into $SAGE_ROOT/local before building Sage and building gcc with C, C++ and gfortran support. Then you need to set SAGE_FORTRAN so that you don't use the binary g95. That way you don't need to set PATH or LD_LIBRARY_PATH. There is also a toolchain.sh option, but that is pretty much undocumented and hence I would not recommend to use it yet. Let us know if you run into any trouble or have more questions. Thanks Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: does Sage work for finfing Groebner basis for a very large system?
On Feb 5, 6:07 am, Martin Albrecht m...@informatik.uni-bremen.de wrote: On Thursday 05 February 2009, Adela wrote: SNIP As you said, the computations should not take so long because I work in the ring Z / 2 so I have as solutions only 1 and 0 (they represent bits). Well since you have 61 variables not so long means O(2^61) in the worst case. You can't really know a priori. It would also be interesting to know how much RAM your system has and if the computation you run over night ever hit swap since it is basically game over once you hit swap in a GB computation :) I don't know if PolyBoRi has some kind of verbosity option that tells you what is going on so that you can at least have an idea if the computation has a chance to finish. Martin As others have pointed out above GBasis computation is pretty difficult and a dark art, i.e. with some systems you can run the computation, inspect the elements of the Gbasis that were already found and add good ones back into the ideal and restart the computation from scratch. I am not aware how you can do that with either Singular or PolyBoRi, but I did such computations back in 2007 with a customized version of CoCoALib. Cheers, Michael -- name: Martin Albrecht _pgp:http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www:http://www.informatik.uni-bremen.de/~malb _jab: martinralbre...@jabber.ccc.de --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Error inserting new cell
Problem inserting new input cell after current input cell. undefined I discovered this bug on sagenb.org which is running Sage 3.3.alpha3 To reproduce this error do: 1. Create new worksheet 2. Create text cell and save 3. Delete computation cell 4. Click on the blue under the text cell --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
On Thu, Feb 5, 2009 at 1:44 PM, Timothy Clemans timothy.clem...@gmail.com wrote: Problem inserting new input cell after current input cell. undefined I discovered this bug on sagenb.org which is running Sage 3.3.alpha3 To reproduce this error do: 1. Create new worksheet 2. Create text cell and save 3. Delete computation cell 4. Click on the blue under the text cell I can confirm this bug. Timothy, you should open a ticket... I think the bug is that it is even *possible* to delete that computation cell in step 3 above. It should never be possible to delete _all_ computation cells.The code for checking whether one is allowed to delete a cell (wherever that is), currently I guess checks that the number of cells is = 2. I guess it should instead check that the number of computation cells is = 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
On Feb 5, 1:50 pm, William Stein wst...@gmail.com wrote: Hi, On Thu, Feb 5, 2009 at 1:44 PM, Timothy Clemans timothy.clem...@gmail.com wrote: Problem inserting new input cell after current input cell. undefined I discovered this bug on sagenb.org which is running Sage 3.3.alpha3 I am more than a little surprised that sagenb.org is running 3.3.a3, but I guess TinyMCE is too much motivation to not run 3.2.3 :) To reproduce this error do: 1. Create new worksheet 2. Create text cell and save 3. Delete computation cell 4. Click on the blue under the text cell I can confirm this bug. Timothy, you should open a ticket... I think the bug is that it is even *possible* to delete that computation cell in step 3 above. It should never be possible to delete _all_ computation cells. The code for checking whether one is allowed to delete a cell (wherever that is), currently I guess checks that the number of cells is = 2. I guess it should instead check that the number of computation cells is = 2. Sounds like a the fix for me. William Note that there is also a problem with deleting empty TinyMCE cells. They disappear if one saves and reloads the worksheet, but that isn't the most elegant solution. I don't think Jason opened a ticket for that issue yet, but I have been distracted by other bugs. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
On Thu, Feb 5, 2009 at 1:59 PM, mabshoff michael.absh...@mathematik.uni-dortmund.de wrote: On Feb 5, 1:50 pm, William Stein wst...@gmail.com wrote: Hi, On Thu, Feb 5, 2009 at 1:44 PM, Timothy Clemans timothy.clem...@gmail.com wrote: Problem inserting new input cell after current input cell. undefined I discovered this bug on sagenb.org which is running Sage 3.3.alpha3 I am more than a little surprised that sagenb.org is running 3.3.a3, but I guess TinyMCE is too much motivation to not run 3.2.3 :) After using the sage notebook for a few days with TinyMCE I got the impression that the Sage notebook is almost pointless without it :-). Anyway, I know that sage-3.3.alpha3 is pretty solid on 64-bit Xeon ubuntu, which is what sagenb.org is, so I upgraded. I figured we could use the free testing, and it's paid off as you can see. To reproduce this error do: 1. Create new worksheet 2. Create text cell and save 3. Delete computation cell 4. Click on the blue under the text cell I can confirm this bug. Timothy, you should open a ticket... I think the bug is that it is even *possible* to delete that computation cell in step 3 above. It should never be possible to delete _all_ computation cells.The code for checking whether one is allowed to delete a cell (wherever that is), currently I guess checks that the number of cells is = 2. I guess it should instead check that the number of computation cells is = 2. Sounds like a the fix for me. William Note that there is also a problem with deleting empty TinyMCE cells. They disappear if one saves and reloads the worksheet, but that isn't the most elegant solution. I don't think Jason opened a ticket for that issue yet, but I have been distracted by other bugs. Cheers, Michael -- William Stein Associate 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] How can I import a .py -file to Sage?
I tried the code unsuccessfully: a = open([x.replace(',',' ').split() for x in open('/Applications/ sage/test.py').readlines()] a Similarly, the next code too: a = open(for x in open('/Applications/sage/test.py').readlines() a --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can I import a .py -file to Sage?
Hello, On Thu, Feb 5, 2009 at 2:45 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: I tried the code unsuccessfully: a = open([x.replace(',',' ').split() for x in open('/Applications/ sage/test.py').readlines()] a You can do the following to load a .py file into a Sage session: sage: load /Applications/sage/test.py If you want to have the file automatically reloaded when you make changes to it, you can do: sage: attach /Applications/sage/test.py --Mike --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can I import a .py -file to Sage?
Hi, On Fri, Feb 6, 2009 at 9:45 AM, Fall In Love with Sage cs.losi...@gmail.com wrote: I tried the code unsuccessfully: a = open([x.replace(',',' ').split() for x in open('/Applications/ sage/test.py').readlines()] a Similarly, the next code too: a = open(for x in open('/Applications/sage/test.py').readlines() a In addition to Mike's suggestions, you might also want to read the tutorial at http://www.sagemath.org/doc/tut/node52.html -- Regards Minh Van Nguyen --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
On Feb 5, 2:03 pm, William Stein wst...@gmail.com wrote: SNIP I discovered this bug on sagenb.org which is running Sage 3.3.alpha3 I am more than a little surprised that sagenb.org is running 3.3.a3, but I guess TinyMCE is too much motivation to not run 3.2.3 :) After using the sage notebook for a few days with TinyMCE I got the impression that the Sage notebook is almost pointless without it :-). Yeah, it is one of those features where once you have it you cannot understand why we ever though we didn't need it, so a big giant thanks to Jason for making this happen. In the process of the TinyMCE merge he also ended up cleaning up a lot of the other Java code and did resolve some long standing tickets to make the ext code repo much close to disappearing. I am sure he felt the complaints and the review process would never end, but he made it :) After my initial reaction to Sage 1.3 or so (Why would anyone be stupid enough to write a CAS in *Python*?), the notebook (Meh, but a command line interface is so much better), interact (Why should I care about that?) and finally TinyMCE (big whoop) I am glad that good ideas I would have not even considered worthy a second look make it from ideas to actual implementation quickly and without the need to fight political battles. Anyway, I know that sage-3.3.alpha3 is pretty solid on 64-bit Xeon ubuntu, which is what sagenb.org is, so I upgraded. I figured we could use the free testing, and it's paid off as you can see. Yep, eating your own dogfood is the way to go. And I think that 3.3.a6 ought to pass with barely a failing doctest on SkyNet and boxen's VMWare machines, so we will be done with 3.3 soon. The only big issue is the FC crashes. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Which Version of Sage to Use?
On Feb 5, 12:26 pm, mrotsliah mrotsl...@gmail.com wrote: The machine is a server, and I am now the one that takes care of it. I kind of just got handed the job. A few users wanted an updated version of Sage for research purposes. Out of curiosity a followup: Which Sage release are you running since Sage has not been buildable with gccs prior to gcc 3.4 since FLINT was merged. This curiosity is mostly rooted in the fact that we are seeing more and more people who tend not to be active on the mailing list or via other communication channels run quite old Sage releases and given the current development pace I would not want to run anything pre Sage 3.2 in production since numerous issues have been fixed and even more numerous improvements have since been merged. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How can I import a .py -file to Sage?
Thank you both! On Feb 6, 12:55 am, Minh Nguyen nguyenmi...@gmail.com wrote: Hi, On Fri, Feb 6, 2009 at 9:45 AM, Fall In Love with Sage cs.losi...@gmail.com wrote: I tried the code unsuccessfully: a = open([x.replace(',',' ').split() for x in open('/Applications/ sage/test.py').readlines()] a Similarly, the next code too: a = open(for x in open('/Applications/sage/test.py').readlines() a In addition to Mike's suggestions, you might also want to read the tutorial at http://www.sagemath.org/doc/tut/node52.html -- Regards Minh Van Nguyen --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
After using the sage notebook for a few days with TinyMCE I got the impression that the Sage notebook is almost pointless without it :-). Yes. Yeah, it is one of those features where once you have it you cannot understand why we ever though we didn't need it, so a big giant thanks to Jason for making this happen. Yes! I am glad that good ideas I would have not even considered worthy a second look make it from ideas to actual implementation quickly and without the need to fight political battles. Yes. And what better way to celebrate that than with a call to sage-support with two new reproducible bugs! 1. Backspacing when there is one character left in the TinyMCE cell gets you out of it completely, and you have to click back in the cell. Tabbing doesn't help. Backspacing twice apparently acts like backwards browser navigation, at least in Safari. (Perhaps a side effect of Shift-Enter closing cell?) This didn't happen on sagenb.org, which is 3.3.alpha3. 2. Open a TinyMCE cell. Try any math expression ending in b$ - for instance, $ab$, a common one. Put some text afterwards, and format it bold. E.g., I like the inequality $ab$ because it's easy and then make 'because' bold. Save this, and click the Edit button. Save. Note that b$ has disappeared, becoming some variant on the old- school b tag. This persists throughout the whole page until there is a sign, and if you do enough things like this TinyMCE and/or the browser gets confused and replaces everything with the em tag. (This ate a significant chunk of my lecture notes on Friday ten minutes before class.) I think it might also happen with x$ for other symbols x, but this is the only one I could easily reproduce. This *does* occur on sagenb.org. Not-yet-reproducible are the mysterious extra cells and various extra p/p blocks I can't account for... Hope this helps make it even more robust. See if you can do them too; if so, I'll log some tickets. I have done them on OSX.4 PPC Safari 3 running 3.3.alpha5. - 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
On Feb 5, 5:37 pm, kcrisman kcris...@gmail.com wrote: [snip] 2. Open a TinyMCE cell. Try any math expression ending in b$ - for instance, $ab$, a common one. Put some text afterwards, and format it bold. E.g., I like the inequality $ab$ because it's easy and then make 'because' bold. Save this, and click the Edit button. Save. Note that b$ has disappeared, becoming some variant on the old- school b tag. This persists throughout the whole page until there is a sign, and if you do enough things like this TinyMCE and/or the browser gets confused and replaces everything with the em tag. (This ate a significant chunk of my lecture notes on Friday ten minutes before class.) I think it might also happen with x$ for other symbols x, but this is the only one I could easily reproduce. This *does* occur on sagenb.org. I wonder if this is at all related to http://trac.sagemath.org/ sage_trac/ticket/4245. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Error inserting new cell
John H Palmieri wrote: On Feb 5, 5:37 pm, kcrisman kcris...@gmail.com wrote: [snip] 2. Open a TinyMCE cell. Try any math expression ending in b$ - for instance, $ab$, a common one. Put some text afterwards, and format it bold. E.g., I like the inequality $ab$ because it's easy and then make 'because' bold. Save this, and click the Edit button. Save. Note that b$ has disappeared, becoming some variant on the old- school b tag. This persists throughout the whole page until there is a sign, and if you do enough things like this TinyMCE and/or the browser gets confused and replaces everything with the em tag. (This ate a significant chunk of my lecture notes on Friday ten minutes before class.) I think it might also happen with x$ for other symbols x, but this is the only one I could easily reproduce. This *does* occur on sagenb.org. I wonder if this is at all related to http://trac.sagemath.org/ sage_trac/ticket/4245. Apparently mhansen put a patch up on #4245. kcrisman, can you apply that patch and see if things are better? Thanks, 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---