[sage-devel] Re: computing the number of partitions of an integer
On Tue, 2007-07-31 at 22:16 -0700, Justin C. Walker wrote: [...] Checking partition count computation: On a Core 2 Duo 2.33 Mhz, computing the number of partitions of 10^9: Mathematica 5.2 (PartitionsP[10^9]:95.5115 s Sage 2.7.2.1 (number_of_partitions(10^9): 125.2 s Jon Bober's code (i386: 'jb 10'): 160 s I wonder why our Core 2 Duo timings are so different? All of the executables are i386 binaries (32-bit x86). One oddity: Jon Bober's code produced a value ending in '30457526857797923685688339', while Mathematica and SAGE produced one ending in '30457526831036667979062760', so they differ. Addendum to last email: It looks like the 2.7.2.1 is using the new code by default, so the 'sage' time above should be the time for the newest version of the code, so I'm going to assume that the other timing is for an old version of my code. (I running with algorithm='pari' right now and it is taking a really long time.) While I'm assuming things, I'm also going to assume that you must have mixed up the output values, and thus Mathematica must be producing the wrong answer, in which case its no longer fair to compare running times to Mathematica. (Of course, Mathematica does have the number ending in 339 in the Mathematica book.) Justin -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds --- If it weren't for carbon-14, I wouldn't date at all. --- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
On Jul 31, 2007, at 22:54 , Jonathan Bober wrote: On Tue, 2007-07-31 at 22:16 -0700, Justin C. Walker wrote: On Jul 31, 2007, at 18:36 , William Stein wrote: [snip] On a Core 2 Duo 2.33 Mhz, computing the number of partitions of 10^9: Mathematica 5.2 (PartitionsP[10^9]:95.5115 s Sage 2.7.2.1 (number_of_partitions(10^9): 125.2 s Jon Bober's code (i386: 'jb 10'): 160 s I wonder why our Core 2 Duo timings are so different? That is puzzling. Are you sure that you have the latest version of the code? The source file should have 'Version .3' at the top. Yup. Double-checked the file; and re-ran the test. Essentially the same time. I'll check this tomorrow, along with the Mathematica oddity. You can get the latest version, or at least that latest version minus some memory leak fixes, via hg_sage.pull(), or from http://www.math.lsa.umich.edu/~bober/partitions_c.cc The last version I posted to the list was significantly slower than what I have now (especially since I think I accidently had significant improvements commented out in the last code I posted to the list.) That was the the Jon Bober timing above. I'll try the latest one later. Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Absorption of Federal Funds Men are from Earth. Women are from Earth. Deal with it. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: 3 feature request for multivariate polynomials
Too late, I just did it, since I needed it for something else I'm doing (related to power series over polynomial rings). Martin, please have a look, since you might be able to improve the patch. I spot two things: * The method does not preserve the term ordering (which might be tricky anyhow because of block orderings and such). Wouldn't that be desired? * I think cdef delete is a very confusing choice for a function name, delete is way too reserved to use it like that: remove_from_tuple maybe? Martin PS: Obviously, this function could be faster but lets not optimize for the sake of optimization. If anybody complaints we'll make it faster -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] real eigenvalues ( documentation)
Hi everyone, I have a symmetric square matrix of real numbers, and I wish to compute the (necessarily) real eigenvalues of this matrix. sage: version() 'SAGE Version 2.7.2, Release Date: 2007-07-28' sage: M = random_matrix(RDF, 4, 4) sage: M += M.transpose() Now M is such a matrix. My first instinct was to try 'eigenspaces': sage: M.eigenspaces() Exception (click to the left for traceback): ... NotImplementedError So I then tried using RR instead of RDF, and often I was getting variables in the eigenvalues. The example is no longer symmetric, and I suspect this might be why: sage: M = random_matrix(RR, 4, 4) sage: M.eigenspaces() [ (-0.687210648633541, []), (0.251596873005605, []), (1.00*a2, []) ] Wouldn't it be better to return the complex eigenvalues? When I went back to RDF, I was surprised by the function eigen, which seems to be doing exactly what I want: sage: M = random_matrix(RDF, 4, 4) sage: M += M.transpose() sage: M.eigen() ([2.83698656526, 1.12513535857, -1.92195925813, -0.781971696103], [ -0.6857854813230.676886167426 -0.249484727275 -0.0963367054158] [ 0.171856298084 -0.00520796932156 -0.108449572475 -0.97912051357] [ 0.7046719912190.683316875186 -0.135215217363 0.135026952387] [ 0.0600089260487 -0.273634868922 -0.952739684321 0.117515876478]) However, the output is a little confusing-- I'm guessing either the columns or rows of the matrix are the eigenvectors. So I check the documentation (this is on sagenb.org): sage: M.eigen? Traceback (most recent call last): File stdin, line 1, in module File /home/server2/nb1/sage_notebook/worksheets/rlmill/0/code/ 50.py, line 4, in module print _support_.docstring(M.eigen, globals()) File /usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/ server/support.py, line 142, in docstring s += 'Definition: %s\n'%sageinspect.sage_getdef(obj, obj_name) File /usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/ misc/sageinspect.py, line 267, in sage_getdef spec = sage_getargspec(obj) File /usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/ misc/sageinspect.py, line 252, in sage_getargspec args, varargs, varkw = inspect.getargs(func_obj.func_code) UnboundLocalError: local variable 'func_obj' referenced before assignment I have absolutely no idea what to make of this. -R Miller --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: SAGE-2.7!
Reporting (a little late) a successful build of 2.7 followed by a good upgrade to 2.7.2.1 on Feisty Fawn Core2Duo 1GB. I noticed my last name was misspelled in the credits... It is D. Raymer instead of 'Ramier'. -Dorian On 7/20/07, William Stein [EMAIL PROTECTED] wrote: On 7/20/07, Pablo De Napoli [EMAIL PROTECTED] wrote: Concerning (2) I think that if a gfortran it is already installed in the system, it would be reasonable to use rather than downloading a binary. Issues: (1) If it's gfortran 3.x then it will fail miserably at building certain components of SAGE. (2) The current gfortran.spkg already does attempt to autodetect gfortran and if it is there it doesn't install a binary. It is too restrictive, as once pointed out before. (gfortran is in fact, a standard part of gcc, if gcc from the host system is used for compiling the parts of sage writen in C, why not doing the same with Fortran code? I don't understand this comment. Many many systems have gcc/g++ installed but not gfortran. For example, OS X's Xcode doesn't include any Fortran, and there are at least 3 different competing gfortran binaries for OS X out there. Similarly with Linux, there are various builds of gfortran, and often systems don't have it installed at all (about half my test linux systems). Also, e.g., if you install the standard Fedora Core 7 (32-bit) gfortran it will fail to compile SAGE, whereas the one we package works. There is also another GNU fortran called g95, which competes with gfortran (even though both are GNU projects). For whatever reason, the fortran compiler situation is a total nightmare in comparison to C/C++. I think that in order to increce the aceptance of Sage, it would be important that Sage be included in all Linux distributions, especially it would be nice to have a Debian/Ubuntu package (and a Gentoo ebuild). But in order to make it easier, it would be nice if Sage could be build using the tools already available in the host system. I agree. Please help. Perhaps using the binary for gfortran could be make it optional as a last resource if everything else fails. Determining that everything else fails doesn't make sense, because you basically wouldn't know that happened until it is too late. It's really very difficult to appreciate the problem and difficulty with packaging scipy to build easily on a wide range of platforms if you haven't spent significant time working on it, so I don't have much more to say on this point, except that Josh and I will investigate some other solutions, possibly including switching from gfortran to g95 binaries (since g95 has vastly vastly better support for pre-built binaries that gfortran). -- William --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: 3 feature request for multivariate polynomials
On 8/1/07, Martin Albrecht [EMAIL PROTECTED] wrote: Too late, I just did it, since I needed it for something else I'm doing (related to power series over polynomial rings). Martin, please have a look, since you might be able to improve the patch. I spot two things: * The method does not preserve the term ordering (which might be tricky anyhow because of block orderings and such). Wouldn't that be desired? Yes, but it seemed tricky to implement.It would be desired. * I think cdef delete is a very confusing choice for a function name, delete is way too reserved to use it like that: remove_from_tuple maybe? Sure. PS: Obviously, this function could be faster but lets not optimize for the sake of optimization. If anybody complaints we'll make it faster Agreed. When I did some benchmarks of it, it was already reasonably fast since it uses other things that have been optimized. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
On 8/1/07, Justin C. Walker [EMAIL PROTECTED] wrote: The last version I posted to the list was significantly slower than what I have now (especially since I think I accidently had significant improvements commented out in the last code I posted to the list.) That was the the Jon Bober timing above. I'll try the latest one later. Two comments for this thread: (1) The PARI in SAGE is the latest stable release, which means number_of_partitions(n, algorithm='pari') is *wrong* even on some fairly small values of n. (2) If you do sage: hg_sage.apply('http://sage.math.washington.edu/home/was/sage.hg') you'll get an update to my latest code (not 100% doc tested!) which has the latest version of jon's code, and for which number_of_partitions(n) uses Jon's code by default. William --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
Hi, Regarding the discrepancy in timings between me and Justin Walker using OS X *intel* Mathematica, it turns out I was running Mathematica on my laptop under OS X via Rosetta, so those times should be ignored. The timings I've posted under Linux are all fine. SO, currently SAGE and Mathematica on OSX Intel MacBook Pro 2.33Ghz take almost exactly the same amount of time (95 seconds) to compute p(10^9). On 64-bit Linux Mathematica is still faster than SAGE, so probably there is a 64-bit only precision trick that is relevant... -- William --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
On Tue, 2007-07-31 at 14:24 -0700, Bill Hart wrote: I do highly recommend this quad double library by the way. And they've implemented all manor of transcendental functions too!! The quad- doubles would give you 206 bits, even on your machine. Bill. URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~--- Have you found the quad double library to be faster than mpfr, or just more convenient? I tried using it in the partition counting code, and it actually slowed things down when I used it for all computations between 200 and 64 bits. Alternately, if I just use it between 200 and, say, 180 bits, it gives almost no change in speed. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
Incidentally, I should have mentioned here that I submitted a patch for version .4, and also updated it at http://www.math.lsa.umich.edu/~bober/partitions_c.cc It uses long doubles now when then precision is small enough (and then, later, just doubles like before), and the speedup is significant. On Wed, 2007-08-01 at 12:34 -0700, Justin C. Walker wrote: On Aug 1, 2007, at 12:29 PM, Justin C. Walker wrote: On Jul 31, 2007, at 10:54 PM, Jonathan Bober wrote: On Tue, 2007-07-31 at 22:16 -0700, Justin C. Walker wrote: On Jul 31, 2007, at 18:36 , William Stein wrote: [snip] That is puzzling. Are you sure that you have the latest version of the code? I downloaded the .3 source and ran it on my 2.33 GHz Core 2 Duo. I compiled the program with several -O settings, and ran them with the argument '10': Adding to the background noise: On a 2.33GHz Core 2 Duo (Mac OS X, 10.4.10): Mathematica 6.0: 83s Mathematica 6.0.1: 77s Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Enhancement of the Director's Income Experience is what you get when you don't get what you want. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: computing the number of partitions of an integer
On Aug 1, 2007, at 1:26 PM, Jonathan Bober wrote: On Wed, 2007-08-01 at 12:29 -0700, Justin C. Walker wrote: [snip] Since the time with the self-compiled code is so similar to the time with the sage-compiled code, I would guess that you are linking to the sage mpfr library, which wasn't compiled with -O2 (or at least linking to another version of mpfr that wasn't compiled with optimizations.) Oops. You're right. I forgot about this part of the discussion. I'll get an 'mpfr' library compiled with more optimization. Has anyone looked at the differences between the various optimization choices? On Mac OS X, there is -Ox, for x in {0,1,2,3,s,z}, -O, and -fast. Also, did you double check the answers? If my code is giving the wrong answer on your computer, there could be some processor specific bug somewhere. I'm verifying this now, but I think that my claim (that Mathematica and sage agreed and computed a different value than your code) is a typo. It should have said 'sage', which at the time was using Pari (and according to Stein, was generating incorrect results). Yup: all versions of Mathematica (5.2, 6.0, 6.0.1) agree with you :-} Justin -- Justin C. Walker, Curmudgeon-At-Large Director Institute for the Enhancement of the Director's Income Weaseling out of things is what separates us from the animals. Well, except the weasel. - Homer J Simpson --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: notebook worksheet snapshots
On 8/1/07, Dan Christensen [EMAIL PROTECTED] wrote: The notebook seems to save a snapshot of my worksheet every 3 minutes, even if I'm not using the worksheet. I often leave a few worksheets open for long periods of time, and these files build up and slow down my home directory synchronization. Could the notebook only save a snapshot when the page is changed? Yes, that's a good idea. And maybe the time between snapshots should be increased a bit? It is configurable, but hard to configure since the web-based configuration page *hasn't been written yet*. Nonetheless, you can configure things yourself on the command line as follows: 1. stop the sage server 2. Example of what to do: sage: n = load('sage_notebook/nb.sobj') sage: c = n.conf(); c Configuration: {'number_of_backups': 3, 'save_interval': 30, 'idle_check_interval': 30} sage: c['save_interval'] = 200 sage: n.save() sage: c.defaults() {'cell_input_color': '#000', 'cell_output_color': '#EE', 'doc_pool_size': 128, 'idle_check_interval': 30, 'idle_timeout': 120, 'max_history_length': 250, 'number_of_backups': 3, 'save_interval': 30, 'word_wrap_cols': 72} sage: c Configuration: {'number_of_backups': 3, 'save_interval': 200, 'idle_check_interval': 30} sage: Do old snapshots get deleted automatically? Not implemented yet, but definitely planned. Any suggestions for the default old-delete policy? william --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: notebook worksheet snapshots
Do old snapshots get deleted automatically? Not implemented yet, but definitely planned. Any suggestions for the default old-delete policy? Logarithmic-ish. Keep 1 a minute for 10 minutes, 1 every 10 minutes for 100 minutes... --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---