[sage-devel] Re: sage thoughts

2011-02-09 Thread Simon King
PPS:

On 10 Feb., 08:34, Simon King  wrote:
> ...
> But I think the problem here is not coercion but the "right" (or at
> least reasonable) choice of a definition. What would textbooks say?

I should add: I do believe that the choice is already made and the
choice is fine (see Tim's and William's posts above). Only, lcm(2/1,4)
should not raise an error but use coercion (similar to what gcd(2/1,4)
does).

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: sage thoughts

2011-02-09 Thread Simon King
PS:

On 9 Feb., 15:57, luisfe  wrote:
> There is also something wrong with lcm for rationals
>
> sage: a = 2/3 # rational
> sage: b = 1    # integer
> sage: gcd(a,b)
> 1
> sage: lcm(a,b)
> ...
> TypeError

I would agree that this is a bug. I think it would be just consequent
to first coerce a and b before computing their gcd or lcm.


> Also, I am little surprised about the definition of lcm here. I would
> expect, maybe naively, that the lcm of 1/3 and 1/2 is 1/6. That is:
> lcm(numerators) / lcm(denominators)
> Although the current behavior is well documented. Thinking a little
> bit the lcm seems to be defined as the smallest 'integer' multiple of
> 1/3 and 1/2. The generator of the intersection of the ZZ-modules
> ZZ[1/3] and ZZ[1/2]. So it makes sense...

Ah, yet another definition with yet another answer for the rationals.
So, now we have at least six different ways to extend the common
notion of lcm from ZZ to QQ:

lcm(1/4,1/6) = 0  (infimum over positive multiples)

lcm(1/4,1/6) = 1/4   (infimum over positive multiples with factor at
least one)

lcm(1/4,1/6) = 1/12 (lcm(numerators) / lcm(denominators))

lcm(1/4,1/6) = 1/2   (infimum over positive multiples with integer
factor)

lcm(1/4,1/6) = 1  (minimal positive multiple that is an integer)

lcm(1/4,1/6) = 1/2   (lcm(numerators)/gcd(denominators))

... [add further definitions here]

Tough choice!
At least, the last one has the property gcd(x,y)*lcm(x,y)==x*y,
assuming that we also define gcd(a/b,c/d) = gcd(a,c)/lcm(b,d).

I agree with Richard Fateman that in this case one shouldn't simply
decide by counting "+1" (isn't there a board for that purpose?).
But I think the problem here is not coercion but the "right" (or at
least reasonable) choice of a definition. What would textbooks say?

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: sage thoughts

2011-02-09 Thread Simon King
Hi all!

On 9 Feb., 15:57, luisfe  wrote:
> On Feb 9, 9:46 am, "D. S. McNeil"  wrote:
>
> > >> (1) gcd is broken.    http://trac.sagemath.org/sage_trac/ticket/10459
> > [..]
> > > I'm personally OK either way with this.
>
> > IMO a*b = gcd(a,b)*lcm(a,b) should be maintained wherever possible.

What does "Wherever possible" mean in an ordered ring, R? In
particular, is it possible for R=QQ? Or even for R=ZZ?

If I am not mistaken, lcm(x,y) could be defined as
  inf {x*m | m in R, x*m>0, there is n in R with x*m==y*n}(1)
At least, that definition matches the situation in ZZ (note that
lcm(-2,-2) = 2).
Or is there any reason to have a minimum rather than an infimum?

On the other hand, what is the notion of a "multiple" of x? Is it
simply x*m for any m in R? Or is it rather x*m for any abs(m)>=1 in R?
In that case, definition (1) above became
  inf {x*m | m in R, abs(m)>=1, x*m>0, there is n in R with abs(n)>=1
and x*m==y*n}  (2)
Again, it's one definition that matches the situation in ZZ.

Now, consider R=QQ.
According to definition (1), the least common multiple of 1/1 and 1/1
is: Zero! 'Cause any positive rational is a multiple of 1/1, and the
infimum is zero.
But according to definition (2), the least common multiple of 1/1 and
1/1 is: 1/1.

Perhaps there are other possible ways to extend the notion of lcm from
ZZ to any ordered ring. I could imagine that different textbooks use
slightly different ways of defining lcm and gcd in ZZ, extending to QQ
differently.

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?

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

2011-02-09 Thread William Stein
On Wed, Feb 9, 2011 at 10:46 PM, daly  wrote:
> On Wed, 2011-02-09 at 22:18 -0800, rjf wrote:
>> You say,
>> > gcd(2/1,4) returns 1 "for simplicity" (!), because 2/1 is a rational.
>> > This is shockingly silly.
>>
>> 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. You could argue that since you can coerce 2/1, you
>> should.
>>
>> That's sometimes OK, but not always.
>>
>> 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?
>>
>> What about 1X1 matrices?
>>
>> Is 1^0  the same as 1^0.0  or 1.0^0  or 1.0^0.0?  Do you perhaps wish
>> to consider/dismiss
>> the existence of number systems with signed zeros (IEEE floating-point
>> standard) on the
>> grounds that -0 = +0,  [true, for numerical comparison] and therefore
>> there should be
>> only a single zero?
>>
>> While I don't know the exact formulation of this GCD problem, the
>> issue of
>> implicit coercion is one of the troubling sore spots in a system
>> design, and should not
>>  be decided by counting up casual +1 votes.
>>
>> I think the Axiom people might have thought more about it than others.
>>
>
> It is a question of domains. In Axiom you can specify the domains.
>
> 2/1 is a Fraction(Integer) aka rational
> 4 is an Integer
> (2/1)::Integer => 2 where 2 is an Integer.
> 4::Fraction(Integer) is a Fraction(Integer)
>
> So there are several cases:
> gcd((2/1),4::Fraction(Integer)) => 1 of type Fraction(Integer)
> gcd((2/1)::Integer,4))          => 2 of type PositiveInteger
> gcd(2/1,4)                      => 1 of type Fraction(Integer)
> gcd(2,4)                        => 2 of type PositiveInteger
> gcd(2,4::Fraction(Integer))     => 1 of type Fraction(Integer)
>
> Tim Daly

Thanks.  The above is _precisely_ what Sage currently does:


sage: a = gcd(2/1,QQ(4)); print a, type(a)
1 
sage: a = gcd(ZZ(2/1), 4); print a, type(a)
2 
sage: a = gcd(2/1, 4); print a, type(a)
1 
sage: a = gcd(2, 4); print a, type(a)
2 
sage: a = gcd(2, QQ(4)); print a, type(a)
1 

I personally see no *harm* in allowing gcd(a,b) to be a different
choice of generator for the ideal (a,b), which is all that the OP is
requesting.   PARI does this, and it is definitely very useful there.
 Always returning 1 (or 0) in the rationals isn't very useful.

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

2011-02-09 Thread daly
On Wed, 2011-02-09 at 22:18 -0800, rjf wrote:
> You say,
> > gcd(2/1,4) returns 1 "for simplicity" (!), because 2/1 is a rational.
> > This is shockingly silly.
> 
> 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. You could argue that since you can coerce 2/1, you
> should.
> 
> That's sometimes OK, but not always.
> 
> 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?
> 
> What about 1X1 matrices?
> 
> Is 1^0  the same as 1^0.0  or 1.0^0  or 1.0^0.0?  Do you perhaps wish
> to consider/dismiss
> the existence of number systems with signed zeros (IEEE floating-point
> standard) on the
> grounds that -0 = +0,  [true, for numerical comparison] and therefore
> there should be
> only a single zero?
> 
> While I don't know the exact formulation of this GCD problem, the
> issue of
> implicit coercion is one of the troubling sore spots in a system
> design, and should not
>  be decided by counting up casual +1 votes.
> 
> I think the Axiom people might have thought more about it than others.
> 

It is a question of domains. In Axiom you can specify the domains.

2/1 is a Fraction(Integer) aka rational
4 is an Integer
(2/1)::Integer => 2 where 2 is an Integer.
4::Fraction(Integer) is a Fraction(Integer) 

So there are several cases:
gcd((2/1),4::Fraction(Integer)) => 1 of type Fraction(Integer)
gcd((2/1)::Integer,4))  => 2 of type PositiveInteger
gcd(2/1,4)  => 1 of type Fraction(Integer)
gcd(2,4)=> 2 of type PositiveInteger
gcd(2,4::Fraction(Integer)) => 1 of type Fraction(Integer)

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: sage thoughts

2011-02-09 Thread rjf
You say,
> gcd(2/1,4) returns 1 "for simplicity" (!), because 2/1 is a rational.
> This is shockingly silly.

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. You could argue that since you can coerce 2/1, you
should.

That's sometimes OK, but not always.

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?

What about 1X1 matrices?

Is 1^0  the same as 1^0.0  or 1.0^0  or 1.0^0.0?  Do you perhaps wish
to consider/dismiss
the existence of number systems with signed zeros (IEEE floating-point
standard) on the
grounds that -0 = +0,  [true, for numerical comparison] and therefore
there should be
only a single zero?

While I don't know the exact formulation of this GCD problem, the
issue of
implicit coercion is one of the troubling sore spots in a system
design, and should not
 be decided by counting up casual +1 votes.

I think the Axiom people might have thought more about it than others.

-- 
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] Singular in 4.6.2.alpha4 doesn't build on Ubuntu 11.04 alpha 2

2011-02-09 Thread Dan Drake
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_raw.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_raw.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_raw.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_raw.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?)

Thanks,

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


singular-3-1-1-4.p3.log.gz
Description: Binary data


signature.asc
Description: Digital signature


[sage-devel] Re: Bundle different objects

2011-02-09 Thread Jason Grout

On 2/9/11 9:18 PM, Robert Bradshaw wrote:

On Wed, Feb 9, 2011 at 6:43 PM, Dox  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] Bundle different objects

2011-02-09 Thread Robert Bradshaw
On Wed, Feb 9, 2011 at 6:43 PM, Dox  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.)

- Robert

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

2011-02-09 Thread Gagan Sekhon
I would be interested. I have transferred all Cremona tables into
mongodb and am currently am try to redo code in sage to make it
compatible. There are a few more things related to elliptic curves I
am working on, so I will have plenty to work on during March.
Gagan

On Feb 8, 8:02 pm, William Stein  wrote:
> On Tue, Feb 8, 2011 at 5:21 PM, William Stein  wrote:
> > On Tue, Feb 8, 2011 at 5:20 PM, William Stein  wrote:
> >> Hi,
>
> >> If you're interested in coming to Seattle during our spring break
> >> (when campus is pretty empty and the weather is nice), it looks highly
> >> likely I'll be able to run a big Sage Days workshop.
>
> > Some relevant information is that our Spring Break is March 21-25, 2010.
>
> It's been pointed out to me that I should have written "2011", of course.
>
> Also, somebody asked about topics, to which I responded: "Fixing bugs,
> Elliptic curves over Q(sqrt(5)), the notebook, numerical
> computation, ipython, etc  It will mainly depends on who is available.
>  We have also contacted some key people in the numpy/scipy community."
>
>
>
>
>
>
>
> >  http://wiki.sagemath.org/days29
>
> >  -- William
>
> >> Please send me
> >> an email (wst...@gmail.com) if you're very interested in the
> >> possibility of attending (funding, size, etc., is still unclear), or
> >> even to nominate other people you think have been really contributing
> >> to Sage.    Funded participants will have all their expenses covered
> >> (all travel and lodging).
>
> >>  -- William
>
> >> --
> >> William Stein
> >> Professor of Mathematics
> >> University of Washington
> >>http://wstein.org
>
> > --
> > William Stein
> > Professor of Mathematics
> > University of Washington
> >http://wstein.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://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


[sage-devel] Bundle different objects

2011-02-09 Thread Dox
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!

Thank you all
;-)

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


Re: [sage-devel] distributed reviews for large patches (e.g. multivariate power series)

2011-02-09 Thread Nicolas M. Thiery
On Tue, Feb 08, 2011 at 06:24:46AM -0800, Niles wrote:
> So that my work and theirs can be fruitful, I have a suggestion for
> distributing the review effort.  I know there are several other large
> patches languishing in need of review, and maybe the same idea can
> help them too.
> 
> The suggestion is that the patch author provide a list of review
> items, which can be positively reviewed independently.  One of these
> should be "The items on this list constitute a complete review", and
> other obvious items are "All code is documented and doctested
> thoroughly; documentation builds without error or warning" and "Sage
> passes all doctests with this patch" (the patch buildbot can probably
> take care of this one).  Other items on the list may be more patch-
> specific.  For example, here is the list of review items I've proposed
> for #1956 (implement multivariate truncated power series arithmetic):

+1.

Just for the record, I had used a similar procedure for the category
patch (and its many dependencies), using a wiki page:

http://trac.sagemath.org/sage_trac/wiki/CategoriesRoadMap

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
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: FAQ suggestion: I'm a programmer, how can I contribute to Sage?

2011-02-09 Thread Dr. David Kirkby

On 02/ 9/11 07:21 AM, Emil Widmann wrote:

Is by "Sage-Windows port" meaning a "native" Windows application rather than
something based on Cygwin?


With Sage - Windows port I was meant  the Cygwin port. Or at least any
port that is  very easy to install (Windows Installer) and runs with
comparable performance to a Cygwin version inside the usual Windows
environment (no dual boot system, no virtual machine).


In that case, I don't think there can be any argument that doing this should be 
a Sage goal. If we don't get such a port complete, we are losing a lot of 
potential users.


We also really need a plan of how we might achieve this goal. I'm willing to 
work on this as soon as Sage runs well on Solaris/OpenSolaris as 64-bit - 
currently it is only running 32-bit.


I've not been very active on Sage recently - my Dad has been ill, then died in 
the middle of January. He was cremated on Monday, so I have had other things on 
my mind and also need to sort out his estate. So Sage has to take a back-seat 
just now.


Looking at some of the outstanding Cygin tickets

http://trac.sagemath.org/sage_trac/wiki/CygwinPort

they are very trivial to solve. For example

http://trac.sagemath.org/sage_trac/ticket/9172

I've just posted a solution to #9172, though I've not created a patch.

Also #9170 looks highly likely to be easily solved.


#9165 (lcalc) is a bit more worrying, as I know the Sun compiler will not 
compile lcalc and gcc gives compiler warnings when compiling lcalc. The fact it 
gives errors on Cygwin does not totally surprise me.


--
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: Sage included in Top 25 Open Source Software Apps for Engineers

2011-02-09 Thread William Stein
On Wed, Feb 9, 2011 at 7:02 AM, Alba Collazo  wrote:
> Hello William
>
> I stumbled across Sage and must say that I found the content to be quite
> enjoyable. I also wanted to let you know about an article we've posted here
> at Blogineering which is titled, "Top 25 Open Source Software Apps for
> Engineers." Given the subject matter, I felt  that you and your readers
> might find it to be an interesting post. If you have any feedback on it, I'd
> certainly love to hear from you --
> http://onlineengineeringprograms.org/2011/top-25-open-source-software-apps-for-engineers/


Thanks!

   -- William

>
>
> Best,
>
> Alba Collazo
>
> Co-founder, Blogineering
>
> __ Information from ESET NOD32 Antivirus, version of virus signature
> database 5858 (20110209) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>



-- 
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] sage thoughts

2011-02-09 Thread Willem Jan Palenstijn
On Wed, Feb 09, 2011 at 04:46:52PM +0800, D. S. McNeil wrote:
> > Could you post an example [re: my whitespace issues --ed] to nail down
> > exactly what you're talking about?
> 
> sage: s = 'for i in range(3):\n' + ' '*4 + 'print i\n'
> sage: # add extra space, such as can often happen in practice
> sage: # when writing code, and I can't see it, because, well,
> sage: # it's whitespace..
> sage: s = s + '\n' + ' '*4 + '\n'
> sage:
> sage: fname = 'whitespace_pedantic.sage'
> sage: with open(fname,'w') as fp:
> : fp.write(s)
> :
> sage: # Python is happy
> sage: execfile(fname)
> 0
> 1
> 2
> sage: # Sage is not
> sage: load(fname)
> 
>File "", line 5
> 
>  ^
> SyntaxError: invalid syntax

I think this should be fixed by trac ticket #9363 (merged in
sage-4.6.2.alpha1).

-Willem Jan

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

2011-02-09 Thread luisfe


On Feb 9, 9:46 am, "D. S. McNeil"  wrote:
> >> (1) gcd is broken.http://trac.sagemath.org/sage_trac/ticket/10459
> [..]
> > I'm personally OK either way with this.
>
> IMO a*b = gcd(a,b)*lcm(a,b) should be maintained wherever possible.
> There are pari codes whose direct Sage equivalent silently breaks for
> this reason, and I can't bring myself to admit it to my pari-speaking
> friends. :^)

+1 to this. I am interested on this ticket. But I have zero time to
spend developing sage right now.

There is also something wrong with lcm for rationals

sage: a = 2/3 # rational
sage: b = 1# integer
sage: gcd(a,b)
1
sage: lcm(a,b)
...
TypeError
sage: b = QQ(1)
sage: lcm(a,b)
2
sage: a.lcm(b)
2
sage: a._lcm(b)
1

So, it seems that Rational.lcm has bugs. Please someone correct me if
I am mistaken, but Rational.lcm should not expect that the other term
is itself a rational. For this assumption we have Rational._lcm

Also, I am little surprised about the definition of lcm here. I would
expect, maybe naively, that the lcm of 1/3 and 1/2 is 1/6. That is:
lcm(numerators) / lcm(denominators)
Although the current behavior is well documented. Thinking a little
bit the lcm seems to be defined as the smallest 'integer' multiple of
1/3 and 1/2. The generator of the intersection of the ZZ-modules
ZZ[1/3] and ZZ[1/2]. So it makes sense...

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

2011-02-09 Thread Niles
Hi @DSM!

On Feb 9, 4:53 am, koffie  wrote:
> Hej Doug,
>
> Nice list of bugs. I was wondering, might you be interested in
> becoming a sage developer too?

+1

It's *really* not that hard :)  I'd be happy to help you get started
too, and in particular you could let me know when you need a reviewer
for #3 or #2.

The Developer's Guide is a great place to start -- I would make two
modifications for someone who's fairly comfortable with writing code
already:  First, start with Mercurial queues right away:

http://www.sagemath.org/doc/developer/walk_through.html#being-more-efficient-mercurial-queues

The description makes it sound too hard to be worthwhile for a new
contributor, but I think they're more straightforward than making
clones of the entire sage library.  Just remember to start a new patch
('hg qnew ') *before* you start making changes -- it's
easier that way:

http://www.sagemath.org/doc/developer/walk_through.html#creating-your-own-patch-with-queues

Second, I wouldn't bother with installing a separate "development
version" of Sage.  Mercurial queues let you revert all of your changes
in bulk, without losing them, and the kinds of things you'll be
starting with are relatively straightforward, so it's unlikely that
you'll render your Sage install unusable and irreparable.  If you do,
*then* install a second version of Sage :)

Final note:  to use Mercurial queues, you'll need the following in
"~/.hgrc" (update for your information, but an email address is not
required).  This is explained earlier on the page "Walking Through the
Development Process", but not entirely in the section "Getting Started
with Mercurial Queues".

[ui]
username = Carl Friedrich Gauss 

[extensions]
# Enable the Mercurial queue extension.
hgext.mq =

enjoy!
Niles

p.s.  I hope I'm not duplicating or contradicting too much of what
Maarten might have already told you -- if so, just ignore my
comments :)

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

2011-02-09 Thread koffie
Hej Doug,

Nice list of bugs. I was wondering, might you be interested in
becoming a sage developer to? It's really not that hard, and it sounds
to me that if you knew how to edit the source code of sage you would
be able to fix some of these bugs yourself, and become one of the
volunteers who makes sage better. And the advantage is by being a
developer you are the first one to be able to use the fixed or
improved code!
If you are willing to learn how to contribute code to sage, I'm also
willing to aid you in guiding you trough the developement process. The
feature request in number 3 sounds like one which is really doable. If
you are interested I could teach you how to create and submit patches
to trac while fixing this issue.
Just send me an e-mail.

Kind regards,
Maarten Derickx

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

2011-02-09 Thread David Roe
> >> (1) gcd is broken.http://trac.sagemath.org/sage_trac/ticket/10459
> [..]
> > I'm personally OK either way with this.
>
> IMO a*b = gcd(a,b)*lcm(a,b) should be maintained wherever possible.
> There are pari codes whose direct Sage equivalent silently breaks for
> this reason, and I can't bring myself to admit it to my pari-speaking
> friends. :^)
>

+1.

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

2011-02-09 Thread D. S. McNeil
>> (1) gcd is broken.    http://trac.sagemath.org/sage_trac/ticket/10459
[..]
> I'm personally OK either way with this.

IMO a*b = gcd(a,b)*lcm(a,b) should be maintained wherever possible.
There are pari codes whose direct Sage equivalent silently breaks for
this reason, and I can't bring myself to admit it to my pari-speaking
friends. :^)

> Could you post an example [re: my whitespace issues --ed] to nail down 
> exactly what you're talking about?

sage: s = 'for i in range(3):\n' + ' '*4 + 'print i\n'
sage: # add extra space, such as can often happen in practice
sage: # when writing code, and I can't see it, because, well,
sage: # it's whitespace..
sage: s = s + '\n' + ' '*4 + '\n'
sage:
sage: fname = 'whitespace_pedantic.sage'
sage: with open(fname,'w') as fp:
: fp.write(s)
:
sage: # Python is happy
sage: execfile(fname)
0
1
2
sage: # Sage is not
sage: load(fname)

   File "", line 5

 ^
SyntaxError: invalid syntax


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