[sage-devel] Re: computing the number of partitions of an integer
Attached is a somewhat improved version. (I don't want to flood the mailing list with attachments, so I won't send this file as an attachment to the list again after this.) The main improvement is that the code is better commented and more readable now. The secondary improvement is an increase in speed - I think it's about 15% faster, or something like that, at computing p(10^9) than the previous code. (Although I'm not exactly sure what the phrase 15% faster means, and I was having some weird issues with my laptop when I timed the old code, so I'm not sure exactly how fast it ran.) There are no improvements in automated testing, so I'm no more confident of this correctness of this code than I was of the old code, but it certainly seems to work. I'm confident that this can be sped up more, but I'm not sure that we can reach as low as 10 seconds to compute p(10^9). It certainly might be possible, though. --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~--- /* Author: Jonathan Bober * Version:.2 * * This program computes p(n), the number of integer partitions of n, using Rademacher's * formula. (See Hans Rademacher, On the Partition Function p(n), * Proceedings of the London Mathematical Society 1938 s2-43(4):241-254; doi:10.1112/plms/s2-43.4.241, * currently at * * http://plms.oxfordjournals.org/cgi/content/citation/s2-43/4/241 * * if you have access.) * * We use the following notation: * * p(n) = lim_{n -- oo} t(n,N) * * where * * t(n,N) = sum_{k=1}^N a(n,k) f_n(k), * * where * * a(n,k) = sum_{h=1, (h,k) = 1}^k exp(\pi i s(h,k) - 2 \pi i h n / k) * * and * * f_n(k) = \pi sqrt{2} cosh(A_n/(sqrt{3}*k))/(B_n*k) - sinh(C_n/k)/D_n; * * where * * s(h,k) = \sum_{j=1}^{k-1}(j/k)((hj/k)) * * A_n = sqrt{2} \pi * sqrt{n - 1/24} * B_n = 2 * sqrt{3} * (n - 1/24) * C_n = sqrt{2} * \pi * sqrt{n - 1.0/24.0} / sqrt{3} * D_n = 2 * (n - 1/24) * sqrt{n - 1.0/24.0} * * and, finally, where ((x)) is the sawtooth function {x} - 1/2 * * Some clever tricks are used in the computation of s(h,k), and perhaps at least * some of these are due to Apostol. (I don't know a reference for this.) * * TODO: fix memory leaks * -- All mpfr_t, mpq_t, and mpz_t variables should be cleared before the function * mp_t(n) returns, but currently this is not done. This doesn't really matter * when this is a standalone program, but will matter if this is called as * a library function from another program. * * -- Search source code for other TODO comments. * * OTHER CREDITS: * * I looked source code written by Ralf Stephan, currently available at * * http://www.ark.in-berlin.de/part.c * * while writing this code, but didn't really make use of it. More useful * were notes currently available at * * http://www.ark.in-berlin.de/part.pdf * * and others at * * http://www.math.uwaterloo.ca/~dmjackso/CO630/ptnform1.pdf * * Also, it is worth noting that the code for GCD(), while trivial, * was directly copied from the NTL source code. * * Also, Bill Hart made some comments about ways to speed up this computation on the SAGE * mailing list. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ #include stdio.h #include cmath #include iostream #include iomanip #include limits #include mpfr.h #include gmp.h const bool debug = false; //const bool debug = true; const bool debugs = false; //const bool debugf = true; const bool debugf = false; //const bool debuga = true; const bool debuga = false; //const bool debugt = true; const bool debugt = false; using std::cout; using std::endl; const unsigned int min_prec = 53; const unsigned int min_precision = 53; // The following function can be useful for debugging in come
[sage-devel] Re: computing the number of partitions of an integer
great work, Jonathan! I've tested, and I've found the following problems: 1) part 1 hangs 2) compiling with -Wall gives this warning part.cc:865: warning: unused variable 'temp2' 3) part without arguments returns 42 Pablo On 7/29/07, Jonathan Bober [EMAIL PROTECTED] wrote: Attached is a somewhat improved version. (I don't want to flood the mailing list with attachments, so I won't send this file as an attachment to the list again after this.) The main improvement is that the code is better commented and more readable now. The secondary improvement is an increase in speed - I think it's about 15% faster, or something like that, at computing p(10^9) than the previous code. (Although I'm not exactly sure what the phrase 15% faster means, and I was having some weird issues with my laptop when I timed the old code, so I'm not sure exactly how fast it ran.) There are no improvements in automated testing, so I'm no more confident of this correctness of this code than I was of the old code, but it certainly seems to work. I'm confident that this can be sped up more, but I'm not sure that we can reach as low as 10 seconds to compute p(10^9). It certainly might be possible, though. --~--~-~--~~~---~--~~ 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] posible licence issue raised by GPL-v3
William (and others): There is a licence issue about Sage raised by GPL-v3, that may be you need to consider (I'm not a lawyer so that what I'm saying could be wrong). Currently according to the COPYING file, Sage is released under GPL version 2. The problem is that some packages included in Sage will be soon relicence under GPL-version 3, for example GNU GSL version 1.10 will certainly released under GPL-version 3 (and so will be most FSF stuff). If I understand things well, you cannot link such a library to a GPL-v2 project, without releasing the whole project under GPL-v3, am I right? If this is true, then it might be necesary to consider relicensing Sage under GPL-v3. But this would mean to get explicit permision from all Sage contributors (Since Sage is not released under GPL-v2 and any later version... but explicitey under GPL-v2) A good side efect of relicensing Sage under GPL-v3 would be that this licencs has better compatibility with other free software licences.(so that more free software packages could be eventually incorporated into Sage, but I could not think of an specific example right now. Pablo --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On 7/29/07, Pablo De Napoli [EMAIL PROTECTED] wrote: William (and others): There is a licence issue about Sage raised by GPL-v3, that may be you need to consider (I'm not a lawyer so that what I'm saying could be wrong). As far as I can tell, what you are saying is consistent with http://www.gnu.org/licenses/gpl-faq.html#TOCv2v3Compatibility Currently according to the COPYING file, Sage is released under GPL version 2. The problem is that some packages included in Sage will be soon relicence under GPL-version 3, for example GNU GSL version 1.10 will certainly released under GPL-version 3 (and so will be most FSF stuff). If I understand things well, you cannot link such a library to a GPL-v2 project, without releasing the whole project under GPL-v3, am I right? If this is true, then it might be necesary to consider relicensing Sage under GPL-v3. But this would mean to get explicit permision from all Sage contributors (Since Sage is not released under GPL-v2 and any later version... but explicitey under GPL-v2) A good side efect of relicensing Sage under GPL-v3 would be that this licencs has better compatibility with other free software licences.(so that more free software packages could be eventually incorporated into Sage, but I could not think of an specific example right now. Pablo --~--~-~--~~~---~--~~ 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: Problem building linbox on Gentoo Linux (gcc 4.2.0)
On Jul 28, 10:16 pm, William Stein [EMAIL PROTECTED] wrote: Unfortunately linbox won't build yet with GCC = 4.2.0. The linbox developers are painfully aware of this, and it's evidently a nontrivial problem for them to fix. SAGE-2.7.2 (which I just uploaded moments ago) will build fine on Gentoo with GCC 4.1.x: http://sagemath.org/dist/src/ (There is an issue with building clisp with sage-2.7.1, which is fixed in 2.7.2.) Technically speaking, all of my systems run testing level Gentoo, so this sort of thing is to be expected. I can easily drop back to a stable GCC any time I want to, or for that matter, just force a 4.1.2 compile for linbox and leave everything else at 4.2. Another option for you would be to just use a pre-built binary like one here (the Debian one would almost surely work on gentoo): http://sagemath.org/SAGEbin/linux/32bit/ Probably, although the system I want to run Sage on is a 64-bit dual- core with 4 GB of RAM. :) Of course, being a Gentoo user, I'm sure you want to build from source :-). And of course, making it easy for anybody to build SAGE from source is one of the main points of SAGE. On a related note, just about everything Sage uses is already in Gentoo -- gap, givaro and linbox aren't, but gmp is, cln is, etc. Is there a way one can build Sage to use the native libraries if they happen to be present? Unfortunately, some of those packages have to be exactly the right version and sometimes patched in subtle ways to work correctly together and with SAGE (mathematics software is very sensitive to slight changes). That said, I fully expect some clever Gentoo packagers to deal with all such problems at some point and create some sort of minimal Gentoo SAGE build. It hasn't happened yet, but I'm very much looking forward to when it does. I probably won't personally work on it, since I'm not personally a Gentoo user, and I think it's better left to a Gentoo user. I actually suggested it on the gentoo-science mailing list yesterday. The packages that are in the Portage system are for the most part the same versions as what I saw in the tarball, but the patches may not be there. If you're not a Gentoo user, what do you use? At some point I'll probably become a Gentoo developer, assuming: a. I magically acquire enough free time to do it, and b. Gentoo doesn't die from internal politics before that. :) --~--~-~--~~~---~--~~ 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: Problem building linbox on Gentoo Linux (gcc 4.2.0)
On 7/29/07, znmeb [EMAIL PROTECTED] wrote: On Jul 28, 10:16 pm, William Stein [EMAIL PROTECTED] wrote: Unfortunately linbox won't build yet with GCC = 4.2.0. The linbox developers are painfully aware of this, and it's evidently a nontrivial problem for them to fix. SAGE-2.7.2 (which I just uploaded moments ago) will build fine on Gentoo with GCC 4.1.x: http://sagemath.org/dist/src/ (There is an issue with building clisp with sage-2.7.1, which is fixed in 2.7.2.) Technically speaking, all of my systems run testing level Gentoo, so this sort of thing is to be expected. I can easily drop back to a stable GCC any time I want to, or for that matter, just force a 4.1.2 compile for linbox and leave everything else at 4.2. Excellent. Let me know if that doesn't work. Another option for you would be to just use a pre-built binary like one here (the Debian one would almost surely work on gentoo): http://sagemath.org/SAGEbin/linux/32bit/ Probably, although the system I want to run Sage on is a 64-bit dual- core with 4 GB of RAM. :) There is also http://sagemath.org/SAGEbin/linux/64bit/ however that binary is not built against ATLAS, whereas if you have ATLAS on your system and build SAGE from source you'll get a SAGE that is faster at linear algebra. Unfortunately, some of those packages have to be exactly the right version and sometimes patched in subtle ways to work correctly together and with SAGE (mathematics software is very sensitive to slight changes). That said, I fully expect some clever Gentoo packagers to deal with all such problems at some point and create some sort of minimal Gentoo SAGE build. It hasn't happened yet, but I'm very much looking forward to when it does. I probably won't personally work on it, since I'm not personally a Gentoo user, and I think it's better left to a Gentoo user. I actually suggested it on the gentoo-science mailing list yesterday. Thanks! The packages that are in the Portage system are for the most part the same versions as what I saw in the tarball, That's good. I'm sure building like you want (against standard Gentoo packages) would be possible *with sufficient effort*. If you're not a Gentoo user, what do you use? On a daily basis I use: * OS X * Ubuntu Linux * Debian Linux I regularly build SAGE on OS X intel and powerpc, Ubuntu 32-bit, Debian 32 and 64-bit, Mandriva, Fedora, and SUSE. And if you're curious, I also regularly use both vim and emacs, and all three of Firefox, Safari and Opera. At some point I'll probably become a Gentoo developer, assuming: a. I magically acquire enough free time to do it, and b. Gentoo doesn't die from internal politics before that. :) :-) Thanks; keep me posted. -- 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: posible licence issue raised by GPL-v3
rantWhile I think the goals of the FSF in general and the various and sundry versions of the GPL in particular are in many senses noble, I *bitterly* resent the complexity of the GPL, especially version 3. The implication of that complexity is that a programmer who wishes to develop free software must in fact be or hire an intellectual property attorney. As a result, I personally use the GPL only when *forced* to do so. There was a time when the GPL was the only viable open-source license, but that is no longer true. There are a great many open source licenses available now. When I work with Ruby, for example, I use the Ruby license. But most of the time for the few things I create myself, I use either the BSD or the MIT license. I do not plan to *ever* release anything under the GPL 3. My own personal opinion is that most open source licenses are junk, with the GPL being one of the worst. I think it's high time someone came up with an open source license that says something like this: This software is copyright 2007 M. Edward Borasky. Here is the source. You can do anything you want with it, but if you hurt someone with it, it's your fault and not mine. If you make any money with it, it's your money and not mine. If you do something with it that makes you famous, it's your fame and not mine. And I can't prevent you from compiling it and distributing the binaries without distributing the source, so you can do that too. /rant --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On 7/29/07, Pablo De Napoli [EMAIL PROTECTED] wrote: William (and others): There is a licence issue about Sage raised by GPL-v3, that may be you need to consider (I'm not a lawyer so that what I'm saying could be wrong). This comes up in sage-devel about once every other month. Thanks for revisiting the question. Currently according to the COPYING file, Sage is released under GPL version 2. This is correct. It is currently forced on SAGE because I think at least one of the libraries SAGE depends upon, e.g., PARI, is GPL V2 only. The problem is that some packages included in Sage will be soon relicence under GPL-version 3, for example GNU GSL version 1.10 will certainly released under GPL-version 3 (and so will be most FSF stuff). You're right, SAGE won't include any GPL V3 only packages until SAGE itself is relicensed GPL V3. That won't happen until every component of SAGE is relicensed under a GPL V3 compatible license. If I understand things well, you cannot link such a library to a GPL-v2 project, without releasing the whole project under GPL-v3, am I right? If this is true, then it might be necesary to consider relicensing Sage under GPL-v3. But this would mean to get explicit permision from all Sage contributors (Since Sage is not released under GPL-v2 and any later version... but explicitey under GPL-v2) Yes, I cannot release SAGE under GPL V3 until: 1. Every single component of SAGE, including PARI, is licensed under a GPL V3 compatible license, and 2. I get permission from all copyright holders of new code included in the SAGE library itself (probably = 50 people) to switch from GPL V2 to GPL V2 or later. I could start with 2. without having to wait for 1. The problem is that it's a lot of busywork that I have no desire whatever to deal with, since I much prefer doing mathematics and coding. My current plan is to stop including new versions of any packages that switch to GPL V3 only licenses, wait to see what happens with all the packages that SAGE depends on that are currently not GPL V3 compatible, then revisit this questions later. We should also watch to see how the Debian project deals with GPLv3 problems. It will be interesting to see how the Linux kernel deals with this issue, since they also have copyright spread over hundreds of people and I think they are currently GPL V2 only. Does that sound reasonable to sage-devel? 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: posible licence issue raised by GPL-v3
On 7/29/07, William Stein [EMAIL PROTECTED] wrote: On 7/29/07, Pablo De Napoli [EMAIL PROTECTED] wrote: William (and others): There is a licence issue about Sage raised by GPL-v3, that may be you need to consider (I'm not a lawyer so that what I'm saying could be wrong). This comes up in sage-devel about once every other month. Thanks for revisiting the question. Currently according to the COPYING file, Sage is released under GPL version 2. This is correct. It is currently forced on SAGE because I think at least one of the libraries SAGE depends upon, e.g., PARI, is GPL V2 only. The problem is that some packages included in Sage will be soon relicence under GPL-version 3, for example GNU GSL version 1.10 will certainly released under GPL-version 3 (and so will be most FSF stuff). You're right, SAGE won't include any GPL V3 only packages until SAGE itself is relicensed GPL V3. That won't happen until every component of SAGE is relicensed under a GPL V3 compatible license. If I understand things well, you cannot link such a library to a GPL-v2 project, without releasing the whole project under GPL-v3, am I right? If this is true, then it might be necesary to consider relicensing Sage under GPL-v3. But this would mean to get explicit permision from all Sage contributors (Since Sage is not released under GPL-v2 and any later version... but explicitey under GPL-v2) Yes, I cannot release SAGE under GPL V3 until: 1. Every single component of SAGE, including PARI, is licensed under a GPL V3 compatible license, and 2. I get permission from all copyright holders of new code included in the SAGE library itself (probably = 50 people) to switch from GPL V2 to GPL V2 or later. I could start with 2. without having to wait for 1. The problem is that it's a lot of busywork that I have no desire whatever to deal with, since I much prefer doing mathematics and coding. My current plan is to stop including new versions of any packages that switch to GPL V3 only licenses, wait to see what happens with all the packages that SAGE depends on that are currently not GPL V3 compatible, then revisit this questions later. We should also watch to see how the Debian project deals with GPLv3 problems. It will be interesting to see how the Linux kernel deals with this issue, since they also have copyright spread over hundreds of people and I think they are currently GPL V2 only. Does that sound reasonable to sage-devel? Sounds good to me.. BTW, anything I contributed can be released under GPL v2 or later. Also, I checked that GAP is distributed that way http://www.gap-system.org/Download/copyright.html 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: posible licence issue raised by GPL-v3
On 7/29/07, David Joyner [EMAIL PROTECTED] wrote: Does that sound reasonable to sage-devel? Sounds good to me.. BTW, anything I contributed can be released under GPL v2 or later. Also, I checked that GAP is distributed that way http://www.gap-system.org/Download/copyright.html Thanks. If anybody else who wants to post a statement to this effect, it could save me time later... -- 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: Problem building linbox on Gentoo Linux (gcc 4.2.0)
On Jul 29, 12:19 pm, William Stein [EMAIL PROTECTED] wrote: Technically speaking, all of my systems run testing level Gentoo, so this sort of thing is to be expected. I can easily drop back to a stable GCC any time I want to, or for that matter, just force a 4.1.2 compile for linbox and leave everything else at 4.2. Excellent. Let me know if that doesn't work. I should have it done some time tonight -- the system in question is syncing up at the moment and I want to time the build on an otherwise idle box. I'm going to do the entire build with 4.1.2 rather than just linbox, though. I don't want to risk mixing them and the switchover is a bit tricky. There is alsohttp://sagemath.org/SAGEbin/linux/64bit/ however that binary is not built against ATLAS, whereas if you have ATLAS on your system and build SAGE from source you'll get a SAGE that is faster at linear algebra. Yeah ... I have ATLAS ... *threaded* ATLAS, of course. :) I had a bit of trouble with the first couple of Sage builds I did finding the ATLAS cblas in the configure step, since Gentoo puts them in a non- standard place, but I got that working yesterday. On a daily basis I use: * OS X * Ubuntu Linux * Debian Linux Well ... I don't want to get involved in the Ubuntu vs. Debian flamewars, but I personally have had enough bad experiences with Ubuntu that I won't touch it any more -- Etch/Lenny are IMHO second only to Gentoo as the distro of choice for scientific workstations. I regularly build SAGE on OS X intel and powerpc, Ubuntu 32-bit, Debian 32 and 64-bit, Mandriva, Fedora, and SUSE. Fedora 7 is pretty good -- I've seriously considered converting one of my systems to it. Just out of curiosity, why is there not a Fedora 7 64-bit SAGE build? And if you're curious, I also regularly use both vim and emacs, and all three of Firefox, Safari and Opera. Firefox is like the GPL -- I use it only when forced to do so. :) I run Seamonkey on all of my Linux boxes and only IE7 on all my Windows boxes. I tried Opera a couple of times but couldn't get used to the UI. I don't own a Mac, although when my laptop finally dies, in all likelihood its successor will be a Mac. --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
mwrank's GPL statement says version 2 or later! John On 7/29/07, William Stein [EMAIL PROTECTED] wrote: BTW, anything I contributed can be released under GPL v2 or later. Also, I checked that GAP is distributed that way http://www.gap-system.org/Download/copyright.html Thanks. If anybody else who wants to post a statement to this effect, it could save me time later... -- John Cremona --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
rantWhile I think the goals of the FSF in general and the various and sundry versions of the GPL in particular are in many senses noble, minirantTo the contrary, the general theme in GPLv3 seems to be [EMAIL PROTECTED] you, Microsoft and Tivo regardless of any political backlash. About as noble as a vegan setting fire to a McDonald's trash can, if you ask me./minirant for the few things I create myself, I use either the BSD or the MIT license. I do not plan to *ever* release anything under the GPL 3. My Feel free to contribute BSD / MIT licensed code to SAGE. own personal opinion is that most open source licenses are junk, with the GPL being one of the worst. I think it's high time someone came up with an open source license that says something like this: This software is copyright 2007 M. Edward Borasky. Here is the source. You can do anything you want with it, but if you hurt someone with it, it's your fault and not mine. If you make any money with it, it's your money and not mine. If you do something with it that makes you famous, it's your fame and not mine. And I can't prevent you from compiling it and distributing the binaries without distributing the source, so you can do that too. /rant That reads very much like the Creative Commons license, but with a bit more attitude than one wants to see in a legal document. Also, feel free to contribute Creative Commons licenced works. --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On Jul 29, 2007, at 3:42 PM, [EMAIL PROTECTED] wrote: rantWhile I think the goals of the FSF in general and the various and sundry versions of the GPL in particular are in many senses noble, minirantTo the contrary, the general theme in GPLv3 seems to be ! @#$ you, Microsoft and Tivo regardless of any political backlash. About as noble as a vegan setting fire to a McDonald's trash can, if you ask me./minirant [snip] That reads very much like the Creative Commons license, but with a bit more attitude than one wants to see in a legal document. Also, feel free to contribute Creative Commons licenced works. \begin{RankSpeculationRequest} Does anyone have a good feel for the impact of adding BSD-, MIT-, or CCL-licensed content to a base that is licensed under GPL2 (as I think SAGE is now); or under GPL3? My recollection is that it isn't pretty. \end{RankSpeculationRequest} Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Enhancement of the Director's Income When LuteFisk is outlawed, Only outlaws will have LuteFisk --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
\begin{RankSpeculationRequest} Does anyone have a good feel for the impact of adding BSD-, MIT-, or CCL-licensed content to a base that is licensed under GPL2 (as I think SAGE is now); or under GPL3? My recollection is that it isn't pretty. \end{RankSpeculationRequest} I forgot to mention -- by BSD, I mean the modified BSD license *without the advertising clause*. To answer your question: it doesn't feel good, that's for sure. I'm not a lawyer, but this is my understanding of the situation. Creative Commons creates a legal equivalent of public domain where it doesn't already exist. At that point, Microsoft can use it, improve / harm it in any way they like, take all the credit, and turn a profit. It's essentially a license to relicense it under your own name. BSD (modified) and MIT add only the requirement that you preserve the license. So, they can be included by anything and modified at will. Changes may be released under incompatible licenses. GPL licensed code imposes severe restrictions on those who modify the code: * changes must be released under GPL * anybody who distributes (with the exception of p2p like bittorrent, for v3) binaries must also distribute source --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
There is also a possibility to release a distribution under few different licenses - for example, a part as GPL3, a part as GPL 2, and a part as MIT or whatever. That, by the way, would allow including code from Microsoft Research. Alec --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
Not always so. Verbatim snippet from the horse's mouth: When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, If you include code under this license in a larger program, the larger program must be under this license too. There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause. Fortunately, license incompatibility only matters when you want to link, merge or combine code from two different programs into a single program. There is no problem in having GPLv3-covered and GPLv2-covered programs side by side in an operating system. For instance, the TeX license and the Apache license are incompatible with GPLv2, but that doesn't stop us from running TeX and Apache in the same system with Linux, Bash and GCC. This is because they are all separate programs. Likewise, if Bash and GCC move to GPLv3, while Linux remains under GPLv2, there is no conflict. http://www.gnu.org/licenses/rms-why-gplv3.html On Sun, 29 Jul 2007, Alec Mihailovs wrote: There is also a possibility to release a distribution under few different licenses - for example, a part as GPL3, a part as GPL 2, and a part as MIT or whatever. That, by the way, would allow including code from Microsoft Research. Alec --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
From: [EMAIL PROTECTED] Not always so. Verbatim snippet from the horse's mouth: When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, If you include code under this license in a larger program, the larger program must be under this license too. There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause. Fortunately, license incompatibility only matters when you want to link, merge or combine code from two different programs into a single program. There is no problem in having GPLv3-covered and GPLv2-covered programs side by side in an operating system. For instance, the TeX license and the Apache license are incompatible with GPLv2, but that doesn't stop us from running TeX and Apache in the same system with Linux, Bash and GCC. This is because they are all separate programs. Likewise, if Bash and GCC move to GPLv3, while Linux remains under GPLv2, there is no conflict. http://www.gnu.org/licenses/rms-why-gplv3.html Well, I wouldn't call SAGE a single program. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. Alec --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On 7/29/07, Alec Mihailovs [EMAIL PROTECTED] wrote: From: [EMAIL PROTECTED] Not always so. Verbatim snippet from the horse's mouth: When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, If you include code under this license in a larger program, the larger program must be under this license too. There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause. Fortunately, license incompatibility only matters when you want to link, merge or combine code from two different programs into a single program. There is no problem in having GPLv3-covered and GPLv2-covered programs side by side in an operating system. For instance, the TeX license and the Apache license are incompatible with GPLv2, but that doesn't stop us from running TeX and Apache in the same system with Linux, Bash and GCC. This is because they are all separate programs. Likewise, if Bash and GCC move to GPLv3, while Linux remains under GPLv2, there is no conflict. http://www.gnu.org/licenses/rms-why-gplv3.html Well, I wouldn't call SAGE a single program. The issue is complicated, and I doubt a lawyer would agree. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. gmp is licensed under the GNU LGPL, which is GPL without the linking requirements, so Maple can do what they want, as long as they don't modify GMP. If they modify GMP, then they have to publish their changes under the LGPL, but they can leave the maple core alone. Alec -- Bobby Moretti [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] Re: posible licence issue raised by GPL-v3
On Jul 29, 2007, at 18:24 , Alec Mihailovs wrote: From: [EMAIL PROTECTED] Not always so. Verbatim snippet from the horse's mouth: When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, If you include code under this license in a larger program, the larger program must be under this license too. There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause. Fortunately, license incompatibility only matters when you want to link, merge or combine code from two different programs into a single program. There is no problem in having GPLv3-covered and GPLv2-covered programs side by side in an operating system. For instance, the TeX license and the Apache license are incompatible with GPLv2, but that doesn't stop us from running TeX and Apache in the same system with Linux, Bash and GCC. This is because they are all separate programs. Likewise, if Bash and GCC move to GPLv3, while Linux remains under GPLv2, there is no conflict. http://www.gnu.org/licenses/rms-why-gplv3.html Well, I wouldn't call SAGE a single program. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. Isn't 'gmp' a library, rather than a program? One of the GPL issues for those producing non-GPL'd code is that of libraries: some GPL'd libraries can be included without poisoning the program's licensing, while others can not. I think it's much worse under the GPL3 umbrella. Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Absorption of Federal Funds If you're not confused, You're not paying attention --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On 7/29/07, Justin C. Walker [EMAIL PROTECTED] wrote: On Jul 29, 2007, at 18:24 , Alec Mihailovs wrote: From: [EMAIL PROTECTED] Not always so. Verbatim snippet from the horse's mouth: When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, If you include code under this license in a larger program, the larger program must be under this license too. There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause. Fortunately, license incompatibility only matters when you want to link, merge or combine code from two different programs into a single program. There is no problem in having GPLv3-covered and GPLv2-covered programs side by side in an operating system. For instance, the TeX license and the Apache license are incompatible with GPLv2, but that doesn't stop us from running TeX and Apache in the same system with Linux, Bash and GCC. This is because they are all separate programs. Likewise, if Bash and GCC move to GPLv3, while Linux remains under GPLv2, there is no conflict. http://www.gnu.org/licenses/rms-why-gplv3.html Well, I wouldn't call SAGE a single program. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. Isn't 'gmp' a library, rather than a program? One of the GPL issues for those producing non-GPL'd code is that of libraries: some GPL'd libraries can be included without poisoning the program's licensing, while others can not. I think it's much worse under the GPL3 umbrella. GMP is licensed under the LGPL (which used to be called the Library GPL, but was retroactively named Lesser GPL due to confusion). However, anything that is licensed under the normal GPL cannot be linked without infecting the main program, be it a library, program, snippet of code, etc... See http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/doc/Why-CLISP-is-under-GPL for more details on this. As far as I know, GPLv3 doesn't really affect this property of the license. The main difference is that GPLv3 will prevent you from making your own modifications to a GPLv3'd program, releasing the source, but then ensuring (through a digital signature scheme) that it cannot run on the hardware you distributed it with. -Bobby Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Absorption of Federal Funds If you're not confused, You're not paying attention -- Bobby Moretti [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] Re: posible licence issue raised by GPL-v3
From: Bobby Moretti [EMAIL PROTECTED] Well, I wouldn't call SAGE a single program. The issue is complicated, and I doubt a lawyer would agree. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. gmp is licensed under the GNU LGPL, which is GPL without the linking requirements, so Maple can do what they want, as long as they don't modify GMP. If they modify GMP, then they have to publish their changes under the LGPL, but they can leave the maple core alone. I agree that including gmp in Maple wasn't a good example. Nevertheless, SAGE AFAICT is a distribution of various programs rather than a single program. Something like, say, TEX Live, that doesn't have a single license, see http://www.tug.org/texlive/LICENSE.TL Alec --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
On 7/29/07, Alec Mihailovs [EMAIL PROTECTED] wrote: From: Bobby Moretti [EMAIL PROTECTED] Well, I wouldn't call SAGE a single program. The issue is complicated, and I doubt a lawyer would agree. Besides, that's exactly what commercial CAS's do. In particular, Maple includes gmp and a series of other programs under separate licenses. gmp is licensed under the GNU LGPL, which is GPL without the linking requirements, so Maple can do what they want, as long as they don't modify GMP. If they modify GMP, then they have to publish their changes under the LGPL, but they can leave the maple core alone. I agree that including gmp in Maple wasn't a good example. Nevertheless, SAGE AFAICT is a distribution of various programs rather than a single program. Something like, say, TEX Live, that doesn't have a single license, see http://www.tug.org/texlive/LICENSE.TL It would be one thing if SAGE was just a distribution of software, with a package management system. But SAGE contains (lots) of code that wraps these libraries and provides a unified interface to them. I'm fairly confident that this falls under the GPL's concept of 'linking'. Alec -- Bobby Moretti [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] Re: posible licence issue raised by GPL-v3
From: Bobby Moretti [EMAIL PROTECTED] It would be one thing if SAGE was just a distribution of software, with a package management system. But SAGE contains (lots) of code that wraps these libraries and provides a unified interface to them. I'm fairly confident that this falls under the GPL's concept of 'linking'. That's not exactly clear (at least for me). Anyway - it seems mostly a theoretical problem. From practical point of view, if SAGE would use different FSF licences for different parts of it, it seems impossible that, say, PARI, or GAP, would sue it for that. Axiom - maybe (just a joke :), but it doesn't seem to be a part of SAGE. Alec --~--~-~--~~~---~--~~ 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: posible licence issue raised by GPL-v3
[EMAIL PROTECTED] wrote: Creative Commons creates a legal equivalent of public domain where it doesn't already exist. At that point, Microsoft can use it, improve / harm it in any way they like, take all the credit, and turn a profit. It's essentially a license to relicense it under your own name. Well, there are varying levels of Creative Commons. Those things I have licensed under Creative Commons I have used the With Attribution version. However, the golden rule pretty much applies to all intellectual property disputes ... he who has the gold, makes the rules. In other words, despite the flimsiness of many of Microsoft's cases in courts, they still can threaten people who most likely will back off rather than spend their own money defending themselves. Only an entity of substantial size, like IBM, the US Federal government, or Sun in reality has a chance of winning such a battle. And really, if somebody somehow manages to make money off my MP3s of random music in the Harry Partch 43-tone microtonal scale, even if they *don't* give me credit I'm not going to care all that much -- it's a hobby and I make a good living doing other stuff. :) BSD (modified) and MIT add only the requirement that you preserve the license. So, they can be included by anything and modified at will. Changes may be released under incompatible licenses. I don't have a problem with that, because I only have to maintain what *I* have created, not derivative works. :) I think if someone takes a germ of an idea from a piece of software I came up with and builds it into something substantial and valuable, he is entitled to all of the fruits of his labors. That's essentially how the capitalist world works anyhow -- *anybody* can get a great idea, but it's the *execution* and the *implementation* of it that matters. GPL licensed code imposes severe restrictions on those who modify the code: * changes must be released under GPL * anybody who distributes (with the exception of p2p like bittorrent, for v3) binaries must also distribute source And indeed, when I work with GPL software, I generally don't *make* changes or distribute binaries. I suggest changes sometimes, and I only distribute my creations in source form, with the exception of a few MP3s that were created by my algorithmic composition codes. The codes are of course GPL if they were derived from GPL software, Artistic if they are in Perl, Ruby if they are in Ruby, etc. And the MP3s are Creative Commons with Attribution. --~--~-~--~~~---~--~~ 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: Problem building linbox on Gentoo Linux (gcc 4.2.0)
The build is complete. I actually ended up doing it in two passes. The first pass was a simple make -j which took about 18 minutes: real18m8.232s user26m41.442s sys 6m41.761s This is a 2P. Interestingly enough, the load average got up into the 60s at one point, but the system never did run out of RAM and remained responsive during the whole period. I'd say that's a miracle -- the 2.6.22 kernel is better than any Linux kernel I've dealt with yet. However, some of the packages didn't build correctly in the first pass. I can't tell what exactly failed from reading the log file, but it looks like at least clisp didn't make it. So for the second pass, I simply did a make, assuming that it would only build/rebuild what didn't get done the first time. I'm about to run the test suite. In any event, I don't think parallel make is ready for prime time. --~--~-~--~~~---~--~~ 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
2007/7/28, William Stein [EMAIL PROTECTED]: I think you should just implement all of the above and send me a patch. :-). I had some time to kill on the plane, and I decided to follow your advice :) . I've attached the 3 patches. And for pth norm, I meant the l_p norm (http://mathworld.wolfram.com/PolynomialNorm.html). The definition seem to only refer to univariate polynomials. I think it is also valid for multivariate polynomials, but I'm not sure... didier --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~--- diff -r 711283cd88d7 sage/rings/polynomial/multi_polynomial_libsingular.pyx --- a/sage/rings/polynomial/multi_polynomial_libsingular.pyxTue Jul 24 16:24:24 2007 -0700 +++ b/sage/rings/polynomial/multi_polynomial_libsingular.pyxSat Jul 28 20:27:26 2007 -0400 @@ -1698,7 +1698,7 @@ cdef class MPolynomial_libsingular(sage. rChangeCurrRing((MPolynomialRing_libsingularself._parent)._ring) s = p_String(self._poly, (MPolynomialRing_libsingularself._parent)._ring, (MPolynomialRing_libsingularself._parent)._ring) return s - + def _latex_(self): r Return a polynomial latex representation of self. @@ -3362,6 +3362,27 @@ cdef class MPolynomial_libsingular(sage. rt = singclap_resultant(self._poly, other._poly, (MPolynomial_libsingularvariable)._poly ) return new_MP(self._parent, rt) +def coefficients(self): + +Return the all coefficients of self in a list. Note that the order +of the coefficients depends on the ordering self's parent + +EXAMPLES: +sage: R.x,y,z = MPolynomialRing(QQ,3,order='revlex') +sage: f=23*x^6*y^7 + x^3*y+6*x^7*z +sage: f.coefficients() +[1, 23, 6] + +sage: R.x,y,z = MPolynomialRing(QQ,3,order='lex') +sage: f=23*x^6*y^7 + x^3*y+6*x^7*z +sage: f.coefficients() +[6, 23, 1] + + +degs = self.exponents() +d = self.dict() +return [ d[i] for i in degs ] + def unpickle_MPolynomial_libsingular(MPolynomialRing_libsingular R, d): Deserialize a MPolynomial_libsingular object diff -r 711283cd88d7 sage/rings/polynomial/multi_polynomial_ring_generic.pyx --- a/sage/rings/polynomial/multi_polynomial_ring_generic.pyx Tue Jul 24 16:24:24 2007 -0700 +++ b/sage/rings/polynomial/multi_polynomial_ring_generic.pyx Sun Jul 29 18:11:51 2007 -0400 @@ -4,6 +4,9 @@ import sage.misc.latex import sage.misc.latex import multi_polynomial_ideal from term_order import TermOrder +from sage.rings.integer_ring import ZZ +from sage.rings.polynomial.polydict import PolyDict +import multi_polynomial_element def is_MPolynomialRing(x): return bool(PY_TYPE_CHECK(x, MPolynomialRing_generic)) @@ -249,6 +252,56 @@ cdef class MPolynomialRing_generic(sage. return unpickle_MPolynomialRing_generic_v1,(base_ring, n, names, order) +def random_element(self,degree,terms=5,*args,**kwds): + +Generate a random polynomial in this ring +INPUT: +degree -- maximum total degree of resulting polynomial +terms -- maximum number of terms to generate + +OUTPOUT: a random polynomial of total degree \code{degree} +and with \code{term} terms in it + +EXAMPLES: +sage: R = MPolynomialRing(ZZ, 'x,y',2 ); +sage: R.random_element(2) #random +-1*x*y + x + 15*y - 2 + +sage: R.random_element(12) #random +x^4*y^5 + x^3*y^5 + 6*x^2*y^2 - x^2 + +sage: R.random_element(12,3) #random +-3*x^4*y^2 - x^5 - x^4*y + +sage: R.random_element(3) # random +2*y*z + 2*x + 2*y + +sage: R = MPolynomialRing(RR, 'x,y',2 ); +sage: R.random_element(2) # random +-0.645358174399450*x*y + 0.572655401740132*x + 0.197478565033010 + +sage: R.random_element(41) # random +-4*x^6*y^4*z^4*a^6*b^3*c^6*d^5 + 1/2*x^4*y^3*z^5*a^4*c^5*d^6 - 5*x^3*z^3*a^6*b^4*c*d^5 + 10*x^2*y*z^5*a^4*b^2*c^3*d^4 - 5*x^3*y^5*z*b^2*c^5*d + +# General strategy: +# generate n-tuples of numbers with each element in the tuple +# not greater than (degree/n) so that the degree +# (ie, the sum of the elements in the tuple) does not exceed +# their total degree + +n = self.__ngens # length of the n-tuple +max_deg = int(degree/n) # max degree for each term +R = self.base_ring() + +# restrict exponents to positive integers only +_exponents = [ tuple([ZZ.random_element(0,max_deg+1)
[sage-devel] Re: posible licence issue raised by GPL-v3
William Stein [EMAIL PROTECTED] writes: On 7/29/07, David Joyner [EMAIL PROTECTED] wrote: Does that sound reasonable to sage-devel? Sounds good to me.. BTW, anything I contributed can be released under GPL v2 or later. Also, I checked that GAP is distributed that way http://www.gap-system.org/Download/copyright.html Thanks. If anybody else who wants to post a statement to this effect, it could save me time later... Anything I, Nick Alexander, contribute directly to the SAGE project may be licensed GPL v2 or later, at William Stein's discretion. Nick --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---