[sage-combinat-devel] Re: [sage-devel] sage thoughts
Hi Doug, Welcome to the Sage community! On Wed, Feb 09, 2011 at 01:02:10PM +0800, D. S. McNeil wrote: (2) No kwarg constraints in Partitions/Compositions should be mutually exclusive. (I think there's a ticket for this but I can't find it now.) Partitions(15,length=5, parts_in=[1,3,4]) doesn't work, so you have to do an explicit filter. Optimizing it is a separate issue, but when there's a trivial way to implement the functionality (simply test that partitions satisfy the specified criteria before yielding them, in cases where we don't currently embed the constraints in the construction process itself), then ISTM we should do so now rather than wait for a more efficient implementation to appear. Functionality+speed functionality, but functionality no functionality. Annoying, huh? This has bothered us ever since IntegersListLex was first implemented in MuPAD 9 years ago :-) In principle one of the goals of the upcoming Sage Days in Acadia in May is to reimplement IntegersListLex (http://trac.sagemath.org/sage_trac/ticket/6538). I can't guarantee that it will actually happen though. Volunteers are welcome to implement a temporary fix. However one should be careful: the kwarg options are *not* mutually exclusive as long as they are consistent (for some loose definition of consistent), and this feature is used in many places. So one should be careful not to slow things down in those situations. Currently, partitions_restricted's docstring says not to use it but to use RestrictedPartitions instead, which in turn says not to use RestrictedPartitions but to use Partitions with the parts_in keyword, which in its turn doesn't work. Specific examples welcome! Best, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] Re: tickets 10632 and 10485
On Wed, Feb 09, 2011 at 02:59:56PM -0800, Anne Schilling wrote: That being said, this could advocate for keeping CrystalOfTableaux as a class (using the classcall trick as we had discussed) in order to maintain backward compatibility on pickles (beside the other advantages). Anne: I can make a quick patch over yours tomorrow doing just that if you want. If you like. What are the other advantages? Single entry point. Isn't it currently a pain that one creates a partition using: sage: p = Partition([3,2,1]) and test if `p` is a partition with: sage: isinstance(p, sage.combinat.partition.Partition_class) ? The same holds here: a single name to remember, a single gadget to export, a single gadget for all usage. If you are making a patch anyway, could you please also fix the 0.5 to 1/2 that you did not like and Integer to int. (I remember that I first tried with int, but it did not work for me, but then I had not used Dan's trick). Done and pushed! I did a couple improvements here and there (mostly doc). Please review, and if things are ok, either fold or post on trac. Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Pickle jar
On Wed, Feb 09, 2011 at 04:51:14AM -0800, Anne Schilling wrote: For #8911 the new pickle jar was just attached. So I added this file to #10632. Probably you can do the same for #7922 (but then the tickets might not commute if both change the pickles). Yeah, that pickle jar procedure is not perfect yet. I have just created a ticket with a suggestion for improving it: http://trac.sagemath.org/sage_trac/ticket/10768 Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: Pickle jar
Oops, I am so sorry. This mail was only meant to be sent to sage-devel and sage-combinat-devel. Please moderate if still at all possible. On Thu, Feb 10, 2011 at 06:44:11PM +0100, Nicolas M. Thiery wrote: On Wed, Feb 09, 2011 at 04:51:14AM -0800, Anne Schilling wrote: For #8911 the new pickle jar was just attached. So I added this file to #10632. Probably you can do the same for #7922 (but then the tickets might not commute if both change the pickles). Yeah, that pickle jar procedure is not perfect yet. I have just created a ticket with a suggestion for improving it: http://trac.sagemath.org/sage_trac/ticket/10768 Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: Pickle jar
Salut, I worked recently on the pickle jar #10354. It needs review. If we are many changing it at the same time, I guess it may cause trouble... If it's the case, let's talk and have a good strategy... http://trac.sagemath.org/sage_trac/ticket/10354 Since it is the first time I am changing the pickle jar, I wrote on ticket all what I understood about how to do such a modification. It might be usefull if one wants to improve the documentation about pickle jar (?). Cheers, Sébastien 2011/2/10 Nicolas M. Thiery nicolas.thi...@u-psud.fr: On Wed, Feb 09, 2011 at 04:51:14AM -0800, Anne Schilling wrote: For #8911 the new pickle jar was just attached. So I added this file to #10632. Probably you can do the same for #7922 (but then the tickets might not commute if both change the pickles). Yeah, that pickle jar procedure is not perfect yet. I have just created a ticket with a suggestion for improving it: http://trac.sagemath.org/sage_trac/ticket/10768 Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-days group. To post to this group, send email to sage-combinat-d...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-days+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-days?hl=en. -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-devel] Singular in 4.6.2.alpha4 doesn't build on Ubuntu 11.04 alpha 2
I thought I would try to see if Sage builds in the upcoming version of Ubuntu, which is still early in the development stages but I think the compilers and other basic system stuff are stable. But there's some kind of linker error: ../kernel/libkernel.a(mod_raw.o): In function `dynl_open': /home/foo/sage-4.6.2.alpha4/spkg/build/singular-3-1-1-4.p3/src/kernel/mod_r aw.cc:217: undefined reference to `dlopen' ../kernel/libkernel.a(mod_raw.o): In function `dynl_sym': /home/foo/sage-4.6.2.alpha4/spkg/build/singular-3-1-1-4.p3/src/kernel/mod_r aw.cc:228: undefined reference to `dlsym' ../kernel/libkernel.a(mod_raw.o): In function `dynl_close': /home/foo/sage-4.6.2.alpha4/spkg/build/singular-3-1-1-4.p3/src/kernel/mod_r aw.cc:233: undefined reference to `dlclose' ../kernel/libkernel.a(mod_raw.o): In function `dynl_error': /home/foo/sage-4.6.2.alpha4/spkg/build/singular-3-1-1-4.p3/src/kernel/mod_r aw.cc:238: undefined reference to `dlerror' collect2: ld returned 1 exit status (Full build log attached.) This seems like a pretty basic linking / libc problem: http://www.linuxquestions.org/questions/slackware-14/undefined-reference-to -dlopen-dlclose-dlsym-and-dlerror-350945/. I tried to continue the build without Singular just to see what else worked, and also got a linker error there too -- with symmetrica, it eventually failed with undefined reference to `cos'! The build system is a current Ubuntu Natty (11.04) 32-bit virtual machine. Any ideas on what's going wrong? Is this an Ubuntu problem that will get fixed before the final release, or something we need to work on? (Or something silly on my part?) Hi I don't think you are doing anything silly it is just plain weird. In singular you have -ldl on the compilation line which should have the stuff in question. So is /usr/lib/libdl.{a,so} on your system? What about /usr/lib/libm.{a,so}? I think it is weird it doesn't fail because of libm before symmetrica. Can you provide a list of package that build before singular? Francois This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Singular in 4.6.2.alpha4 doesn't build on Ubuntu 11.04 alpha 2
On Thursday, February 10, 2011 5:54:03 AM UTC+1, Dan Drake wrote: I tried to continue the build without Singular just to see what else worked, and also got a linker error there too -- with symmetrica, it eventually failed with undefined reference to `cos'! This should be fixed in http://trac.sagemath.org/sage_trac/ticket/10719, which currently needs review hint, hint. ;-) -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
@rjf: I don't know exactly how this came up, but if 2/1 is in a different domain (rational) from 2, (integer), then gcd should probably be 1, since any non-zero rational number divides any other, and one commonly uses the positive unit 1 for such a case. One also commonly uses the content, as it provides information and is likely to be useful, whereas setting the gcd to 1 doesn't, really: I could simply use 1 directly instead. In practice: Mma and Pari both have my preferred behaviour, gcd(2/1, 4) = 2, gcd(2/3, 4/3) = 2/3, lcm(2/1, 4) = 4, lcm(2/3, 4/3) = 4/3. Maple gives instead gcd(2/1, 4) = 2, gcd(2/3, 4/3) = 1, lcm(2/1, 4) = 4, lcm(2/3, 4/3) = 8/9, which I'd also be okay with. Let a thousand flowers bloom! I don't know if Maxima has an lcm function, but at least gcd(2/1,4) = 2 and gcd(2/3, 4/3) = 2/3. Magma barfs at rational input, which is defensible. (Maybe there's another gcd which doesn't, not sure.) This would frustrate me, but at least avoids errors such as the one that got me started on this subject in the first place. Sage, by comparison, gives 1, 1, error (or 4 if you use 4/1), 4/3, which doesn't seem nearly as useful as either the Mma/Pari or Maple behaviour. They choose different conventions, but both make sense to me, and convince me that I'm not crazy. :^) It's worth emphasizing that Sage __already gives the Pari answers__ for the cases of (rational, rational) and (integer, rational) argument to lcm (and has a Rational.content implementation); I'd be interested in understanding why gcd should be different. Really, the issue is much broader. for example, do you also want to treat the complex number 1+0*i the same as 1? do you want to treat the floating point number 1.0 the same as 1? As the use cases seem far less common, I have no issues requiring explicit coercions for symbolic complex numbers. I certainly don't have problems requiring explicit coercions for finite-precision types, and have no opinions about any of the thousand other possibilities. @Simon King: as you note, there are multiple ways to extend the concept of gcds and lcms to the rationals. In such a situation, it would seem that two minimal things you would like would be (1) to reduce to the integer case for integer values, and (2) to maintain some nice properties so that the names gcd and lcm still fit. Given some definition satisfying (1), coercing down to integers from rationals isn't much of a problem, because the values will be the same. Pari, Mma, and Maple all do this in a way which makes sense, and Sage already halfway does it (with lcm). Choosing any definition which doesn't reduce to the integer one, as is currently done, seems problematic to me as a design decision, given that it's far more likely to be used that way in error than it is that someone decided to obfuscate 1 by writing it as gcd(some rational, some integer). So, is QQ reasonably covered by Wherever possible?? I doubt. Note that currently we have sage: gcd(-2,1) 1 sage: lcm(-2,1) 2 So, gcd(x,y)*lcm(x,y) == x*y doesn't even hold in ZZ. Why should it hold in QQ? I'd return different signatures, myself, but even if you don't agree, the property can easily hold as-is for Z+ and Q+. Why is for positive integers and rationals not an acceptable content for wherever possible? (I'm a physicist, not a mathematician, so I'm sometimes physics-sloppy when writing: what should I have written instead of wherever possible as shorthand for something like on the largest region containing the regime of interest while preserving the relationships under discussion?) Doug -- Department of Earth Sciences University of Hong Kong -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
Hi Doug! On 10 Feb., 09:40, D. S. McNeil dsm...@gmail.com wrote: @Simon King: as you note, there are multiple ways to extend the concept of gcds and lcms to the rationals. In such a situation, it would seem that two minimal things you would like would be (1) to reduce to the integer case for integer values, and (2) to maintain some nice properties so that the names gcd and lcm still fit. Given some definition satisfying (1), coercing down to integers from rationals isn't much of a problem, ... There is no coercing down to integers from rationals. One important property of a coercion map is that it is a map, in contrast to a partial map. Actually, it even is a morphism. So, a coercion from QQ to ZZ would presumably be a morphism from QQ to ZZ in the category of unital rings - which doesn't exist. When I wrote lcm(2/1,4) should not raise an error but use coercion, I meant of course that the integer 4 should be coerced into the common parent of 2/1 and 4, which is the rational field. Choosing any definition which doesn't reduce to the integer one, as is currently done, seems problematic to me as a design decision, given that it's far more likely to be used that way in error than it is that someone decided to obfuscate 1 by writing it as gcd(some rational, some integer). No, I think you are mistaken. If you work with a,b rational or, worse, real numbers, then it is very highly unlikely that a and b *are* integers if they happen to seem like integers. Just think of rounding errors. This is another reason why coercing down to the integers won't make sense: It is highly unlikely that 1.0 really is the integer number 1. So, I think it is by far better to have a consistent notion than to have to *guess* whether a user really means the integer 2 if s/he write 4/2 (which in the first place is a rational, not an integer). Bugs that are result of guesswork are the most ugly, IMHO. Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Problems with solve (or n() )
sage: s=solve(3*x^3-9*x+10==0,x,solution_dict=True) sage: [n(t[x]) for t in s] [1.06780542232902 - 1.84949324407141*I, # 0.0277635108030695 + 1.24902476648341*I, # WRONG! -1.09556893313209 + 0.600468477588001*I]# sage: s=solve(3*x^3-9*x +10==0,x,solution_dict=True,to_poly_solve='force') sage: [n(t[x]) for t in s] [1.06780542232902 - 0.648556288895405*I, # -2.13561076604555,# POOR PRECISION 1.06780538302277 + 0.648556231003039*I] # sage: x=CC[x].0 sage: p=3*x^3-9*x+10 sage: p.roots(multiplicities=False) [-2.13561084465804, # 1.06780542232902 - 0.648556288895405*I, # O.K 1.06780542232902 + 0.648556288895405*I] # sage: CF=ComplexField(128) # FOR COMPARISON sage: x=CF[x].0 sage: p=3*x^3-9*x+10 sage: p.roots(multiplicities=False) [-2.1356108446580430871649905855660713838, 1.0678054223290215435824952927830356919 - 0.64855628889540511607544685008848221185*I, 1.0678054223290215435824952927830356919 + 0.64855628889540511607544685008848221185*I] Andrzej Chrzeszczyk -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Re: [sage-release] sage-4.6.2.alpha4 released
On Thursday 10 February 2011, David Kirkby wrote: On 7 February 2011 20:14, Jeroen Demeyer jdeme...@cage.ugent.be wrote: Dear Sage lovers, We're releasing Sage 4.6.2.alpha4. Source archive: http://sage.math.washington.edu/home/release/sage-4.6.2.alpha4/sage-4.6.2 .alpha4.tar Please build, test, and report! We'd love to hear about your experiences with this release. Builds and passes all tests on OpenSolaris 06/2009. Whereas I normally use the ATLAS libraries I have pre-installed rather than build ATLAS, this time I built ATLAS, as I think there were some ATLAS updates. Hi David, this reminds me: did you write up somewhere how to setup a build environment suitable for Sage on OpenSolaris and/or Solaris Express? I noticed that e.g. the compiler they ship is outdated when I gave it a quick spin in a virtual machine. Cheers, Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www: http://martinralbrecht.wordpress.com/ _jab: martinralbre...@jabber.ccc.de -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bundle different objects
Wow!!! Jason, you're a genius!!! :-) Thank you for such a complete answer. Now I'll try to define my own class... :-P Dox. On Feb 10, 3:42 am, Jason Grout jason-s...@creativetrax.com wrote: On 2/9/11 9:18 PM, Robert Bradshaw wrote: On Wed, Feb 9, 2011 at 6:43 PM, Doxo.castillo.felis...@gmail.com wrote: Hi people! I was wondering if there is a way of bundle two kind of different objects together and define operations on them. Suppose, I'd like to bundle a number and a string (3, Hello) and (4, World!!)... then define and operation which multiplies the numbers and add strings, so the result is (12, HelloWorld!!) Something like that! Yes. See, for example, how the sage.misc.preparser.BackslashOperator is implemented. (I think we have a more generic one, but I'm not sure where it is.) I presume you mean the infix decorator from this patch: http://trac.sagemath.org/sage_trac/ticket/6245 I was going to point out the page in the reference manual, but apparently somehow that file is not documented in the reference manual. Anyways, do infix_operator?, see sage.misc.decorator, or just look at this example: sage: @infix_operator('add') : def my_add(a,b): : return (a[0]*b[0], a[1]+b[1]) : sage: (3,Hello) +my_add+ (4, World!!) (12, 'HelloWorld!!') But it might make a lot more sense to make a simple class that prints out the string and number and has an operation defined on it. sage: class MyClass: : def __init__(self, num, s): : self._num=num : self._s=s : def __add__(self, other): : if isinstance(other, MyClass): : return MyClass(self._num*other._num, self._s+other._s) : raise NotImplemented : def __repr__(self): : return str((self._num, self._s)) : def __str__(self): : return self.__repr__() : sage: a=MyClass(3,Hello) sage: b=MyClass(4,World!!) sage: a (3, 'Hello') sage: b (4, 'World!!') sage: a+b (12, 'HelloWorld!!') Thanks, Jason -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
Hi all, So, a coercion from QQ to ZZ would presumably be a morphism from QQ to ZZ in the category of unital rings - which doesn't exist. Agreed. So, I think it is by far better to have a consistent notion than to have to *guess* whether a user really means the integer 2 if s/he write 4/2 (which in the first place is a rational, not an integer). Bugs that are result of guesswork are the most ugly, IMHO. True. But in the case of Q (and more generally in the case of the quotient field of a (principal?) ring), we can be consistent with the ring of integers, without any guess-work. (*) This is a white lie (see below). Every rational number has a unique(*) form Product(p^(a_p), p prime) for some integer powers a_p. The rational is an integer iff all a_p are non-negative. In that case, gcd(Product(p^(a_p)), Product(p^(b_p))) = Product(p^(min(a_p,b_p))) and lcm is defined with max(a_p,b_p). But actually this definition does not rely at all on the fact that the a_p and b_p are positive. So we have a definition of the gcd and lcm for free on the quotient field of any (principal?) ring. Then, gcd(x,y).lcm(x,y)=x.y; the notion reduces to the one for integers, etc. This definition amounts to the definition of lcm(x,y) as the smallest integer multiple of x which is also an integer multiple of y. (*) In fact, there is the issue of the sign, or more generally units (elements that are invertible in the ring (here, ZZ) ). For this, there has to be some arbitrariness on the sign of gcd and lcm of negative numbers. Note that for RDF and its colleagues, this does not apply (since they are not the quotient field of any sensible ring), and we should stick with the definition gcd(x,y)=1, however much x and y look like integers. Regards, Bruno -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
Hi Bruno On 10 Feb., 12:26, Bruno Le Floch blfla...@gmail.com wrote: True. But in the case of Q (and more generally in the case of the quotient field of a (principal?) ring), we can be consistent with the ring of integers, without any guess-work. Sure. This could be one of the definitions I mentioned: lcm(a/b,c/d) = lcm(a,c)/gcd(b,d). But: Would it be a wise idea to have a totally different definition for fields and for quotient fields? Let me phrase it like this: There are different interpretations of the term consistent. On the one hand, one could mean consistency with respect to sub- structures: Let S be a sub-ring of a ring R; gcd_R is consistent with gcd_S = gcd_R(x,y)==gcd_S(x,y) for all x,y in S. As you have pointed out, there is a way to define the gcd of a quotient field consistent with the gcd of the underlying ring. On the other hand, one could mean consistent as algebraic notion (or perhaps consistent with respect to categories). Let me elaborate: One could argue that there is a partial map gcd_* that assigns to any object R of Rings() a function gcd_R that accepts two arguments (namely elements of R) returning elements of R. Now, it is possible to consider the same object R as object of different categories. For example, we have sage: QQ in QuotientFields() True sage: QQ in Fields() True sage: QQ in PrincipalIdealDomains() True So, it makes sense to call gcd_* consistent as algebraic notion, if gcd_R for R object of some category C is the same as gcd_R for the same R considered as an object of a different category C'. What you propose would be consistent with respect to subrings ( gcd(QQ(m),QQ(n))==gcd(m,n) for m,n in ZZ), but it would be inconsistent as algebraic notion, as gcd(a/b,c/d) would depend on whether we consider QQ as a quotient field or as a principal ideal domain. I strongly prefer to work with things that are consistent as algebraic notions. Best regards, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bundle different objects
I already define my class, and starts Ok, I have changed the operation to __mul__. But now I'd like to define an __add__ operation which surpass my knowledge... Something like this, sage: A = MyClass( 3, Hello) sage: B = MyClass( 4, World!) sage: A+B ( 3, Hello) + ( 4, World!) sage: C = MyClass( 5, World!) sage: B+C ( 9, World!) I'm thinking could be a bit hard, since the function I'm defining has not a string but a matrix as second entry. The first is not a number either. Thx. Dox. On Feb 10, 3:42 am, Jason Grout jason-s...@creativetrax.com wrote: On 2/9/11 9:18 PM, Robert Bradshaw wrote: On Wed, Feb 9, 2011 at 6:43 PM, Doxo.castillo.felis...@gmail.com wrote: Hi people! I was wondering if there is a way of bundle two kind of different objects together and define operations on them. Suppose, I'd like to bundle a number and a string (3, Hello) and (4, World!!)... then define and operation which multiplies the numbers and add strings, so the result is (12, HelloWorld!!) Something like that! Yes. See, for example, how the sage.misc.preparser.BackslashOperator is implemented. (I think we have a more generic one, but I'm not sure where it is.) I presume you mean the infix decorator from this patch: http://trac.sagemath.org/sage_trac/ticket/6245 I was going to point out the page in the reference manual, but apparently somehow that file is not documented in the reference manual. Anyways, do infix_operator?, see sage.misc.decorator, or just look at this example: sage: @infix_operator('add') : def my_add(a,b): : return (a[0]*b[0], a[1]+b[1]) : sage: (3,Hello) +my_add+ (4, World!!) (12, 'HelloWorld!!') But it might make a lot more sense to make a simple class that prints out the string and number and has an operation defined on it. sage: class MyClass: : def __init__(self, num, s): : self._num=num : self._s=s : def __add__(self, other): : if isinstance(other, MyClass): : return MyClass(self._num*other._num, self._s+other._s) : raise NotImplemented : def __repr__(self): : return str((self._num, self._s)) : def __str__(self): : return self.__repr__() : sage: a=MyClass(3,Hello) sage: b=MyClass(4,World!!) sage: a (3, 'Hello') sage: b (4, 'World!!') sage: a+b (12, 'HelloWorld!!') Thanks, Jason -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] sage thoughts
Hi Doug, Welcome to the Sage community! On Wed, Feb 09, 2011 at 01:02:10PM +0800, D. S. McNeil wrote: (2) No kwarg constraints in Partitions/Compositions should be mutually exclusive. (I think there's a ticket for this but I can't find it now.) Partitions(15,length=5, parts_in=[1,3,4]) doesn't work, so you have to do an explicit filter. Optimizing it is a separate issue, but when there's a trivial way to implement the functionality (simply test that partitions satisfy the specified criteria before yielding them, in cases where we don't currently embed the constraints in the construction process itself), then ISTM we should do so now rather than wait for a more efficient implementation to appear. Functionality+speed functionality, but functionality no functionality. Annoying, huh? This has bothered us ever since IntegersListLex was first implemented in MuPAD 9 years ago :-) In principle one of the goals of the upcoming Sage Days in Acadia in May is to reimplement IntegersListLex (http://trac.sagemath.org/sage_trac/ticket/6538). I can't guarantee that it will actually happen though. Volunteers are welcome to implement a temporary fix. However one should be careful: the kwarg options are *not* mutually exclusive as long as they are consistent (for some loose definition of consistent), and this feature is used in many places. So one should be careful not to slow things down in those situations. Currently, partitions_restricted's docstring says not to use it but to use RestrictedPartitions instead, which in turn says not to use RestrictedPartitions but to use Partitions with the parts_in keyword, which in its turn doesn't work. Specific examples welcome! Best, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Bundle different objects
On Thu, Feb 10, 2011 at 05:33:15AM -0800, Dox wrote: I already define my class, and starts Ok, I have changed the operation to __mul__. But now I'd like to define an __add__ operation which surpass my knowledge... Something like this, sage: A = MyClass( 3, Hello) sage: B = MyClass( 4, World!) sage: A+B ( 3, Hello) + ( 4, World!) sage: C = MyClass( 5, World!) sage: B+C ( 9, World!) I'm thinking could be a bit hard, since the function I'm defining has not a string but a matrix as second entry. The first is not a number either. Sounds like you want to implement something like the algebra of the multiplicative monoid of n x n matrices? The following may inspire you: sage: M = Monoids().example(); M An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd') sage: A = M.algebra(QQ); A Free module generated by An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd') over Rational Field sage: A.category() Category of monoid algebras over Rational Field sage: [a,b,c,d] = A.algebra_generators() sage: (a+b) * (c+2*d) 2*B['bd'] + B['ac'] + 2*B['ad'] + B['bc'] So in your case, one would want to just take: sage: M = MatrixSpace(ZZ,2) which is (among other things) a multiplicative monoid, and to consider its multiplicative monoid algebra: sage: A = M.algebra(QQ, category=Monoids()) That almost works up to a technical issue: matrices are mutable by default [1], and thus cannot be used to index the basis of a vector space. So what you would need to do is to start from the monoid example, the sources of which you can get with: sage: M = Monoids().example() sage: M?? and to adapt it so that its elements would be objects x such that x.value would be an immutable matrix (instead of a string). This raises a suggestion; should Sage implement: sage: M = MatrixSpace(ZZ, 2, immutable=True) Cheers, Nicolas [1] http://www.sagemath.org/doc/developer/coding_in_python.html#mutability -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] gcd lcm and numberfields
So bruno and simon agree that lcm(1/4,1/6) = 1/2 (lcm(numerators)/ gcd(denominators)) is the most logical. It also seems to satisfy dough wanted relation up to units. I like it because it makes sense if you think in terms of fractional ideals. And I suggest we switch to that convention. When trying fun stuff with fractional ideals in sage to give nice examples I ran in to the following worrysome results. First I tried to define a fractional ideal over QQ but I failed misserabely. Does anybody know how to do it without the following ugly trick (i.e. make a field extension of QQ of degree 1)? sage: var('x') sage: K=QQ.extension(x,'x') sage: K*(1/4) Fractional ideal (1/4) sage: QQ*(1/4) Principal ideal (1) of Rational Field But this is not the most terrible thing yet. Look at what happens if I intersect the rational ideal in K by itself! sage: (K*(1/4)).intersection(K*(1/4)) Fractional ideal (1/16) -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Upgrade of ECL .spkg to latest upstream.
I've updated ECL to the latest upstream release http://boxen.math.washington.edu/home/kirkby/patches/ecl-11.1.1.spkg Can people test this package, then run the doctests. Note the changes are not committed yet, but the are a note in SPKG.txt, and of course the source code has changed. It does not seem to be possible to updated ECL or Maxima without some issues, and this update is no different. I'd really like to get ECL updated, as it is making it impossible to build a 64-bit version of Sage on Solaris due to text relocation issues as a result of using a GNU extension in ECL. The latest ECL has this fixed, but generates 6 doctest failures on OpenSolaris, whereas with the old ECL all tests pass. The following tests failed: sage -t -long -force_lib devel/sage/sage/modules/free_module_element.pyx # 2 doctests failed sage -t -long -force_lib devel/sage/sage/interfaces/lisp.py # 2 doctests failed sage -t -long -force_lib devel/sage/sage/interfaces/maxima.py # 6 doctests failed sage -t -long -force_lib devel/sage/sage/symbolic/integration/integral.py # 1 doctests failed sage -t -long -force_lib devel/sage/sage/symbolic/expression.pyx # 3 doctests failed sage -t -long -force_lib devel/sage/sage/calculus/calculus.py # 1 doctests failed -- Total time for all tests: 1543.8 seconds make: *** [ptestlong] Error 128 Most of the problems seem to be numerical noise, with an extra digit sometimes displayed. In other cases, the order of the output of the results has changed. drkirkby@hawk:~/sage-4.6.2.alpha4$ ./sage -t -long -force_lib devel/sage/sage/modules/free_module_element.pyx # 2 doctests failed sage -t -long -force_lib devel/sage/sage/modules/free_module_element.pyx ** File /export/home/drkirkby/sage-4.6.2.alpha4/devel/sage/sage/modules/free_module_element.pyx, line 2487: sage: answers Expected: [(0.5, 5.5511151231257843e-15, 21, 0), (0.33343, 3.7007434154171903e-15, 21, 0), (0.45969769413186018, 5.1036696439228408e-15, 21, 0)] Got: [(0.5, 5.5511151231257843e-15, 21, 0), (0.7, 3.7007434154171903e-15, 21, 0), (0.45969769413186023, 5.1036696439228408e-15, 21, 0)] ** File /export/home/drkirkby/sage-4.6.2.alpha4/devel/sage/sage/modules/free_module_element.pyx, line 2493: sage: r.nintegral(t,0,1) Expected: ((0.5, 0.0, 1.0), {0: (0.5, 5.5511151231257843e-15, 21, 0), 2: (1.0, 1.110223024625157e-14, 21, 0)}) Got: ((0.5, 0.0, 1.0), {0: (0.5, 5.5511151231257843e-15, 21, 0), 2: (1.0, 1.1102230246251569e-14, 21, 0)}) ** 1 items had failures: 2 of 10 in __main__.example_70 ***Test Failed*** 2 failures. For whitespace errors, see the file /export/home/drkirkby/.sage//tmp/.doctest_free_module_element.py [6.1 s] -- The following tests failed: sage -t -long -force_lib devel/sage/sage/modules/free_module_element.pyx Total time for all tests: 6.2 seconds drkirkby@hawk:~/sage-4.6.2.alpha4$ ./sage -t -long -force_lib devel/sage/sage/interfaces/lisp.py # 2 doctests failed sage -t -long -force_lib devel/sage/sage/interfaces/lisp.py ** File /export/home/drkirkby/sage-4.6.2.alpha4/devel/sage/sage/interfaces/lisp.py, line 378: sage: lisp.function_call('sin', ['2']) Expected: 0.90929741 Got: 0.9092974 ** File /export/home/drkirkby/sage-4.6.2.alpha4/devel/sage/sage/interfaces/lisp.py, line 380: sage: lisp.sin(2) Expected: 0.90929741 Got: 0.9092974 ** 1 items had failures: 2 of 4 in __main__.example_23 ***Test Failed*** 2 failures. For whitespace errors, see the file /export/home/drkirkby/.sage//tmp/.doctest_lisp.py [2.3 s] -- The following tests failed: sage -t -long -force_lib devel/sage/sage/interfaces/lisp.py Total time for all tests: 2.3 seconds drkirkby@hawk:~/sage-4.6.2.alpha4$ ./sage -t -long -force_lib devel/sage/sage/interfaces/maxima.py # 6 doctests failed sage -t -long -force_lib devel/sage/sage/interfaces/maxima.py ** File /export/home/drkirkby/sage-4.6.2.alpha4/devel/sage/sage/interfaces/maxima.py, line 934: sage: maxima.example('arrays') Expected: a[n]:=n*a[n-1] a := n a n n - 1 a[0]:1 a[5]
[sage-devel] Re: gcd lcm and numberfields
Hi koffie, On 10 Feb., 15:02, koffie m.derickx.stud...@gmail.com wrote: So bruno and simon agree that lcm(1/4,1/6) = 1/2 (lcm(numerators)/ gcd(denominators)) is the most logical. I do not agree at all with that! lcm(1/4,1/6)=1/2 was just an example of one (among others) way to extend lcm from ZZ to QQ. I did *not* say that I want this behaviour! Actually, I clearly wrote in my preceding post that I prefer a notion of gcd/lcd for QQ that does not depend on whether QQ is regarded as a principal ideal domain or as the quotient field of another principal ideal domain (namely of ZZ). Since QQ is a field, it is a principal ideal domain, where lcm and gcd should have something to do with ideals. So, clearly lcm(4/1,2)=1. Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Easy beginners review: #10487 (Clean up doctests in finite_field_ext_pari.py)
Could somebody please review #10487? It cleans up, adds/removes some doctests in sage/rings/finite_rings/finite_field_ext_pari.py No actual code is changed. Thanks, Jeroen. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: gcd lcm and numberfields
On Feb 10, 3:19 pm, Simon King simon.k...@uni-jena.de wrote: Hi koffie, Since QQ is a field, it is a principal ideal domain, where lcm and gcd should have something to do with ideals. So, clearly lcm(4/1,2)=1. It would be good to know what why lcm was written as it is right now. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: gcd lcm and numberfields
in maxima, gcd(1/4,1/6) is 1/12, lcm is 1/2 Since maxima immediately simplifies 2/1 to 2, there is no distinction between gcd(2/1, ) and gcd(2, ...) That is not to say that INTERNALLY, everything runs through the same gcd process. It should be clear that notions like polynomial gcd / content / etc have to be very carefully defined relative to the domains of interest. The programmers who knew rather less algebra than necessary had to study up about rings and fields. But this was in 1966 or so. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bundle different objects
Nicalas... Your suggestion almost work, and in fact it is exactly what I'm talking about! Specifically, my idea is to work with connections with values in a non- Abelian Lie algebra, SU(2), so there are 3 generators. Therefore, the first entry of my function is a form, and the second is a Lie algebra generator!. I tried this class nAform(object): def __init__(self, a, b): self._form = a self._matrix = b def __add__(self, other): if isinstance(other, nAform): if (self._matrix == other._matrix): return nAform(self._form + other._form, self._matrix) else: raise NotImplemented raise NotImplemented def __mul__(self, other): if isinstance(other, nAform): return nAform(self._form.wedge(other._form), self._matrix.commutator(other._matrix)) raise NotImplemented def __repr__(self): return str((self._form, self._matrix)) def __str__(self): return self.__repr__() And for monomials form it can multiply. But I got stacked in the definition of an addition, if the generators of the algebra are different! Which is, of course, one of the most important part of the class. Any additional help is welcome! DOX -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] mascot for sage-flame?
http://www.guardian-re.com/Southwest+Montana+Photos/sage+grouse.jpg John -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
On Feb 10, 2:10 pm, Simon King simon.k...@uni-jena.de wrote: Hi Bruno Let me phrase it like this: There are different interpretations of the term consistent. On the one hand, one could mean consistency with respect to sub- structures: Let S be a sub-ring of a ring R; gcd_R is consistent with gcd_S = gcd_R(x,y)==gcd_S(x,y) for all x,y in S. As you have pointed out, there is a way to define the gcd of a quotient field consistent with the gcd of the underlying ring. On the other hand, one could mean consistent as algebraic notion (or perhaps consistent with respect to categories). Let me elaborate: One could argue that there is a partial map gcd_* that assigns to any object R of Rings() a function gcd_R that accepts two arguments (namely elements of R) returning elements of R. Now, it is possible to consider the same object R as object of different categories. For example, we have sage: QQ in QuotientFields() True sage: QQ in Fields() True sage: QQ in PrincipalIdealDomains() True So, it makes sense to call gcd_* consistent as algebraic notion, if gcd_R for R object of some category C is the same as gcd_R for the same R considered as an object of a different category C'. What you propose would be consistent with respect to subrings ( gcd(QQ(m),QQ(n))==gcd(m,n) for m,n in ZZ), but it would be inconsistent as algebraic notion, as gcd(a/b,c/d) would depend on whether we consider QQ as a quotient field or as a principal ideal domain. I strongly prefer to work with things that are consistent as algebraic notions. You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. This is not trivial. For instance Fields do not have a default gcd/lcm method. I asked in sage-devel about some time ago about sensible approaches here. http://groups.google.com/group/sage-devel/browse_thread/thread/12524b18d2325633/7b8af907c3c45c8b?lnk=gstq=gcd+and+lcm+for+field+elements#7b8af907c3c45c8b -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Pickle jar
On Wed, Feb 09, 2011 at 04:51:14AM -0800, Anne Schilling wrote: For #8911 the new pickle jar was just attached. So I added this file to #10632. Probably you can do the same for #7922 (but then the tickets might not commute if both change the pickles). Yeah, that pickle jar procedure is not perfect yet. I have just created a ticket with a suggestion for improving it: http://trac.sagemath.org/sage_trac/ticket/10768 Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Pickle jar
Oops, I am so sorry. This mail was only meant to be sent to sage-devel and sage-combinat-devel. Please moderate if still at all possible. On Thu, Feb 10, 2011 at 06:44:11PM +0100, Nicolas M. Thiery wrote: On Wed, Feb 09, 2011 at 04:51:14AM -0800, Anne Schilling wrote: For #8911 the new pickle jar was just attached. So I added this file to #10632. Probably you can do the same for #7922 (but then the tickets might not commute if both change the pickles). Yeah, that pickle jar procedure is not perfect yet. I have just created a ticket with a suggestion for improving it: http://trac.sagemath.org/sage_trac/ticket/10768 Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
Hi Luis, On 10 Feb., 17:48, luisfe lftab...@yahoo.es wrote: ... You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. This is not trivial. For instance Fields do not have a default gcd/lcm method. I asked in sage-devel about some time ago about sensible approaches here.http://groups.google.com/group/sage-devel/browse_thread/thread/12524b... Yes, on my way home, I thought that perhaps lcm(4/1,2)=1 is not so obvious as I first found. lcm(a,b) has to be a generator of the intersection of the ideals generated by a and b. Of course, 1 is a quite canonical generator for the only non-zero ideal in a field -- simply because any field has a 1. But any other non-zero element is fine as well, in a field. So, after all, defining lcm(a/b,c/d)=lcm(a,c)/gcd(b,d) for fraction fields of principal ideal domains makes more sense than I originally thought. And with gcd(a/b,c/d)=gcd(a,c)/lcm(b,d), we would indeed have gcd(x,y)*lcm(x,y)=x*y. According to Richard Fateman, that definition seems to be be used in Maxima (in maxima, gcd(1/4,1/6) is 1/12, lcm is 1/2). But according to Tim Daly, Axiom returns 1 as lcm of any two rationals. So, should Sage stay on the side of Axiom or switch to the side of Maxima? Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
On Thu, Feb 10, 2011 at 9:49 AM, Simon King simon.k...@uni-jena.de wrote: Hi Luis, On 10 Feb., 17:48, luisfe lftab...@yahoo.es wrote: ... You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. This is not trivial. For instance Fields do not have a default gcd/lcm method. I asked in sage-devel about some time ago about sensible approaches here.http://groups.google.com/group/sage-devel/browse_thread/thread/12524b... Yes, on my way home, I thought that perhaps lcm(4/1,2)=1 is not so obvious as I first found. lcm(a,b) has to be a generator of the intersection of the ideals generated by a and b. Of course, 1 is a quite canonical generator for the only non-zero ideal in a field -- simply because any field has a 1. But any other non-zero element is fine as well, in a field. So, after all, defining lcm(a/b,c/d)=lcm(a,c)/gcd(b,d) for fraction fields of principal ideal domains makes more sense than I originally thought. And with gcd(a/b,c/d)=gcd(a,c)/lcm(b,d), we would indeed have gcd(x,y)*lcm(x,y)=x*y. According to Richard Fateman, that definition seems to be be used in Maxima (in maxima, gcd(1/4,1/6) is 1/12, lcm is 1/2). But according to Tim Daly, Axiom returns 1 as lcm of any two rationals. So, should Sage stay on the side of Axiom or switch to the side of Maxima? It should switch to the side of Maxima/Pari/Mathematica/etc. in this. -- William -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
On Thu, Feb 10, 2011 at 9:55 AM, William Stein wst...@gmail.com wrote: [... gcd stuff ...] It seems like nobody explained how the current gcd definition got included. It's from a patch to rational.pyx from Alex Ghitza (who I cc'd) that did this: -d = self.denom()*other.denom() -self_d = self.numer()*other.denom() -other_d = other.numer()*self.denom() -return self_d.gcd(other_d) / d +if self == 0 and other == 0: +return Rational(0) +else: +return Rational(1) This was from trac 3214 uniformise the behaviour of gcd for rational numbers: http://trac.sagemath.org/sage_trac/ticket/3214 which was reported by Andrey Novoseltsev. So if Andrey or Alex cared so much, they may want to pipe up. This thread is at least: http://groups.google.com/group/sage-devel/browse_thread/thread/cd05585cf395b3a0/160c549d6bdc8867#160c549d6bdc8867 William -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
I have not taken the time to read this whole thread, but here goes anyway: The distinction is between ideals of Q (which are of course only (0) and (1)) and sub-Z-modules of Q, a.k.a. fractional ideals (since in the generalization to number fields K we (ab)use the terminology ideal of K to mean fractional ideal of K which is the same as OK_submodule of K (of maximal rank). Every f.g. Z-submodule of Q is cyclic, and instead of the current behaviour of gcd(x,y) for rationals (which is to give the generator of the Q-ideal generated by x and y) the old -- and perhaps desired -- behaviour is to give the generator of the Z-module generated by x and y. The latter is, of course, unique up to sign. It's the same as Simon's generator of the sum of the Z-submodules generated by x and by y. And then lcm(x,y) is the genrator of their intersection. This way, both gcd(x,y) and lcm(x,y) are positive rationals (or 0 but not when x and y are nonzero). And we have gcd(x,y)*lcm(x,y) = abs(x*y) which I think is a better convention for when x and/or y are negative than deciding to make one of the gcd and the lcm negative. John On Thu, Feb 10, 2011 at 10:01 AM, William Stein wst...@gmail.com wrote: On Thu, Feb 10, 2011 at 9:55 AM, William Stein wst...@gmail.com wrote: [... gcd stuff ...] It seems like nobody explained how the current gcd definition got included. It's from a patch to rational.pyx from Alex Ghitza (who I cc'd) that did this: - d = self.denom()*other.denom() - self_d = self.numer()*other.denom() - other_d = other.numer()*self.denom() - return self_d.gcd(other_d) / d + if self == 0 and other == 0: + return Rational(0) + else: + return Rational(1) This was from trac 3214 uniformise the behaviour of gcd for rational numbers: http://trac.sagemath.org/sage_trac/ticket/3214 which was reported by Andrey Novoseltsev. So if Andrey or Alex cared so much, they may want to pipe up. This thread is at least: http://groups.google.com/group/sage-devel/browse_thread/thread/cd05585cf395b3a0/160c549d6bdc8867#160c549d6bdc8867 William -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Ranking and unranking combinations
Is the last line a bug, or should the input required to be sorted and an error raised? Or am I missing something? The help for rank/unrank is not very complete. sage: C = Combinations([0,1,2], 2) sage: C.unrank(1) [0, 2] sage: C.rank([0,2]) 1 sage: C.rank([2,0]) 0 -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
On Feb 10, 11:01 am, William Stein wst...@gmail.com wrote: On Thu, Feb 10, 2011 at 9:55 AM, William Stein wst...@gmail.com wrote: [... gcd stuff ...] It seems like nobody explained how the current gcd definition got included. It's from a patch to rational.pyx from Alex Ghitza (who I cc'd) that did this: - d = self.denom()*other.denom() - self_d = self.numer()*other.denom() - other_d = other.numer()*self.denom() - return self_d.gcd(other_d) / d + if self == 0 and other == 0: + return Rational(0) + else: + return Rational(1) This was from trac 3214 uniformise the behaviour of gcd for rational numbers: http://trac.sagemath.org/sage_trac/ticket/3214 which was reported by Andrey Novoseltsev. So if Andrey or Alex cared so much, they may want to pipe up. This thread is at least: http://groups.google.com/group/sage-devel/browse_thread/thread/cd0558... William Well, I used to use gcd for obtaining the primitive integral vector with a specified rational direction. My concern on Trac 3214 was that gcd(a1, ..., ak) depended on the order of arguments and I wanted it to be fixed. The eventual solution was to agree that gcd as the greatest common divisor does not really make much sense for fields, but instead of raising an exception it can just return 1. This meant that I cannot use it for my original purpose (not a big deal - it is easy to do more directly), but I think that it was quite a sensible decision: 1) I don't recall seeing gcd of rational numbers in any book or paper 2) there is clearly no natural extension of this notion from ZZ to QQ 3) the name itself indeed is very strange applied to fields. So I personally think that any kind of gcd/lcm combinations of numerators/denominators of rational numbers should have some other more appropriate names, since making up some conventions for gcd is potentially dangerous and may make code using it harder to understand if a reader thinks of gcd differently than the original author... Thank you, Andrey -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bundle different objects
I've define the action of the exterior derivative on the non-Abelian connection, class nAform(object): def __init__(self, a, b): self._form = a self._matrix = b def __add__(self, other): if isinstance(other, nAform): if (self._matrix == other._matrix): return nAform(self._form + other._form, self._matrix) else: raise NotImplemented raise NotImplemented def __mul__(self, other): if isinstance(other, nAform): return nAform(self._form.wedge(other._form), self._matrix.commutator(other._matrix)) raise NotImplemented def diff(self): return nAform(self._form.diff(), self._matrix) def __repr__(self): return str((self._form, self._matrix)) def __str__(self): return self.__repr__() * TODO: ** Define the sum for forms with values in different elements of the algebra. ** Define the product of the forms by a number (or function) Cheers DOX -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bundle different objects
On 2/10/11 9:53 AM, Dox wrote: Nicalas... Your suggestion almost work, and in fact it is exactly what I'm talking about! Specifically, my idea is to work with connections with values in a non- Abelian Lie algebra, SU(2), so there are 3 generators. Therefore, the first entry of my function is a form, and the second is a Lie algebra generator!. I tried this class nAform(object): def __init__(self, a, b): self._form = a self._matrix = b def __add__(self, other): if isinstance(other, nAform): if (self._matrix == other._matrix): return nAform(self._form + other._form, self._matrix) else: raise NotImplemented raise NotImplemented def __mul__(self, other): if isinstance(other, nAform): return nAform(self._form.wedge(other._form), self._matrix.commutator(other._matrix)) raise NotImplemented def __repr__(self): return str((self._form, self._matrix)) def __str__(self): return self.__repr__() And for monomials form it can multiply. But I got stacked in the definition of an addition, if the generators of the algebra are different! Which is, of course, one of the most important part of the class. Any additional help is welcome! I made a mistake in my original code when I did raise NotImplemented. I believe it should be return NotImplemented instead (i.e., NotImplemented is a constant, not an error to be raised). See the last line of the documentation for these functions: http://docs.python.org/reference/datamodel.html#object.__add__ Thanks, Jason -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
Well, I used to use gcd for obtaining the primitive integral vector with a specified rational direction. My concern on Trac 3214 was that gcd(a1, ..., ak) depended on the order of arguments and I wanted it to be fixed. The eventual solution was to agree that gcd as the greatest common divisor does not really make much sense for fields, but instead of raising an exception it can just return 1. This meant that I cannot use it for my original purpose (not a big deal - it is easy to do more directly), but I think that it was quite a sensible decision: 1) I don't recall seeing gcd of rational numbers in any book or paper 2) there is clearly no natural extension of this notion from ZZ to QQ 3) the name itself indeed is very strange applied to fields. So I personally think that any kind of gcd/lcm combinations of numerators/denominators of rational numbers should have some other more appropriate names, since making up some conventions for gcd is potentially dangerous and may make code using it harder to understand if a reader thinks of gcd differently than the original author... I agree that it's a little bit awkward, but I think that we should go with the maxima/pari/mathematica convention. * The issue the OP brought up, where gcd silently gave nonsensical issues when one of the integers accidentally got divided by 1 (or you used / instead of // in a case where you know one is divisible by the other) is compelling. * The gcd should be a generator of the fractional ideal generated by the inputs; the lcm of the intersection as long as that fractional ideal is principal (if we're in a non-PID or fraction field of a non-PID I think we should raise an error). There's an ambiguity about units; we should make a consistent choice between the PID and its fraction field. In the case of integers and rationals, this means we choose the results to be positive and have the relation gcd(x,y)*lcm(x,y) = abs(x,y) as John pointed out. David -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Upgrade of ECL .spkg to latest upstream.
I've updated ECL to the latest upstream release http://boxen.math.washington.edu/home/kirkby/patches/ecl-11.1.1.spkg Can people test this package, then run the doctests. Note the changes are not committed yet, but the are a note in SPKG.txt, and of course the source code has changed. It does not seem to be possible to updated ECL or Maxima without some issues, and this update is no different. I'd really like to get ECL updated, as it is making it impossible to build a 64-bit version of Sage on Solaris due to text relocation issues as a result of using a GNU extension in ECL. The latest ECL has this fixed, but generates 6 doctest failures on OpenSolaris, whereas with the old ECL all tests pass. snip Looks exactly like what I had when I did the same thing on linux (x86 and amd64) and OS X 10.5. It's all numerical and formatting noise. Upgrading maxim to 5.23.2 at the same time generated only one or two more broken tests (and of them was a good thing: maxima integrated something it couldn't before). I posted something about it earlier with other potential upgrades: http://groups.google.com/group/sage- devel/browse_thread/thread/9baec937c873dcb7 Someone commented that ecl-11.1.1 had an horrible bug. Francois This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Is the patchbot broken?
Hi! I recently opened trac ticket #10763 (remove some overhead that slows down matrix multiplication). The patch bot says that the patch applies, but some doctests fail. However, when I tried some of the failing tests on the command line, everything was fine. I am now running the test suite, but I wonder why tests fail for the patchbot and not for me. And for my favorite ticket #8800 (raise doctest coverage of a big part of the coercion machinery to 100% and fix 15 bugs, needing review since two months, hint hint...), the patchbot complains that most hunks of the patch fail to apply -- which comes as a surprise since the patch applies cleanly for me (or at least, it did so recently). Why is that? Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Is the patchbot broken?
Hi Robert, On 10 Feb., 21:10, Robert Bradshaw rober...@math.washington.edu wrote: Are you perhaps working of a more recent alpha? (This could answer the previous question as well, though the startuptime test is still somewhat flakey too.) I am working with Sage Version 4.6.2.alpha0, Release Date: 2011-01-13. However, the patchbot complains since a long time that the patch from #8800 does not apply (and that *most* hunks fail. Therefore, after building version 4.6.2.alpha0, I was refreshing my patch -- but the patchbot still complained. Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Upgrade of ECL .spkg to latest upstream.
On 10 February 2011 20:32, kcrisman kcris...@gmail.com wrote: I get essentially (probably exactly) the same errors on OS X 10.4 PPC. If anyone else tries this, don't forget you have to rebuild (./ sage -f maxima) Maxima after building the new ECL. Francois' idea is great. I mentioned the apparent bug, which was pointed out on the Maxima list (handling 1 versus true): http://www.math.utexas.edu/pipermail/maxima/2011/023868.html Maybe in the meantime that has been explained/dealt with, but I'm not on the ecl devel list. I am on the ECL list, but had not noticed anything - had other things on my mind lately. Perhaps we can upgrade Maxima to the latest, which will improve the integration and upgrade ECL to something that does not have this bug, but solves my Solaris bug. (Of source, Murphy's law says the ECL bug was introduced before the Solaris/ECL bug was fixed). Dave -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Upgrade of ECL .spkg to latest upstream.
On 10 February 2011 20:32, kcrisman kcris...@gmail.com wrote: I get essentially (probably exactly) the same errors on OS X 10.4 PPC.If anyone else tries this, don't forget you have to rebuild (./ sage -f maxima) Maxima after building the new ECL. Francois' idea is great. I mentioned the apparent bug, which was pointed out on the Maxima list (handling 1 versus true): http://www.math.utexas.edu/pipermail/maxima/2011/023868.html Maybe in the meantime that has been explained/dealt with, but I'm not on the ecl devel list. I am on the ECL list, but had not noticed anything - had other things on my mind lately. Perhaps we can upgrade Maxima to the latest, which will improve the integration and upgrade ECL to something that does not have this bug, but solves my Solaris bug. (Of source, Murphy's law says the ECL bug was introduced before the Solaris/ECL bug was fixed). Reading the message linked by Karl it seems easy to patch for this behavior. Of course there could be other problems elsewhere with a similar origin. I'd say we should go ahead with a patch in maxima (line 831 of the file src/ifactor.lisp). That's a number of doctests to correct. Will do a run of sage-on-gentoo with ecl-11.1.1 and maxima-5.23.2 to check all the broken doctests. Francois This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] mascot for sage-flame?
+1. Love it. On Thu, Feb 10, 2011 at 11:47 AM, John Cremona john.crem...@gmail.comwrote: http://www.guardian-re.com/Southwest+Montana+Photos/sage+grouse.jpg John -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Upgrade of ECL .spkg to latest upstream.
On 10 February 2011 20:59, Francois Bissey francois.bis...@canterbury.ac.nz wrote: Reading the message linked by Karl it seems easy to patch for this behavior. Of course there could be other problems elsewhere with a similar origin. I'd say we should go ahead with a patch in maxima (line 831 of the file src/ifactor.lisp). That's a number of doctests to correct. Will do a run of sage-on-gentoo with ecl-11.1.1 and maxima-5.23.2 to check all the broken doctests. Francois It appears this was a bug created by ECL which the ECL developer has acknowledged http://www.mail-archive.com/ecls-list@lists.sourceforge.net/msg00671.html and is fixed in CVS. So I think we should leave Maxima untouched, and instead apply a patch to ECL What is not clear from that posting is where in the ECL code the bug is, but clearly this is an ECL bug, and may cause other issues we are so far unaware of. Dave -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Upgrade of ECL .spkg to latest upstream.
On 10 February 2011 20:59, Francois Bissey francois.bis...@canterbury.ac.nz wrote: Reading the message linked by Karl it seems easy to patch for this behavior. Of course there could be other problems elsewhere with a similar origin. I'd say we should go ahead with a patch in maxima (line 831 of the file src/ifactor.lisp). That's a number of doctests to correct. Will do a run of sage-on-gentoo with ecl-11.1.1 and maxima-5.23.2 to check all the broken doctests. Francois It appears this was a bug created by ECL which the ECL developer has acknowledged http://www.mail-archive.com/ecls-list@lists.sourceforge.net/msg00671.html and is fixed in CVS. So I think we should leave Maxima untouched, and instead apply a patch to ECL What is not clear from that posting is where in the ECL code the bug is, but clearly this is an ECL bug, and may cause other issues we are so far unaware of. Agreed. I'd say from the date stamp and description: http://ecls.git.sourceforge.net/git/gitweb.cgi?p=ecls/ecl;a=commit;h=ce19c67a1b9f63cd232e7c0a621b6ca87aaa7214 Francois This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
Let me phrase it like this: There are different interpretations of the term consistent. @Simon: You are right to distinguish the two kinds of consistencies. And I can understand that sometimes it is preferable to have the algebraic consistency. I tend to care about elements of the objects more than the objects of the category (i.e. individual rational numbers rather than the field/PID/quotient field QQ), and thus I tend towards subring consistency. You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. I don't see how this brings in both consistencies. Algebraic consistency requires gcd and lcm on QQ to have different outputs depending on whether QQ is seen a Field, a PID, a Quotient Field... Is there a clear way for the user to indicate which QQ he wants? Or we could have (I don't really know how this is done ;-) ) lcm(10/21, 14/15, type=PID) = 1 lcm(10/21, 14/15, type=Field) = 1 lcm(10/21, 15/14, type=quotient-of-ZZ) = 30/7 I doubt that the field version is useful at all: the lcm is basically always 1 (except when one of the arguments is zero). lcm and gcd should only be defined for PIDs, where they are interesting (or for factorization rings? I can't remember my undergrad). http://groups.google.com/group/sage-devel/browse_thread/thread/12524b18d2325633/7b8af907c3c45c8b?lnk=gstq=gcd+and+lcm+for+field+elements#7b8af907c3c45c8b Interesting read, thanks. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Upgrade of ECL .spkg to latest upstream.
On 10 February 2011 20:59, Francois Bissey It appears this was a bug created by ECL which the ECL developer has acknowledged http://www.mail-archive.com/ecls-list@lists.sourceforge.net/msg00671.html and is fixed in CVS. So I think we should leave Maxima untouched, and instead apply a patch to ECL What is not clear from that posting is where in the ECL code the bug is, but clearly this is an ECL bug, and may cause other issues we are so far unaware of. Agreed. I'd say from the date stamp and description: http://ecls.git.sourceforge.net/git/gitweb.cgi?p=ecls/ecl;a=commit;h=ce19c6 7a1b9f63cd232e7c0a621b6ca87aaa7214 That's the right patch. Patched ecl-11.1.1, build, unpatch maxima, build. Test: maxima ;;; Loading #P/usr/lib64/ecl-11.1.1/sb-bsd-sockets.fas ;;; Loading #P/usr/lib64/ecl-11.1.1/sockets.fas ;;; Loading #P/usr/lib64/ecl-11.1.1/defsystem.fas ;;; Loading #P/usr/lib64/ecl-11.1.1/cmp.fas Maxima 5.23.2 http://maxima.sourceforge.net using Lisp ECL 11.1.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) next_prime(113); (%o1) 127 Which is what we want. Now to test my own doctest patch. Francois This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, I sent this to Volker off-list already, but now that I can post, here it is for others to read: Volker, Thanks for the suggestions. The shared libtachyon via autotools is probably a good idea, though it would only be usable for the non-MPI builds. MPI programs must always be compiled from source unless one uses something like MorphMPI that simulates an ABI to abstract the native implementation. I will see about doing this later this spring after I'm done with the rest of the heavy lifting I'm doing getting the new version of Tachyon ready and releasing it concurrently with the new version of VMD... Rendering to a memory buffer is trivial, and no, you don't need any OpenGL headers or anything like that, the core Tachyon library is independent of the supplied standalone driver program and OpenGL demo programs in the demosrc directory. To render to a memory buffer you would want to use one of these two APIs: / ** * Request Tachyon to save the output image in the specified * memory buffer, in raw 24-bit, packed, pixel interleaved, unsigned char * RGB bytes. The caller is responsible for making sure that there * is enough space in the memory area for the entire image. */ void rt_rawimage_rgb24(SceneHandle, unsigned char *rawimage); / ** * Request Tachyon to save the output image in the specified * memory buffer, in raw 96-bit, packed, pixel interleaved, 32-bit float * RGB bytes. The caller is responsible for making sure that there * is enough space in the memory area for the entire image. */ void rt_rawimage_rgb96f(SceneHandle, float *rawimage); So, for a 24-bit RGB image, Tachyon expects you to send in a pointer to a packed 24-bit RGB image buffer. You'd allocate the buffer and pass it to Tachyon in a code sequence like this: rt_resolution(scene, width, height); unsigned char *rgb24 = (unsigned char*) malloc(width*height*3); rt_rawimage_rgb24(scene, rgb24); The aperture option/API is going to change, so I will probably not document it quite yet, but if you want to fool around with that I would be happy to help you play with the existing code until I'm happy with how it works. I am in the process of massively updating the Tachyon docs and header files to make this all easier to follow. If you want, I can send you and any other interested parties a current snapshot for you to play with. Cheers, John Stone john.st...@gmail.com On Feb 6, 1:38 am, Volker Braun vbraun.n...@gmail.com wrote: Dear John sage-devel, I looked into libtachyon on Sage a while ago. Right now, we don't build the library because tachyon already isn't that easy to build without manual intervention. Sage only drives tachyon through temporary files at the moment. Clearly, that is not ideal. My wishlist would be 1) Use autotools/libtools to build a shared libtachyon in a portable manner. 2) I know that there is a way to render into a memory buffer, but I haven't understood it 100%. I'm not sure if building it currently needs OpenGL headers; If possible, we would like to avoid that dependency. 3) Documentation would be nice ;-) For example we haven't quite been able to figure out the aperture option, seehttp://trac.sagemath.org/sage_trac/ticket/9855 Best wishes, Volker -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
I've pondered adding text rendering as a built-in feature of Tachyon, but up to this point I have resisted due to the complexity involved. (whatever font set I would choose would undoubtably not be exactly the right thing for any particular usage). The best way to do this is usually to build the font code into the calling application, as it can be used with multiple renderers and the rendered images can be made to look exactly the same whether OpenGL, Tachyon, Renderman, POV-Ray, etc. This is what I've done in VMD, the molecular visualization tool I develop in my day job. In VMD, I use one of the public domain Hershey vector font sets, with two simple APIs, one generates OpenGL rendering commands, and the other is setup to be called to generate the vector font strokes on-the-fly by any rendering API one would want. Using this scheme, VMD generates line-based renderings within OpenGL, and uses sequences of connected cylinders and spheres in ray tracers or other renderers that don't have an exact equivalent of a line. Here are relevant VMD source files as examples: Hershey.h: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8h-source.html Hershey.C: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8C-source.html TachyonDisplayDevice.C (see the ::text method therein): http://www.ks.uiuc.edu/Research/vmd/doxygen/TachyonDisplayDevice_8C-source.html#l00153 I could add the Hershey Roman font I use in VMD into Tachyon pretty easily, but it might be an even better idea to build this into SAGE itself. What do others think? Cheers, John Stone john.st...@gmail.com On Feb 6, 3:11 am, Robert Bradshaw rober...@math.washington.edu wrote: IIRC, the ability to easily do text labels is something that is missing right now. It would be great to be able to attach some text to a point (we don't need shadows or anything fancy). We could probably even do this ourselves if there was an easy API to go from 3D point to 2D point in the output. - Robert On Sat, Feb 5, 2011 at 10:40 PM, William Stein wst...@gmail.com wrote: Hi, I have permission from the author of Tachyon to forward his message below to the Sage list. He's basically interested in whether there is _anything_ he could do to make Tachyon more useful for Sage. See below. -- Forwarded message -- From: John Stone jo...@ks.uiuc.edu Date: Tue, Feb 1, 2011 at 10:56 PM Subject: Feedback on Tachyon APIs used by SAGE, etc.. To: William Stein wst...@gmail.com Hi William, I'm in the process of doing a bunch of updating of the Tachyon header files and documentation and thought I'd send a quick ping. I was wondering if the SAGE project wants or needs anything changed or improved in the Tachyon APIs, since I'm already doing some significant improvements for other projects. I was also curious what portions of the Tachyon APIs are exposed in SAGE now, and whether it might be time to update SAGE to be able to take advantage of various new Tachyon features such as ambient occlusion lighting and other improvements that may not be exposed in the current versions SAGE. I would also be happy to have a look at your existing Tachyon code and see if I notice anything that might be added or improved if you can tell me where to look for it. Cheers, John Stone -- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: jo...@ks.uiuc.edu Phone: 217-244-3349 WWW:http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078 -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/sage-devel URL:http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, On Feb 6, 3:31 am, Dr. David Kirkby david.kir...@onetel.net wrote: On 02/ 6/11 07:38 AM, Volker Braun wrote: Dear John sage-devel, [trimmed...] 1) Use autotools/libtools to build a shared libtachyon in a portable manner. Like you, I quite like the autoconf/automake/libool approach. But I was quite impressed with the number of targets that there was for Tachyon to build on different systems. Tacyhon built easily on both AIX and HP-UX as soon as I'd added the relevant bits in Sage's spkg-install to handle those operating systems. [...] However, there was nothing suitable for a 64-bit build on Solaris, so I had to add a target for that. I guess I should contact the author and let him know of this. I'm puzzled by this, there are actually a very large number of (something like 10) 64-bit Solaris targets in the regular Tachyon Make- arch file. Have you looked within the Make-arch file? I would be curious to know what you needed that wasn't there. I'm happy to share my pre-release sources for the next Tachyon so people can give me feedback and I can address any issues that linger here. Cheers, John I've no idea of what functionality of Tachyon is exposed in Sage. I've not used the program, but the web site has some pretty impressive looking demos. Dave -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? Dave -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, On Feb 6, 6:29 am, David Joyner wdjoy...@gmail.com wrote: Hi, I was also curious what portions of the Tachyon APIs are exposed in SAGE now, and whether it might be time to See http://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html Thanks. Can someone change the email address listed for me from the old one (jo...@megapixel.com) to the current one (john.st...@gmail.com)? update SAGE to be able to take advantage of various new Tachyon features such as ambient occlusion lighting and other improvements that may not be exposed in the current versions SAGE. This would be great. One reason when the Sage documentation is vague (see for example texfunchttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html#s...) is that the tachyon documentation is incomplete. More examples would be very useful. I'm working on that currently. I will try and prepare a more complete group of example scene files and supporting text in the docs for the next release. It would be cool to be able to map and image (eg, a file image of a Sage logo) onto an object (eg, a sphere) and put that over a mirrored plane. I remember trying to do that some time ago and getting stuck. Is that implemented? Yes, that's pretty easy to do. Have a look at lavablobs.dat in the tachyon/scenes directory for an old example of putting an image on a sphere in the Tachyon ASCII scene file format. Presumably SAGE can emit the necessary texturing parameters to do this as well. I would also like it to be easier to create animations and other surfaces, such as hyperbolic paraboloids, in tachyon. I know tachyon can be used as a viewer for hyperbolic paraboloids, eg sage: x,y,z = var(x,y,z) sage: p = implicit_plot3d(x^2-y^2-z,(x,-2,2),(y,-2,2),(z,-2,2), plot_points = 75) sage: p.show(viewer=tachyon) but can one add, for example shading and textures, to this as a tachyon object? It is definitely possible to shade and texture any geometry that you provide to Tachyon. I'm not familiar enough with SAGE to know what parts of the Tachyon API are exposed or not, but I'll begin looking at the docs and see what I learn. I would also be happy to have a look at your existing Tachyon code and see if I notice anything that might be added or improved if you can tell me where to look for it. Online, it is here:http://hg.sagemath.org/sage-main/file/f24ce048fa66/sage/plot/plot3d/t... In the Sage root directory, it is in devel/sage/sage/plot/plot3d/tachyon.py Hopefully Tom Boothby and Marshall Hampton will weigh in as well with suggestions. Thanks, I will start looking at the Python code there and see what I can learn. I am happy to provide interested parties with a copy of the bleeding edge version of the code if people want to give it a spin. Cheers, John -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
I've posted the latest test version of Tachyon here, for those that want to give it a spin. I'm still working on updating the docs, but I expect to have that done in the next two weeks. http://www.photonlimited.com/~johns/tachyon/files/alpha/ Cheers, John Stone On Feb 10, 10:30 pm, John Stone john.st...@gmail.com wrote: Hi, On Feb 6, 6:29 am, David Joyner wdjoy...@gmail.com wrote: Hi, I was also curious what portions of the Tachyon APIs are exposed in SAGE now, and whether it might be time to Seehttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html Thanks. Can someone change the email address listed for me from the old one (jo...@megapixel.com) to the current one (john.st...@gmail.com)? update SAGE to be able to take advantage of various new Tachyon features such as ambient occlusion lighting and other improvements that may not be exposed in the current versions SAGE. This would be great. One reason when the Sage documentation is vague (see for example texfunchttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html#s...) is that the tachyon documentation is incomplete. More examples would be very useful. I'm working on that currently. I will try and prepare a more complete group of example scene files and supporting text in the docs for the next release. It would be cool to be able to map and image (eg, a file image of a Sage logo) onto an object (eg, a sphere) and put that over a mirrored plane. I remember trying to do that some time ago and getting stuck. Is that implemented? Yes, that's pretty easy to do. Have a look at lavablobs.dat in the tachyon/scenes directory for an old example of putting an image on a sphere in the Tachyon ASCII scene file format. Presumably SAGE can emit the necessary texturing parameters to do this as well. I would also like it to be easier to create animations and other surfaces, such as hyperbolic paraboloids, in tachyon. I know tachyon can be used as a viewer for hyperbolic paraboloids, eg sage: x,y,z = var(x,y,z) sage: p = implicit_plot3d(x^2-y^2-z,(x,-2,2),(y,-2,2),(z,-2,2), plot_points = 75) sage: p.show(viewer=tachyon) but can one add, for example shading and textures, to this as a tachyon object? It is definitely possible to shade and texture any geometry that you provide to Tachyon. I'm not familiar enough with SAGE to know what parts of the Tachyon API are exposed or not, but I'll begin looking at the docs and see what I learn. I would also be happy to have a look at your existing Tachyon code and see if I notice anything that might be added or improved if you can tell me where to look for it. Online, it is here:http://hg.sagemath.org/sage-main/file/f24ce048fa66/sage/plot/plot3d/t... In the Sage root directory, it is in devel/sage/sage/plot/plot3d/tachyon.py Hopefully Tom Boothby and Marshall Hampton will weigh in as well with suggestions. Thanks, I will start looking at the Python code there and see what I can learn. I am happy to provide interested parties with a copy of the bleeding edge version of the code if people want to give it a spin. Cheers, John -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
On 2/6/11 12:40 AM, William Stein wrote: Hi, I have permission from the author of Tachyon to forward his message below to the Sage list. He's basically interested in whether there is _anything_ he could do to make Tachyon more useful for Sage. See below. I think it would be cool to be able to do some of the volumetric visualizations from Sage (e.g., transparent multi-colored fog, with opacity and color representing different scalars). It seems that Tachyon supported some volumetric capabilities, but I wasn't able to figure it out in the time I spent looking at it a while ago. Jason -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
If there was a simple API to map from a 3D point to a 2D point the rendered output, then it would be much easier to superimpose text ourselves. However, if it's pretty easy to add Hershey Roman font into Tachyon itself, this would be a wonderful and well-used addition. - Robert On Thu, Feb 10, 2011 at 8:22 PM, John Stone john.st...@gmail.com wrote: I've pondered adding text rendering as a built-in feature of Tachyon, but up to this point I have resisted due to the complexity involved. (whatever font set I would choose would undoubtably not be exactly the right thing for any particular usage). The best way to do this is usually to build the font code into the calling application, as it can be used with multiple renderers and the rendered images can be made to look exactly the same whether OpenGL, Tachyon, Renderman, POV-Ray, etc. This is what I've done in VMD, the molecular visualization tool I develop in my day job. In VMD, I use one of the public domain Hershey vector font sets, with two simple APIs, one generates OpenGL rendering commands, and the other is setup to be called to generate the vector font strokes on-the-fly by any rendering API one would want. Using this scheme, VMD generates line-based renderings within OpenGL, and uses sequences of connected cylinders and spheres in ray tracers or other renderers that don't have an exact equivalent of a line. Here are relevant VMD source files as examples: Hershey.h: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8h-source.html Hershey.C: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8C-source.html TachyonDisplayDevice.C (see the ::text method therein): http://www.ks.uiuc.edu/Research/vmd/doxygen/TachyonDisplayDevice_8C-source.html#l00153 I could add the Hershey Roman font I use in VMD into Tachyon pretty easily, but it might be an even better idea to build this into SAGE itself. What do others think? Cheers, John Stone john.st...@gmail.com On Feb 6, 3:11 am, Robert Bradshaw rober...@math.washington.edu wrote: IIRC, the ability to easily do text labels is something that is missing right now. It would be great to be able to attach some text to a point (we don't need shadows or anything fancy). We could probably even do this ourselves if there was an easy API to go from 3D point to 2D point in the output. - Robert On Sat, Feb 5, 2011 at 10:40 PM, William Stein wst...@gmail.com wrote: Hi, I have permission from the author of Tachyon to forward his message below to the Sage list. He's basically interested in whether there is _anything_ he could do to make Tachyon more useful for Sage. See below. -- Forwarded message -- From: John Stone jo...@ks.uiuc.edu Date: Tue, Feb 1, 2011 at 10:56 PM Subject: Feedback on Tachyon APIs used by SAGE, etc.. To: William Stein wst...@gmail.com Hi William, I'm in the process of doing a bunch of updating of the Tachyon header files and documentation and thought I'd send a quick ping. I was wondering if the SAGE project wants or needs anything changed or improved in the Tachyon APIs, since I'm already doing some significant improvements for other projects. I was also curious what portions of the Tachyon APIs are exposed in SAGE now, and whether it might be time to update SAGE to be able to take advantage of various new Tachyon features such as ambient occlusion lighting and other improvements that may not be exposed in the current versions SAGE. I would also be happy to have a look at your existing Tachyon code and see if I notice anything that might be added or improved if you can tell me where to look for it. Cheers, John Stone -- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: jo...@ks.uiuc.edu Phone: 217-244-3349 WWW:http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078 -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/sage-devel URL:http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: sage thoughts
Hi Bruno! On 11 Feb., 01:37, Bruno Le Floch blfla...@gmail.com wrote: You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. I don't see how this brings in both consistencies. Algebraic consistency requires gcd and lcm on QQ to have different outputs depending on whether QQ is seen a Field, a PID, a Quotient Field... Is there a clear way for the user to indicate which QQ he wants? I am sorry for the FUD that I spread in my earlier posts. Meanwhile people convinced me that it is indeed possible to have both consistencies. The point is: In a PID, the lcm of a and b is only defined up to a unit - it is only required that lcm(a,b) generates the intersection of the ideals generated by a and b. My mistake was: 1 is certainly the canonical choice of a generator of the ideal a\cap b (a,b non-zero); but that does not mean that it is the best return value of lcm(a,b)! So, if lcm(a,b) for a,b non-zero returns *any* non-zero element, then consistency from the category point of view is granted - lcm(1/2,1/4) = 42 is not wrong in QQ. But that freedom means: We can *in addition* achieve consistency with respect to sub-structures, namely by seeing QQ as a quotient field. Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] Re: sage thoughts
On Thu, 2011-02-10 at 22:57 -0800, Simon King wrote: Hi Bruno! On 11 Feb., 01:37, Bruno Le Floch blfla...@gmail.com wrote: You could have both consistencies. That depends on how you define gcd and lcm: - Quotient fields as described by Bruno. - Fields: zero if both elements are zero. A non-zero element otherwise (most fields would choose 1 here). - PID: a generator of the corresponding ideal. I don't see how this brings in both consistencies. Algebraic consistency requires gcd and lcm on QQ to have different outputs depending on whether QQ is seen a Field, a PID, a Quotient Field... Is there a clear way for the user to indicate which QQ he wants? I am sorry for the FUD that I spread in my earlier posts. Meanwhile people convinced me that it is indeed possible to have both consistencies. The point is: In a PID, the lcm of a and b is only defined up to a unit - it is only required that lcm(a,b) generates the intersection of the ideals generated by a and b. My mistake was: 1 is certainly the canonical choice of a generator of the ideal a\cap b (a,b non-zero); but that does not mean that it is the best return value of lcm(a,b)! So, if lcm(a,b) for a,b non-zero returns *any* non-zero element, then consistency from the category point of view is granted - lcm(1/2,1/4) = 42 is not wrong in QQ. But that freedom means: We can *in addition* achieve consistency with respect to sub-structures, namely by seeing QQ as a quotient field. Cheers, Simon Can you suggest an algorithm to implement this? Is there an agreed-upon answer (i.e., not 42?) Tim Daly -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Is the patchbot broken?
Hi Robert, On 10 Feb., 21:10, Robert Bradshaw rober...@math.washington.edu wrote: ... Are you perhaps working of a more recent alpha? (This could answer the previous question as well, though the startuptime test is still somewhat flakey too.) Last night, I built sage-4.6.2.alpha4 from sources. My patch for #8800 (still) cleanly applies. So, I really don't see why the patchbot keeps complaining. In other words, if someone with a preference for algebra wants to help fix many bugs at once, go ahead... Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org