[sage-devel] trouble running n() on matrices

2008-04-08 Thread Dan Drake
Hello all,

I'm running into problems with coercing to complexes or reals in
matrices:

  sage: d = matrix([[3, 0],[0,sqrt(2)]])
  sage: b = matrix([[1, -1], [2, 2]])
  sage: e = b * d * b.inverse(); e

  [1/sqrt(2) + 3/2 3/4 - 1/(2*sqrt(2))]
  [3 - sqrt(2) 1/sqrt(2) + 3/2]

and when I try to run n() on the matrix e, I get:

  sage: e.n()  # or n(e)
  [snip]
  type 'exceptions.TypeError': unable to coerce to a ComplexNumber

but I can run n() on all the entries of e:

  sage: n(e[0,0])
  2.20710678118655
  sage: n(e[1,0])
  1.58578643762690
  sage: n(e[1,1])
  2.20710678118655
  sage: n(e[0,1])
  0.396446609406726

Also, I can't run .n() on the matrix b, even though it's an integer
matrix!

  sage: parent(b)
  Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
  sage: b.n()
  [same as before]
  type 'exceptions.TypeError': unable to coerce to a ComplexNumber

Yikes! It can't coerce integers into complexes! But in other situations,
there's no trouble:

  sage: n(5)
  5.00
  sage: parent(sqrt(2))
  Symbolic Ring
  sage: n(sqrt(2))
  1.41421356237310

It seems clear that when I have a matrix with expressions like
1/sqrt(2) + 3/2 and I run n() on it, I want the obvious floating point
approximations.

Am I going about this wrong? Is this not a correct use of matrices? Or
is it a coercion bug? Any help is much appreciated.

Dan

-- 
---  Dan Drake [EMAIL PROTECTED]
-  KAIST Department of Mathematical Sciences
---  http://math.kaist.ac.kr/~drake


signature.asc
Description: Digital signature


[sage-devel] Re: class variables in cython classes

2008-04-08 Thread Simon King

Dear Jason,

On Apr 7, 7:34 pm, Jason Grout [EMAIL PROTECTED] wrote:
 Thanks for the explanation.  The issue came up when I wanted to just do
 M=self.transpose() or M=self, depending on if the user wanted right or
 left action computations (e.g., right vs. left kernels).  However, then
 calls to M._nrows (which used to be calls to self._nrows) don't work.

What about cdefining M? If self is of type FooType, then the
following should work
 cdef FooType M
 M=self   # or M=self.transpose() depending on what the user wants
and if FooType has a cython attribute _nrows then M._nrows should
work.

However i am not sure if this is possible in your situation, because
as much as i understand there are many matrix types. So, i don't know
what FooType should be here.

Cheers
 Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Google funds Sage

2008-04-08 Thread David Joyner
This is great news! My opinion of google was good before but this
really improves it. Thanks very much for putting this together. It will
be very useful for coding theory.

On Tue, Apr 8, 2008 at 9:05 AM, William Stein [EMAIL PROTECTED] wrote:
 Hi,

  I posted the following on my blog, but am reposting this is an email
  to sage-devel, since it's important
  for Sage developers to know about.

  Today Chris DiBona (open source programs manager at Google) fully
  funded a proposal [1] that some students and I put together to carry
  out four Sage development projects this summer (2008):

 * Mike Hansen (UCSD): Implement combinatorial species in Sage.
  This will provide a backend to handle a wide range of new
  combinatorial objects with minimal effort.

 * Gary Furnish (Utah): Implement new optimized symbolic
  manipulation code in Cython. This will greatly speed up symbolic
  computation in Sage, and reduce Sage's dependence on Maxima.

 * Robert Miller (UW): Implement fast code for permutation groups
  and backtracking algorithms. This is needed for general applications
  to graph and code automorphism groups computations, and can be used to
  exhaustively generate isomorphism class representatives of a wide
  class of mathematical objects.

 * Yi Qiang (UW): Further document, improve the usability of, and
  provide numerous real world examples of distributed computing with
  Sage. This will greatly help in applications of Sage to research that
  involve parallel computation.

  This funding is not part of the Google Summer of Code (the projects
  above do not fit with any of the mentoring organizations), but is
  instead I hope part of more longterm support by Google for the Sage
  project.

  [1] http://wstein.org/grants/google08/google.pdf

  --
  William Stein
  Associate Professor of Mathematics
  University of Washington
  http://wstein.org

  


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Google funds Sage

2008-04-08 Thread William Stein
Hi,

I posted the following on my blog, but am reposting this is an email
to sage-devel, since it's important
for Sage developers to know about.

Today Chris DiBona (open source programs manager at Google) fully
funded a proposal [1] that some students and I put together to carry
out four Sage development projects this summer (2008):

* Mike Hansen (UCSD): Implement combinatorial species in Sage.
This will provide a backend to handle a wide range of new
combinatorial objects with minimal effort.

* Gary Furnish (Utah): Implement new optimized symbolic
manipulation code in Cython. This will greatly speed up symbolic
computation in Sage, and reduce Sage's dependence on Maxima.

* Robert Miller (UW): Implement fast code for permutation groups
and backtracking algorithms. This is needed for general applications
to graph and code automorphism groups computations, and can be used to
exhaustively generate isomorphism class representatives of a wide
class of mathematical objects.

* Yi Qiang (UW): Further document, improve the usability of, and
provide numerous real world examples of distributed computing with
Sage. This will greatly help in applications of Sage to research that
involve parallel computation.

This funding is not part of the Google Summer of Code (the projects
above do not fit with any of the mentoring organizations), but is
instead I hope part of more longterm support by Google for the Sage
project.

[1] http://wstein.org/grants/google08/google.pdf

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: multivariate factoring - use maxima ?

2008-04-08 Thread parisse

 Just because an algorithm is probabilistic
 doesn't mean it necessarily gives wrong answers.  By the way, see

  http://www-fourier.ujf-grenoble.fr/~parisse/publi/gcdheu.pdf

 which is I think a paper that proves correctness of the algorithm
 we're talking about.  (I've not carefully read the above short
 paper, so I'm not vouching for it though.)


More precisely it fills a little gap in the original proof of the
correctness of the gcdheu algorithm for multivariate polynomials, and
extends the coefficients from Z to Z[i].
Gcdheu is just one of about 4 main algorithms for GCD: ezgcd, modular
(with a sparse variant), gcdheu, subresultant. Giac implements all of
them, gcdheu being used for small problems. I have just created a
benchmark page with Fermat tests:
http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
follow the benchmark link.
It seems giac is faster than maxima (around 5 to 10 times on these
tests), I do not have access to magma which is most probably another
factor of 10 * faster.
Sage may of course decide to implement it's own algorithms, but as
Roman Pearce said, it is a large piece of code to write and moreover
test. Why not integrate giac and help me improve giac code instead?
There are more interesting piece of codes to write, e.g. bivariate
factorization (which would improve giac multivariate factorization),
or absolute factorization over C. And once there is a link between
sage and giac, sage could benefit from all the calculus code of giac
(series, integration, etc.) which I believe is not the main interest
of Sage developers. I would of course contribute to such a link, but I
do not have time to do all the work myself.

B. Parisse

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: multivariate factoring - use maxima ?

2008-04-08 Thread parisse

 Just because an algorithm is probabilistic
 doesn't mean it necessarily gives wrong answers.  By the way, see

  http://www-fourier.ujf-grenoble.fr/~parisse/publi/gcdheu.pdf

 which is I think a paper that proves correctness of the algorithm
 we're talking about.  (I've not carefully read the above short
 paper, so I'm not vouching for it though.)

More precisely it fills a little gap in the proof of correctness for
multivariate polynomials and extends the coefficients from Z to Z[i].
Gcdheu is one of about 4 main algorithms (ezgcd, gcdheu, modular with
sparse and dense variants, subresultant), all implemented in Giac.
http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
I have added a benchmark link with Fermat gcd tests, giac seems 5 to
10 * faster than maxima. I don't have magma, it is most probably
another factor of 10 * faster.
Sage developers may of course decide to write their own gcd
algorithms, but that's a large piece of code to write and test. Why
not make a link to giac (which is a C++ library) instead? Sage and
giac could then benefit from improvements and more interesting piece
of code could be written, like bivariate factorization (which would
improve giac multivariate factorization) or absolute factorization
over C. Moreover, sage could benefit from the calculus code of giac
(series, integration, etc.). I would be ready to contribute to write
such a link, but I would need help on the sage side, I don't know
python at all.

B. Parisse
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Google funds Sage

2008-04-08 Thread Chris Chiasson

Perhaps one day I will learn to spell congratulations.

On Apr 8, 11:58 am, Chris Chiasson [EMAIL PROTECTED] wrote:
 That is really positive and impressive, on both the parts of Google 
 Sage (and the people behind them). Congratualtions.

 On Apr 8, 8:05 am, William Stein [EMAIL PROTECTED] wrote:

  Hi,

  I posted the following on my blog, but am reposting this is an email
  to sage-devel, since it's important
  for Sage developers to know about.

  Today Chris DiBona (open source programs manager at Google) fully
  funded a proposal [1] that some students and I put together to carry
  out four Sage development projects this summer (2008):

  * Mike Hansen (UCSD): Implement combinatorial species in Sage.
  This will provide a backend to handle a wide range of new
  combinatorial objects with minimal effort.

  * Gary Furnish (Utah): Implement new optimized symbolic
  manipulation code in Cython. This will greatly speed up symbolic
  computation in Sage, and reduce Sage's dependence on Maxima.

  * Robert Miller (UW): Implement fast code for permutation groups
  and backtracking algorithms. This is needed for general applications
  to graph and code automorphism groups computations, and can be used to
  exhaustively generate isomorphism class representatives of a wide
  class of mathematical objects.

  * Yi Qiang (UW): Further document, improve the usability of, and
  provide numerous real world examples of distributed computing with
  Sage. This will greatly help in applications of Sage to research that
  involve parallel computation.

  This funding is not part of the Google Summer of Code (the projects
  above do not fit with any of the mentoring organizations), but is
  instead I hope part of more longterm support by Google for the Sage
  project.

  [1]http://wstein.org/grants/google08/google.pdf

  --
  William Stein
  Associate Professor of Mathematics
  University of Washingtonhttp://wstein.org
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: trouble running n() on matrices

2008-04-08 Thread David Roe

If you take a look at the source code for n(), you'll see that the
first thing that it does is to try calling numerical_approx(prec) on
the object, and then tries coercing to real or complex fields.  So the
solution is to write a method numerical_approx(prec) in the matrix
base class that tries to numerically approximate the entries and make
a new matrix out of them.

This is now ticket 2857.
David

On Tue, Apr 8, 2008 at 2:32 AM, Dan Drake [EMAIL PROTECTED] wrote:
 Hello all,

  I'm running into problems with coercing to complexes or reals in
  matrices:

   sage: d = matrix([[3, 0],[0,sqrt(2)]])
   sage: b = matrix([[1, -1], [2, 2]])
   sage: e = b * d * b.inverse(); e

   [1/sqrt(2) + 3/2 3/4 - 1/(2*sqrt(2))]
   [3 - sqrt(2) 1/sqrt(2) + 3/2]

  and when I try to run n() on the matrix e, I get:

   sage: e.n()  # or n(e)
   [snip]
   type 'exceptions.TypeError': unable to coerce to a ComplexNumber

  but I can run n() on all the entries of e:

   sage: n(e[0,0])
   2.20710678118655
   sage: n(e[1,0])
   1.58578643762690
   sage: n(e[1,1])
   2.20710678118655
   sage: n(e[0,1])
   0.396446609406726

  Also, I can't run .n() on the matrix b, even though it's an integer
  matrix!

   sage: parent(b)
   Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
   sage: b.n()
   [same as before]
   type 'exceptions.TypeError': unable to coerce to a ComplexNumber

  Yikes! It can't coerce integers into complexes! But in other situations,
  there's no trouble:

   sage: n(5)
   5.00
   sage: parent(sqrt(2))
   Symbolic Ring
   sage: n(sqrt(2))
   1.41421356237310

  It seems clear that when I have a matrix with expressions like
  1/sqrt(2) + 3/2 and I run n() on it, I want the obvious floating point
  approximations.

  Am I going about this wrong? Is this not a correct use of matrices? Or
  is it a coercion bug? Any help is much appreciated.

  Dan

  --
  ---  Dan Drake [EMAIL PROTECTED]
  -  KAIST Department of Mathematical Sciences
  ---  http://math.kaist.ac.kr/~drake

 -BEGIN PGP SIGNATURE-
  Version: GnuPG v1.4.6 (GNU/Linux)

  iD8DBQFH+xGBr4V8SljC5LoRAmTfAJ9+otZSqPbrD3UjUYsnu6eB5I7rRQCeOnWl
  g/ob45B+hjZ6mNjKC0a1T9I=
  =tjOf
  -END PGP SIGNATURE-



--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: trouble running n() on matrices

2008-04-08 Thread Nick Alexander

On 8-Apr-08, at 10:50 AM, David Roe wrote:


 If you take a look at the source code for n(), you'll see that the
 first thing that it does is to try calling numerical_approx(prec) on
 the object, and then tries coercing to real or complex fields.  So the
 solution is to write a method numerical_approx(prec) in the matrix
 base class that tries to numerically approximate the entries and make
 a new matrix out of them.

Could this be a bit more general?  There are other things one wants  
to do that are similar, such as matrix.real() and matrix.imag(), or  
matrix.abs() for real, imaginary, and absolute values of the entries  
respectively.  It sounds like we want a map operator for a lot of  
datatypes.

Nick

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: multivariate factoring - use maxima ?

2008-04-08 Thread Mike Hansen

  I have added a benchmark link with Fermat gcd tests, giac seems 5 to
  10 * faster than maxima. I don't have magma, it is most probably

 another factor of 10 * faster.

I think that comparison with Magma is a little optimistic, especially
in the modular case.

http://www-fourier.ujf-grenoble.fr/~parisse/giac/benchmarks/gcd_timings
http://magma.maths.usyd.edu.au/users/allan/gcdcomp.html

--Mike

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] fractional ideals

2008-04-08 Thread Alex Ghitza

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi folks,

On Sunday we had an interesting discussion on #sage-devel about the
current implementation of fractional ideals in Sage.  This was spurred
mainly by #821, but went beyond the issues in that ticket.  I am going
to try to summarize the main points of the discussion, first so that we
have a record of it, and also so it can continue and we can see what we
can/should do about it.

1. At the moment, NumberFieldFractionalIdeal inherits from
Ideal_generic, which David Harvey pointed out is *very bad*, since
fractional ideals are *not ideals*.  Yes, the terminology is confusing,
but we don't have the luxury of convincing Kummer or whoever came up
with it that it should be changed.

2. Another sketchy thing is that for a number field K, the method
ideal() overrides the ring ideal method and returns 0 or a fractional
ideal.  Even if the objection from point 1 did not exist, this behavior
is bad, because if I want to write a function that deals with ideals in
rings, I would have to do something special if my ring is a number field
(since ideal() does not have a consistent behavior).

Here is, as far as I remember, what the irc discussion identified as
preferred behavior:

(a) For any ring R, R.ideal([list of elements of R]) should return the
ideal of R which is generated by the elements in the list.  This should
in particular happen for a number field, i.e. if K is a number field
then K.ideal([list of elements of K]) should return either the Principal
ideal generated by 0 or the Principal ideal generated by 1.

(b) mathematically speaking, a fractional ideal is a rank one projective
module over a Dedekind domain R; equivalently, it is a nonzero
finitely-generated R-submodule of the fraction field K=Frac(R).  This
latter description might be more amenable to computation.  I don't think
we have Dedekind domains in Sage, so maybe we can just have this work in
the main area of application (algebraic number theory), by having
fractional ideals in number fields.  So if O is an order in a number
field K, we would like O.fractional_ideal([list of elements of K]) to
return the fractional ideal of O generated by the elements in the list.
~ For convenience, we might also want K.fractional_ideal([list of
elements of K]) to be an alias for OK.fractional_ideal([list of elements
of K]), where OK is the ring of integers of K.

Just getting all of this straightened out for rings of integers would
already be a serious but very worthwhile endeavor.

Whoever was around #sage-devel when this was going on, please correct
anything that I might have misrepresented.  Everybody else, please comment!

Best,
Alex


- --
Alexandru Ghitza
Assistant Professor
Department of Mathematics
Colby College
Waterville, ME 04901
http://bayes.colby.edu/~ghitza/
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+9U1dZTaNFFPILgRAhUfAJ0X846IOwIezS9TyJcunyWgQJ6shwCgmgCW
KOsZVf/0ojPDm61RsYalwko=
=611u
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: fractional ideals

2008-04-08 Thread John Cremona

This all sounds very sensible to me.  It is a convention in number
theory to talk of an ideal of the number field K when one actually
means nonzero ideal of the rings of integers of K.

I gained several grey hairs messing with this back in January, being
forced to do so for the patches for #1946 (which started out just
fixing some bugs and adding doctests for elliptic curves over number
fields).  It was a major achievement (for me, then) to get it into a
state which is mainly consistent and also correct.

I could like with ideal being changed to fractional ideal for
number fields, thus releasing ideal for use in the literal
mathematical sense.  Even though I doubt if anyone would actually ever
want to create either of the two ideals in a field!  And the
documentation would have to make it very clear that Sage was not
following the near-universal  abuse of language.

Good luck...

John

On 08/04/2008, Alex Ghitza [EMAIL PROTECTED] wrote:

  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1

  Hi folks,

  On Sunday we had an interesting discussion on #sage-devel about the
  current implementation of fractional ideals in Sage.  This was spurred
  mainly by #821, but went beyond the issues in that ticket.  I am going
  to try to summarize the main points of the discussion, first so that we
  have a record of it, and also so it can continue and we can see what we
  can/should do about it.

  1. At the moment, NumberFieldFractionalIdeal inherits from
  Ideal_generic, which David Harvey pointed out is *very bad*, since
  fractional ideals are *not ideals*.  Yes, the terminology is confusing,
  but we don't have the luxury of convincing Kummer or whoever came up
  with it that it should be changed.

  2. Another sketchy thing is that for a number field K, the method
  ideal() overrides the ring ideal method and returns 0 or a fractional
  ideal.  Even if the objection from point 1 did not exist, this behavior
  is bad, because if I want to write a function that deals with ideals in
  rings, I would have to do something special if my ring is a number field
  (since ideal() does not have a consistent behavior).

  Here is, as far as I remember, what the irc discussion identified as
  preferred behavior:

  (a) For any ring R, R.ideal([list of elements of R]) should return the
  ideal of R which is generated by the elements in the list.  This should
  in particular happen for a number field, i.e. if K is a number field
  then K.ideal([list of elements of K]) should return either the Principal
  ideal generated by 0 or the Principal ideal generated by 1.

  (b) mathematically speaking, a fractional ideal is a rank one projective
  module over a Dedekind domain R; equivalently, it is a nonzero
  finitely-generated R-submodule of the fraction field K=Frac(R).  This
  latter description might be more amenable to computation.  I don't think
  we have Dedekind domains in Sage, so maybe we can just have this work in
  the main area of application (algebraic number theory), by having
  fractional ideals in number fields.  So if O is an order in a number
  field K, we would like O.fractional_ideal([list of elements of K]) to
  return the fractional ideal of O generated by the elements in the list.
  ~ For convenience, we might also want K.fractional_ideal([list of
  elements of K]) to be an alias for OK.fractional_ideal([list of elements
  of K]), where OK is the ring of integers of K.

  Just getting all of this straightened out for rings of integers would
  already be a serious but very worthwhile endeavor.

  Whoever was around #sage-devel when this was going on, please correct
  anything that I might have misrepresented.  Everybody else, please comment!

  Best,
  Alex


  - --
  Alexandru Ghitza
  Assistant Professor
  Department of Mathematics
  Colby College
  Waterville, ME 04901
  http://bayes.colby.edu/~ghitza/
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v2.0.7 (GNU/Linux)
  Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

  iD8DBQFH+9U1dZTaNFFPILgRAhUfAJ0X846IOwIezS9TyJcunyWgQJ6shwCgmgCW
  KOsZVf/0ojPDm61RsYalwko=
  =611u
  -END PGP SIGNATURE-

  


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: multivariate factoring - use maxima ?

2008-04-08 Thread Joel B. Mohler

On Tuesday 08 April 2008 03:25:40 pm Mike Hansen wrote:
 Today 03:25:40 pm
   I have added a benchmark link with Fermat gcd tests, giac seems 5 to
   10 * faster than maxima. I don't have magma, it is most probably
 
  another factor of 10 * faster.

 I think that comparison with Magma is a little optimistic, especially
 in the modular case.

 http://www-fourier.ujf-grenoble.fr/~parisse/giac/benchmarks/gcd_timings
 http://magma.maths.usyd.edu.au/users/allan/gcdcomp.html

Now, it's true that we don't want to re-invent the wheel.  However, it seems 
to me that there aren't any opensource packages that manage the range of base 
rings that we'd want sage to handle for multivariate polynomial rings.  
Singular is probably the closest, but ZZ is only experimental.

So, while I may be reinventing the wheel for mpoly factoring over ZZ (although 
it appears somewhat feasible that the wheel will be re-invented better), it 
has already had a number of positive changes in the generic multivariate 
polydict polynomial implementation in sage.  I think the generic-ness of the 
code is something worth pushing forward and seeing how fast we could be with 
a generic base ring.  I (and Martin, too) am interested in this generic 
approach.  Indeed, even the factoring algorithm has a large prefix 
(square-free decomposition and the like) which is largely independent of the 
base-ring.

So, my bottom line is this, there might be special purpose implementations for 
specific base-rings, but I don't think that is reason to abandon pushing our 
own implementation because I think our implementation can handle base rings 
that nobody else can.  Of course, it is likely that this generic-ness will 
cost us some speed.  But, it is not obvious to me that that cost is 
necessarily prohibitive.

--
Joel

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: fractional ideals

2008-04-08 Thread David Harvey


On Apr 8, 2008, at 4:27 PM, Alex Ghitza wrote:

 Hi folks,

 On Sunday we had an interesting discussion on #sage-devel about the
 current implementation of fractional ideals in Sage.  This was spurred
 mainly by #821, but went beyond the issues in that ticket.  I am going
 to try to summarize the main points of the discussion, first so  
 that we
 have a record of it, and also so it can continue and we can see  
 what we
 can/should do about it.

 1. At the moment, NumberFieldFractionalIdeal inherits from
 Ideal_generic, which David Harvey pointed out is *very bad*, since
 fractional ideals are *not ideals*.  Yes, the terminology is  
 confusing,
 but we don't have the luxury of convincing Kummer or whoever came up
 with it that it should be changed.

 2. Another sketchy thing is that for a number field K, the method
 ideal() overrides the ring ideal method and returns 0 or a fractional
 ideal.  Even if the objection from point 1 did not exist, this  
 behavior
 is bad, because if I want to write a function that deals with  
 ideals in
 rings, I would have to do something special if my ring is a number  
 field
 (since ideal() does not have a consistent behavior).

 Here is, as far as I remember, what the irc discussion identified as
 preferred behavior:

 (a) For any ring R, R.ideal([list of elements of R]) should return the
 ideal of R which is generated by the elements in the list.  This  
 should
 in particular happen for a number field, i.e. if K is a number field
 then K.ideal([list of elements of K]) should return either the  
 Principal
 ideal generated by 0 or the Principal ideal generated by 1.

 (b) mathematically speaking, a fractional ideal is a rank one  
 projective
 module over a Dedekind domain R; equivalently, it is a nonzero
 finitely-generated R-submodule of the fraction field K=Frac(R).  This
 latter description might be more amenable to computation.  I don't  
 think
 we have Dedekind domains in Sage, so maybe we can just have this  
 work in
 the main area of application (algebraic number theory), by having
 fractional ideals in number fields.  So if O is an order in a number
 field K, we would like O.fractional_ideal([list of elements of K]) to
 return the fractional ideal of O generated by the elements in the  
 list.
 ~ For convenience, we might also want K.fractional_ideal([list of
 elements of K]) to be an alias for OK.fractional_ideal([list of  
 elements
 of K]), where OK is the ring of integers of K.

 Just getting all of this straightened out for rings of integers would
 already be a serious but very worthwhile endeavor.

 Whoever was around #sage-devel when this was going on, please correct
 anything that I might have misrepresented.  Everybody else, please  
 comment!

Alex,

Strongly support everything you've said here, and thanks for taking  
the time to write this summary.

(I'm slightly concerned about what should happen for non-maximal  
orders, but I can't quite remember how this is supposed to work  
mathematically)

david


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: fractional ideals

2008-04-08 Thread John Cremona

For non-maximal orders, not every ideal is invertible.  People would
normnally only want to use invertible ideals, I expect.  I don't
remember all the details either.

John

On 08/04/2008, David Harvey [EMAIL PROTECTED] wrote:


  On Apr 8, 2008, at 4:27 PM, Alex Ghitza wrote:

   Hi folks,
  
   On Sunday we had an interesting discussion on #sage-devel about the
   current implementation of fractional ideals in Sage.  This was spurred
   mainly by #821, but went beyond the issues in that ticket.  I am going
   to try to summarize the main points of the discussion, first so
   that we
   have a record of it, and also so it can continue and we can see
   what we
   can/should do about it.
  
   1. At the moment, NumberFieldFractionalIdeal inherits from
   Ideal_generic, which David Harvey pointed out is *very bad*, since
   fractional ideals are *not ideals*.  Yes, the terminology is
   confusing,
   but we don't have the luxury of convincing Kummer or whoever came up
   with it that it should be changed.
  
   2. Another sketchy thing is that for a number field K, the method
   ideal() overrides the ring ideal method and returns 0 or a fractional
   ideal.  Even if the objection from point 1 did not exist, this
   behavior
   is bad, because if I want to write a function that deals with
   ideals in
   rings, I would have to do something special if my ring is a number
   field
   (since ideal() does not have a consistent behavior).
  
   Here is, as far as I remember, what the irc discussion identified as
   preferred behavior:
  
   (a) For any ring R, R.ideal([list of elements of R]) should return the
   ideal of R which is generated by the elements in the list.  This
   should
   in particular happen for a number field, i.e. if K is a number field
   then K.ideal([list of elements of K]) should return either the
   Principal
   ideal generated by 0 or the Principal ideal generated by 1.
  
   (b) mathematically speaking, a fractional ideal is a rank one
   projective
   module over a Dedekind domain R; equivalently, it is a nonzero
   finitely-generated R-submodule of the fraction field K=Frac(R).  This
   latter description might be more amenable to computation.  I don't
   think
   we have Dedekind domains in Sage, so maybe we can just have this
   work in
   the main area of application (algebraic number theory), by having
   fractional ideals in number fields.  So if O is an order in a number
   field K, we would like O.fractional_ideal([list of elements of K]) to
   return the fractional ideal of O generated by the elements in the
   list.
   ~ For convenience, we might also want K.fractional_ideal([list of
   elements of K]) to be an alias for OK.fractional_ideal([list of
   elements
   of K]), where OK is the ring of integers of K.
  
   Just getting all of this straightened out for rings of integers would
   already be a serious but very worthwhile endeavor.
  
   Whoever was around #sage-devel when this was going on, please correct
   anything that I might have misrepresented.  Everybody else, please
   comment!


 Alex,

  Strongly support everything you've said here, and thanks for taking
  the time to write this summary.

  (I'm slightly concerned about what should happen for non-maximal
  orders, but I can't quite remember how this is supposed to work
  mathematically)


  david



  


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] latest version of doc-main

2008-04-08 Thread Minh Nguyen

Hi group,

Does anyone know where I can download the latest version of the
doc-main tree? I'm referring to the doc-main that is bundled with
every release of Sage, including both the stable and alpha releases.
AFAIK with each stable release, e.g. sage-2.11, doc-main is usually
located at

http://www.sagemath.org/doc-main.tar.bz2

And with each alpha release in the sage-3.0 release cycle, I think
doc-main comes bundled with that alpha release and can be downloaded
from

http://sage.math.washington.edu/home/mabshoff/release-cycles-3.0/

However, I only want to get the doc-main tree associated with a
particular alpha release, without having to download the whole alpha
release tarball itself. The main reason is that the tarball is too big
in terms of MB. I've browsed through a number of documentation TeX
files at

http://www.sagemath.org/hg/doc-main/file

but I suspect that those TeX files aren't the latest version in the
current release cycle.

Regards
Minh Van Nguyen

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: latest version of doc-main

2008-04-08 Thread mabshoff



On Apr 9, 7:17 am, Minh Nguyen [EMAIL PROTECTED] wrote:
 Hi group,

Hi Minh,

 Does anyone know where I can download the latest version of the
 doc-main tree? I'm referring to the doc-main that is bundled with
 every release of Sage, including both the stable and alpha releases.
 AFAIK with each stable release, e.g. sage-2.11, doc-main is usually
 located at

 http://www.sagemath.org/doc-main.tar.bz2

I generally do not build the documentation in a release cycle until
were are getting close to the final release. This is mostly due to
sage.math not having all the needed bits in the LaTeX toolchain
installed.

 And with each alpha release in the sage-3.0 release cycle, I think
 doc-main comes bundled with that alpha release and can be downloaded
 from

 http://sage.math.washington.edu/home/mabshoff/release-cycles-3.0/

 However, I only want to get the doc-main tree associated with a
 particular alpha release, without having to download the whole alpha
 release tarball itself. The main reason is that the tarball is too big
 in terms of MB.

I put releases together in /scratch/mabshoff/release-cycle, but that
directory is not exported to the web. The reason not to do builds in
$HOME is that all of those files end up being sync to the backup and I
see little benefit of all those files getting moved.

 I've browsed through a number of documentation TeX
 files at

 http://www.sagemath.org/hg/doc-main/file

 but I suspect that those TeX files aren't the latest version in the
 current release cycle.

I can provide you the individual doc-main.tar.bz2 once the LaTeX
situation on sage.math has been fixed. Your corrections to the Sage
documentation are very much appreciated.

 Regards
 Minh Van Nguyen

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---