Re: [sage-devel] genus() for Function Fields

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 3:57 PM, syd.lavas...@gmail.com
 wrote:
> AFAIK, currently the function field object can not compute its genus
> (see below). I'm thinking about adding this feature in following few
> days. Now, there are two different approaches I can take, and I would
> like to know which one is more desirable for Sage community:
>
> 1. Sage can use singular to compute the genus, so we can write
> (essentially) a wrapper which compute the genus and make it a member
> of the function field class.

What function field object are you talking about?Do you mean the code at

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

which isn't included in any version of Sage yet, but has a positive review?

>
> 2. To implement the algorithm (for example the one in [1]) from
> scratch.
>
> Please, tell me which one is the more desirable approach. If anybody
> has any comment or has already the implementation please bring it up
> in the discussion.

I think one should of course at a minimum do 1 (wrap singular),
because it will be easy.  Then do 2 as well, if you can -- and make it
easy to compare 1 and 2 on many inputs, so you can find lots of bugs
in both.  Also do 3, which is to implement whatever algorithm Florian
Hess suggests, which might be different than 1 or 2.

 -- William

>
> [1] Sendra, J. R. and Winkler, F. and Pérez-Díaz, S., Rational
> Algebraic Curves - A Computer Algebra Approach, Springer, 2007.
>
> sage: kx. = FunctionField(QQ)
> sage: kxY. = PolynomialRing(kx, 'Y')
> sage: kxy. = kx.extension(Y^2 - x^5 -1)
> sage: kxy
> Function field in y defined by Y^2 - x^5 - 1
> sage: kxy.genus()
> ---
> AttributeError                            Traceback (most recent call
> last)
>
> /home/syd/Documents/RecherchePhD/Codes/sage/GrbBasis/
> in ()
>
> /home/syd/Programmes/sage-4.7.2/local/lib/python2.6/site-packages/sage/
> structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/
> structure/parent.c:6260)()
>
> /home/syd/Programmes/sage-4.7.2/local/lib/python2.6/site-packages/sage/
> structure/parent.so in sage.structure.parent.getattr_from_other_class
> (sage/structure/parent.c:3110)()
>
> AttributeError: 'FunctionField_polymod_with_category' object has no
> attribute 'genus'
> sage:
>
> --
> 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



-- 
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] timeit for mathematicians

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 5:36 PM, Volker Braun  wrote:
> On Wednesday, December 14, 2011 12:18:58 AM UTC, Martin Albrecht wrote:
>>
>> It uses the "Student-t" method to estimate the certainty
>
> This is precisely what the python documentation warns about (see Nils'
> post). The timings are not normal distributed. Especially if your code is
> deterministic its much more sensible to look at the min than to unleash
> normal distribution theory.

At least since we're mathematically savvy, we know that there's a lot
more to statistics than the normal distribution.

Having never seen any timing distributions (since they are hidden by
timeit), I don't even know anything about how timings are distributed
in practice.  I wouldn't mind seeing a frequency histogram or trying
tests like  Kolmogorov–Smirnov to decide for myself...

 -- william

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

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 9:04 PM, Rob Beezer  wrote:
> On Dec 13, 6:44 pm, kcrisman  wrote:
>> More seriously, selling it for $.99 or something wouldn't be a bad
>> idea (?) or at least making a contribution possible to do.
>
> My impression is that the Android user culture is much more inclined
> to expect free (as in zero cost).  Or conversely (or is it
> equivalently?) not many people pay for their Android apps:
>
> http://gigaom.com/apple/apple-blowing-away-android-with-up-to-90-of-app-revenue/
>

That's an interesting article which says: "The difference is striking,
and will mean Apple’s platform is likely to continue to hold a strong
lead over Google’s when it comes to the breadth and depth of software
selection."

They equate revenue with "breadth and depth of software selection".
Having used Android now a lot for the last few weeks (and for the
first time ever in my life), I would say that in many ways the breadth
and depth of software selection on Android is as good or better than
with iOS.  At least, for the sort of software *I* personally care
about (which I realize may not correlate at all with what most users
want).   Maybe they mean "breadth and depth of games", in which case
probably iOS is way ahead -- I don't know, since I have no interest in
buying video game software.

Another thing I noticed about Android is that a *lot* of apps have two
version: one free with ads, and another that is non-free but with no
ads.   I don't know if the article takes that revenue model into
account.   I personally think it is a great way to sell apps, because
at least one gets to fully try the app before buying.  There is
nothing more frustrating than buying an app based purely on a
description, and finding that it sucks.

Regarding Sage, I personally agree with Rob -- culture or not,
whatever we make available should be free and GPL'd, but we can make a
"donate" version too.

 -- William


> However, I do think that making a functionally-identical "donate"
> version, at a slightly higher cost than 99 cents could be a good way
> to allow folks to quickly and easily help support Sage development, to
> say nothing of being a quantifiable measure of real interest.
>
> Rob
>
> --
> 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



-- 
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] Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 4:36 PM, Dan Drake  wrote:
> On Wed, 14 Dec 2011 at 12:51AM +0100, Nathann Cohen wrote:
>> I have been contacted by an enlightened colleague who planned to teach a
>> bit of Sage at the local university, instead of Magma and Mathematica as it
>> was formerly done. Now, enthusiasm is a wonderful thing that can achieve
>> many things by itself, and for instance to the scary task of translating a
>> semester's worth of Magma/Mathematica exercises and lecture notes into Sage
>> ones.
>>
>> But really.. Wouldn't it be much much easier if someone around here already
>> knew of an index of equivalents between Mathematica/Sage or Magma/Sage
>> ? :-)
>
> Such a document would be nice...but I remember when I decided to learn
> emacs (after many years with vim). I found a couple such "dictionaries",
> but ultimately they weren't that helpful. You just need to think a
> little differently when using emacs rather than vim.
>
> But as a starting point, such a document would be useful.

It would have the additional value of uncovering functionality that is
missing in Sage, but which should be there.

 -- William

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



-- 
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: Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread daly
On Tue, 2011-12-13 at 18:15 -0600, Jason Grout wrote:
> On 12/13/11 5:51 PM, Nathann Cohen wrote:
> > Hello everybody !!!
> >
> > I have been contacted by an enlightened colleague who planned to teach a
> > bit of Sage at the local university, instead of Magma and Mathematica as
> > it was formerly done. Now, enthusiasm is a wonderful thing that can
> > achieve many things by itself, and for instance to the scary task of
> > translating a semester's worth of Magma/Mathematica exercises and
> > lecture notes into Sage ones.
> >
> > But really.. Wouldn't it be much much easier if someone around here
> > already knew of an index of equivalents between Mathematica/Sage or
> > Magma/Sage ? :-)
> 
> Great idea.  Tim Daly has long been asking people around here to 
> contribute to the Rosetta Stone [1].
> 
> Jason
> 
> 
> 
> [1] http://axiom-developer.org/axiom-website/rosetta.html or 
> http://www.univ-orleans.fr/EXT/ASTEX/astex/doc/en/rosetta/htmla/roseta.htm 
> -- I'm not sure where the original source is or how to add things to it.
> 

wget http://axiom-developer.org/axiom-website/rosetta.tex
wget http://axiom-developer.org/axiom-website/rosettta.pdf

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

2011-12-13 Thread Rob Beezer
On Dec 13, 6:44 pm, kcrisman  wrote:
> More seriously, selling it for $.99 or something wouldn't be a bad
> idea (?) or at least making a contribution possible to do.

My impression is that the Android user culture is much more inclined
to expect free (as in zero cost).  Or conversely (or is it
equivalently?) not many people pay for their Android apps:

http://gigaom.com/apple/apple-blowing-away-android-with-up-to-90-of-app-revenue/

However, I do think that making a functionally-identical "donate"
version, at a slightly higher cost than 99 cents could be a good way
to allow folks to quickly and easily help support Sage development, to
say nothing of being a quantifiable measure of real interest.

Rob

-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Dan Drake
On Tue, 13 Dec 2011 at 06:38PM -0800, kcrisman wrote:
> > Proposed bugfix: symbolic integration should reject floats.
> 
> Yikes!   So we wouldn't want
> 
> sage: integrate(1.0*x,x,0,2)
> 2
> 
> to work any more?  (Pace the error messages below.)
> 
> Could we not instead try to catch this kind of error and recommend to
> the user that they use rationals?  Or something...

As long as there are informative error messages, I don't think I'd mind
too much. In that case, I would also want some kind of rational
approximation method for symbolic expressions: something like

(1.0*x^2).float_coeffs_to_rational() 

becoming

1*x^2.

This could just run exact_rational() or simplest_rational() on the float
coefficients, perhaps with a keyword to select what you want. I would consider
defaulting to simplest_rational() because of things like this:

sage: (1/3).n().exact_rational()
6004799503160661/18014398509481984

I should mention that this entire thing got started when I took my f()
function and tried to use list_plot to see what was happening as you
vary the coefficients: I did something like

[integrate(f(a, 1, t), (t, 0, 2*pi)) for a in srange(1, 2, .1)]

and it failed right away. 


Dan

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


signature.asc
Description: Digital signature


[sage-devel] Re: [sage-release] Re: sage-4.8.alpha1 released

2011-12-13 Thread William Stein
On Fri, Nov 18, 2011 at 8:48 AM, Christian Stump
 wrote:
> Build on Ubuntu 11.10 and had two problems:
>
> The first was recorded on http://trac.sagemath.org/sage_trac/ticket/11970,
> it is still there and it took me some time to find it...

I'm bumping trac 11970 to a blocker.  The current situation with
sage-4.8.alpha*'s is that:

  (1) It doesn't build on the current version of OS X,

  (2) It doesn't build on the current version of the most popular
Linux distro (Ubuntu),

Etc.  This is pretty seriously worrisome given how long its been since
these OS's were released (a few months).  It's got to be a top
priority for us.

 -- William

>
> After following the workaround there, it built well, but when running,
> I got
>
> SyntaxError: Non-ASCII character '\xd0' in file /home/stumpc5/progs/
> sage-4.8.alpha1/local/lib/python2.6/site-packages/sage/rings/arith.py
> on line 1213, but no encoding declared; see 
> http://www.python.org/peps/pep-0263.html
> for details (arith.py, line 1213)
>
> After deleting the non-ascii character in the file, everything seems
> to run well now (but I didn't do any tests).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-release" group.
> To post to this group, send email to sage-rele...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sage-release+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sage-release?hl=en.
>



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


[sage-devel] Re: Sage Android App

2011-12-13 Thread kcrisman

> Hehe...how about a startup that sells "Sage Graphing Calculators" for
> only $699 or something?


More seriously, selling it for $.99 or something wouldn't be a bad
idea (?) or at least making a contribution possible to do.  See this
iTunes app by a "friend of Sage" - 
http://itunes.apple.com/us/app/spins-3d-puzzle/id427591379?mt=8
which has a "lite" free version and a full version at ninety-nine
cents.  Could at least keep us in the stickers at the Joint
Meetings...

- kcrisman

-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread kcrisman

> Conjecture: The integration error occurs due to a similar problem, but
> in a less shielded way, so we get a less intelligible error message
> about essentially the same problem.
>
> From a maxima perspective, I don't think anymore this really is an
> error. I don't think you can expect the advanced integration routines
> to work in the presence of floats, because polynomial arithmetic is
> necessary and things like gcds are horrible to compute for polynomials
> with float coefficients. Therefore, it is written with the assumption
> that keepfloat:false holds, or at least that integration does not
> encounter floats. With that assumption, they are free to set
> "modulus", because the codepaths that are affected by it should not be
> triggered.

Nice analysis.

> Proposed bugfix: symbolic integration should reject floats.

Yikes!   So we wouldn't want

sage: integrate(1.0*x,x,0,2)
2

to work any more?  (Pace the error messages below.)

Could we not instead try to catch this kind of error and recommend to
the user that they use rationals?  Or something...


> (%i3) integrate(sin(t)^2/(1*cos(t) + 1.5)^2,t,0,2*%pi);
>
> CRECIP: attempted inverse of zero (mod 3)
>  -- an error.  Entering the Maxima debugger.

-- 
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: Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread John H Palmieri


On Tuesday, December 13, 2011 3:51:19 PM UTC-8, Nathann Cohen wrote:
>
> Hello everybody !!!
>
> I have been contacted by an enlightened colleague who planned to teach a 
> bit of Sage at the local university, instead of Magma and Mathematica as it 
> was formerly done. Now, enthusiasm is a wonderful thing that can achieve 
> many things by itself, and for instance to the scary task of translating a 
> semester's worth of Magma/Mathematica exercises and lecture notes into Sage 
> ones.
>
> But really.. Wouldn't it be much much easier if someone around here 
> already knew of an index of equivalents between Mathematica/Sage or 
> Magma/Sage ? :-)
>

For a start, you could try looking at the files mathematica.py and magma.py 
(etc.) in SAGE_ROOT/devel/sage/sage/
interfaces/.  If you have a bunch of Mathematica code and want to convert 
it to Sage, it looks like you could try commands like

sage: m = mathematica('Sin[Sqrt[1-x^2]] * (1 - Cos[1/x])^2')  # 
optional - mathematica
sage: m.sage()  # optional - mathematica
(cos(1/x) - 1)^2*sin(sqrt(-x^2 + 1))

-- 
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: Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread John H Palmieri
On Tuesday, December 13, 2011 3:51:19 PM UTC-8, Nathann Cohen wrote:
>
> Hello everybody !!!
>
> I have been contacted by an enlightened colleague who planned to teach a 
> bit of Sage at the local university, instead of Magma and Mathematica as it 
> was formerly done. Now, enthusiasm is a wonderful thing that can achieve 
> many things by itself, and for instance to the scary task of translating a 
> semester's worth of Magma/Mathematica exercises and lecture notes into Sage 
> ones.
>
> But really.. Wouldn't it be much much easier if someone around here 
> already knew of an index of equivalents between Mathematica/Sage or 
> Magma/Sage ? :-)
>

For a start, you could try looking at the files mathematica.py and magma.py 
(etc.) in SAGE_ROOT/devel/sage/sage/interfaces/.

-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Nils Bruin
On Dec 13, 4:09 pm, Dan Drake  wrote:
> ...especially when the float is 1.5, which can be represented exactly as
> a binary float!

Actually, I think it is by design that "integrate" does not work right
when "keepfloat: true;".
The routine "crecip" (reciprocal modulo "modulus") relies one
dynamically-scoped variable modulus. It looks like polynomial
arithmetic (which is conceivably necessary when computing integrals)
can be thrown off when "modulus" is set in some outer scope. Evidence
(transcript below). Verbal description

- we run the example with debugger "on" and "keepfloat: true". This
brings us in the debugger shell, with the scope of the error. When we
try to compute the gcd(x^2+1.5,x), we get an error, clearly showing
that the "modulus" is the problem.
- when we run gcd(x^2+1.5,x) at toplevel, no such error occurs;
presumably because modulus does not have a value in that scope.

Conjecture: The integration error occurs due to a similar problem, but
in a less shielded way, so we get a less intelligible error message
about essentially the same problem.

>From a maxima perspective, I don't think anymore this really is an
error. I don't think you can expect the advanced integration routines
to work in the presence of floats, because polynomial arithmetic is
necessary and things like gcds are horrible to compute for polynomials
with float coefficients. Therefore, it is written with the assumption
that keepfloat:false holds, or at least that integration does not
encounter floats. With that assumption, they are free to set
"modulus", because the codepaths that are affected by it should not be
triggered.

Proposed bugfix: symbolic integration should reject floats.

sage: maxima.console()
;;; Loading #P"/usr/local/sage/local/lib/ecl/sb-bsd-sockets.fas"
;;; Loading #P"/usr/local/sage/local/lib/ecl/sockets.fas"
;;; Loading #P"/usr/local/sage/local/lib/ecl/defsystem.fas"
;;; Loading #P"/usr/local/sage/local/lib/ecl/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) keepfloat: true;
(%o1)true
(%i2) debugmode(true);
(%o2)true
(%i3) integrate(sin(t)^2/(1*cos(t) + 1.5)^2,t,0,2*%pi);

CRECIP: attempted inverse of zero (mod 3)
 -- an error.  Entering the Maxima debugger.
Enter ':h' for help.
(dbm:1) gcd(x^2+1.5,x);

rat: can't rationalize 1.5 when modulus = 3

[...]

(%i4) gcd(x^2+1.5,x);

rat: replaced 1.5 by 3/2 = 1.5
   1
(%o4)  -
   2

-- 
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] timeit for mathematicians

2011-12-13 Thread Volker Braun
On Wednesday, December 14, 2011 12:18:58 AM UTC, Martin Albrecht wrote:
>
> It uses the "Student-t" method to estimate the certainty 
>
This is precisely what the python documentation warns about (see Nils' 
post). The timings are not normal distributed. Especially if your code is 
deterministic its much more sensible to look at the min than to unleash 
normal distribution theory.


-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Dan Drake
On Tue, 13 Dec 2011 at 06:48AM -0800, kcrisman wrote:
> Can you open a ticket and cc: me?

This is now http://trac.sagemath.org/sage_trac/ticket/12152

Dan

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


signature.asc
Description: Digital signature


Re: [sage-devel] Re: timeit for mathematicians

2011-12-13 Thread Florent Hivert
  Hi,

> For low level assembly language we sometimes compute the exact number
> of cycles using the cycle counter rather than do a timing. This varies
> per architecture and assumes cache affects are not relevant.

I remember doing that on a 6502 or 8086/80286/80386. I'm curious: Is it still
really doable on modern processors with deep pipeline, multiple execution
units, micro-instructions, branch predictions, hyperthreading, and I'm
certainly forgetting some more ?

Cheers,

Florent

-- 
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] Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread Dan Drake
On Wed, 14 Dec 2011 at 12:51AM +0100, Nathann Cohen wrote:
> I have been contacted by an enlightened colleague who planned to teach a
> bit of Sage at the local university, instead of Magma and Mathematica as it
> was formerly done. Now, enthusiasm is a wonderful thing that can achieve
> many things by itself, and for instance to the scary task of translating a
> semester's worth of Magma/Mathematica exercises and lecture notes into Sage
> ones.
> 
> But really.. Wouldn't it be much much easier if someone around here already
> knew of an index of equivalents between Mathematica/Sage or Magma/Sage
> ? :-)

Such a document would be nice...but I remember when I decided to learn
emacs (after many years with vim). I found a couple such "dictionaries",
but ultimately they weren't that helpful. You just need to think a
little differently when using emacs rather than vim.

But as a starting point, such a document would be useful. Just make sure
to point people to a Python tutorial as well!

Dan

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


signature.asc
Description: Digital signature


Re: [sage-devel] timeit for mathematicians

2011-12-13 Thread Martin Albrecht
On Tuesday 13 December 2011, William Stein wrote:
> Thoughts?Are there any experts out there in code benchmarking done
> from a more mathematically sophisticated perspective than just one
> number? It's entirely possible I'm making some stupid mistake in
> suggesting the above.

Carlo Wood implemented pretty nice benchmarketing code for us in M4RI

https://bitbucket.org/malb/m4ri/src/ec6d607ba523/testsuite/benchmarking.c

* Example usage:
 *
 * ./bench_elimination -s 0 -m 4 -c 90 -a 0.005 -d -t 30 -n 1000 1000 1000
 *
 * would run at most 30 seconds (-t) or 1000 times (-n), whichever comes
 * first, or stop after the real average of wall time (-s 0) falls with 90%
 * certainty (-c) in a range that is +/- 0.005 times the observed mean (-a: 
 * accuracry), but no sooner than that at least 4 (-m: minimum) measurements
 * have been done. It would also print (-d: dump) each measurement
 * (0:microseconds 
 * 1:cpuclocks).

It uses the "Student-t" method to estimate the certainty (don't ask me what 
that is, I don't know). 

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=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: Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread Jason Grout

On 12/13/11 5:51 PM, Nathann Cohen wrote:

Hello everybody !!!

I have been contacted by an enlightened colleague who planned to teach a
bit of Sage at the local university, instead of Magma and Mathematica as
it was formerly done. Now, enthusiasm is a wonderful thing that can
achieve many things by itself, and for instance to the scary task of
translating a semester's worth of Magma/Mathematica exercises and
lecture notes into Sage ones.

But really.. Wouldn't it be much much easier if someone around here
already knew of an index of equivalents between Mathematica/Sage or
Magma/Sage ? :-)


Great idea.  Tim Daly has long been asking people around here to 
contribute to the Rosetta Stone [1].


Jason



[1] http://axiom-developer.org/axiom-website/rosetta.html or 
http://www.univ-orleans.fr/EXT/ASTEX/astex/doc/en/rosetta/htmla/roseta.htm 
-- I'm not sure where the original source is or how to add things to it.


--
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Dan Drake
On Tue, 13 Dec 2011 at 11:27AM -0800, Nils Bruin wrote:
> I think the error is triggered by an actual bug in "rationalize"
> somewhere, so it might be worth reporting the error upstream. There is
> no reason why "replace a float by a nearby rational number" should
> ever fail.

...especially when the float is 1.5, which can be represented exactly as
a binary float!

Dan

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


signature.asc
Description: Digital signature


[sage-devel] genus() for Function Fields

2011-12-13 Thread syd.lavas...@gmail.com
AFAIK, currently the function field object can not compute its genus
(see below). I'm thinking about adding this feature in following few
days. Now, there are two different approaches I can take, and I would
like to know which one is more desirable for Sage community:

1. Sage can use singular to compute the genus, so we can write
(essentially) a wrapper which compute the genus and make it a member
of the function field class.

2. To implement the algorithm (for example the one in [1]) from
scratch.

Please, tell me which one is the more desirable approach. If anybody
has any comment or has already the implementation please bring it up
in the discussion.

[1] Sendra, J. R. and Winkler, F. and Pérez-Díaz, S., Rational
Algebraic Curves - A Computer Algebra Approach, Springer, 2007.

sage: kx. = FunctionField(QQ)
sage: kxY. = PolynomialRing(kx, 'Y')
sage: kxy. = kx.extension(Y^2 - x^5 -1)
sage: kxy
Function field in y defined by Y^2 - x^5 - 1
sage: kxy.genus()
---
AttributeErrorTraceback (most recent call
last)

/home/syd/Documents/RecherchePhD/Codes/sage/GrbBasis/
in ()

/home/syd/Programmes/sage-4.7.2/local/lib/python2.6/site-packages/sage/
structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/
structure/parent.c:6260)()

/home/syd/Programmes/sage-4.7.2/local/lib/python2.6/site-packages/sage/
structure/parent.so in sage.structure.parent.getattr_from_other_class
(sage/structure/parent.c:3110)()

AttributeError: 'FunctionField_polymod_with_category' object has no
attribute 'genus'
sage:

-- 
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] Mathematica/Magma/Sage dictionaries ?

2011-12-13 Thread Nathann Cohen
Hello everybody !!!

I have been contacted by an enlightened colleague who planned to teach a
bit of Sage at the local university, instead of Magma and Mathematica as it
was formerly done. Now, enthusiasm is a wonderful thing that can achieve
many things by itself, and for instance to the scary task of translating a
semester's worth of Magma/Mathematica exercises and lecture notes into Sage
ones.

But really.. Wouldn't it be much much easier if someone around here already
knew of an index of equivalents between Mathematica/Sage or Magma/Sage ? :-)

With my thanks for your cumulated wisdom,

Nathann

-- 
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: timeit for mathematicians

2011-12-13 Thread Bill Hart
On 13 December 2011 21:39, William Stein  wrote:
> On Tue, Dec 13, 2011 at 1:15 PM, Nils Bruin  wrote:
>> I recall reading something about that in the Python documentation and
>> indeed, quoting from
>>
>> http://docs.python.org/library/timeit.html
>>
>> we find:
>>
>> """
>> Note
>>
>> It’s tempting to calculate mean and standard deviation from the result
>> vector and report these. However, this is not very useful. In a
>> typical case, the lowest value gives a lower bound for how fast your
>> machine can run the given code snippet; higher values in the result
>> vector are typically not caused by variability in Python’s speed, but
>> by other processes interfering with your timing accuracy. So the min()
>> of the result is probably the only number you should be interested in.
>> After that, you should look at the entire vector and apply common
>> sense rather than statistics.
>> """
>
> I now remember that too.  However, I take that as the sort of typical
> thing an engineer who doesn't really understand statistics might say.
> They are concerned about outliers and the data not being normally
> distributed.
>
> The fact is that in practice the bound got from "the lowest value
> gives a lower bound" itself various by quite a bit between calls to
> timeit.   Should one just keep taking minimums?
>
> Given that processors are not deterministic and do speculative
> execution of instructions, etc., I'm even more dubious about the above
> quote.
>
> I've thrown Bill Hart in the cc, since he must have worried a lot
> about exactly this question when trying to make low level C/assembly
> code fast.
>
>  -- William

For low level assembly language we sometimes compute the exact number
of cycles using the cycle counter rather than do a timing. This varies
per architecture and assumes cache affects are not relevant.

For C we (used to) take many iterations and compute minimum and
maximum times. If the two are close and the number of iterations is
high and the machine is not under load, your problem is solved. If any
of those conditions is not met (and sometimes if you do) then you may
not know as much as you believe you do. Things like processors in
power saving mode or variations in the speed of processors on your
cluster may cause massive variations or even just meaningless timings.

If you are timing Python then your timing may be wildly affected by
the choice of language. :-)

Bill.

-- 
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: timeit for mathematicians

2011-12-13 Thread Simon King
Hi!

Currently, "timeit" often does not more than finding the "best of
three". I suspect that computing a standard deviation from just three
samples is not quite reliable. Hence, if one wants to get a statistic
then one needs a lot more runs, thus, the test will take much more
time.

Do we want that "timeit" will take much more time *by default*?

Perhaps one could keep "timeit" as it is and introduce a new object
"time_statistics" (say), that collects timings and may add additional
data points, if the user so wish?

For example:

sage: s="some code to be tested"
sage: TS = time_statistics(s, number=1)
sage: TS
1 runs per sample
3 samples in total
Mean: 451 ns
Standard deviation: 103 ns

The parameter "number" is supposed to have the same meaning (and the
same default) as for timeit: It is the number of repetitions of the
code string forming one data point.

Since three samples (or whatever the default should be) is not enough,
we wish to add samples:

sage: TS.additional_samples(15)
sage: TS
1 runs per sample
18 samples in total
Mean: 446 ns
Standard deviation:  17 ns

And of course TS has methods returning these (and other) statistical
data.

I guess that is similar to what William is suggesting for the "timeit"
command; but I think "timeit" (for fast tests) and
"time_statistics" (for detailed but more time consuming tests) should
be separated.

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: openssh versus gnutls

2011-12-13 Thread Justin C. Walker

On Dec 13, 2011, at 11:14 , Volker Braun wrote:

> Since libSystem.B.dylib is a os library we shouldn't have to care. Also, I 
> don't think apple ships openssl since its not featured in apple ads ;-)

Well, if you do "apropos openssl", you get a bunch of stuff printed.  If you 
look in "/usr/include/openssl/crypto.h", it claims to be a product of the 
OPENSSL project.

This is on both 10.6 (Xcode 3.2) and 10.7 (Xcode 4.2).

HTH

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds

Men are from Earth.
Women are from Earth.
   Deal with it.




-- 
To post to this group, send 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: timeit for mathematicians

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 1:41 PM, Nathann Cohen  wrote:
>> we find:
>
> Yep, but it looks like they have a purely deterministic algorithm in mind. I
> often do things like that :
>
> graphs.RandomGNP(10,.2) .chromatic_number()
>
> Well, the "chromatic_number()" method is deterministic, but each time this
> method is run it is run on a different random graph.
>
> %timeit graphs.RandomGNP(10,.2) .chromatic_number()
>
> Would really make sense to find out how this method reacts to random
> instances.

That's a great point!  There's certainly many examples of
nondeterministic code in Sage (e.g., in linear algebra algorithms like
Hermite Normal Form), and it would be great to have a good way to
benchmark it.Instead of saying "this function sometimes takes 5
seconds", you would get a much better sense of how it does when trying
different random strategies.

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


[sage-devel] Re: timeit for mathematicians

2011-12-13 Thread Nathann Cohen

>
> we find:
>
Yep, but it looks like they have a purely deterministic algorithm in mind. 
I often do things like that :

graphs.RandomGNP(10,.2) .chromatic_number()

Well, the "chromatic_number()" method is deterministic, but each time this 
method is run it is run on a different random graph.

%timeit graphs.RandomGNP(10,.2) .chromatic_number()

Would really make sense to find out how this method reacts to random 
instances.

Nathann

-- 
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: timeit for mathematicians

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 1:15 PM, Nils Bruin  wrote:
> I recall reading something about that in the Python documentation and
> indeed, quoting from
>
> http://docs.python.org/library/timeit.html
>
> we find:
>
> """
> Note
>
> It’s tempting to calculate mean and standard deviation from the result
> vector and report these. However, this is not very useful. In a
> typical case, the lowest value gives a lower bound for how fast your
> machine can run the given code snippet; higher values in the result
> vector are typically not caused by variability in Python’s speed, but
> by other processes interfering with your timing accuracy. So the min()
> of the result is probably the only number you should be interested in.
> After that, you should look at the entire vector and apply common
> sense rather than statistics.
> """

I now remember that too.  However, I take that as the sort of typical
thing an engineer who doesn't really understand statistics might say.
They are concerned about outliers and the data not being normally
distributed.

The fact is that in practice the bound got from "the lowest value
gives a lower bound" itself various by quite a bit between calls to
timeit.   Should one just keep taking minimums?

Given that processors are not deterministic and do speculative
execution of instructions, etc., I'm even more dubious about the above
quote.

I've thrown Bill Hart in the cc, since he must have worried a lot
about exactly this question when trying to make low level C/assembly
code fast.

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


[sage-devel] Re: timeit for mathematicians

2011-12-13 Thread Nils Bruin
I recall reading something about that in the Python documentation and
indeed, quoting from

http://docs.python.org/library/timeit.html

we find:

"""
Note

It’s tempting to calculate mean and standard deviation from the result
vector and report these. However, this is not very useful. In a
typical case, the lowest value gives a lower bound for how fast your
machine can run the given code snippet; higher values in the result
vector are typically not caused by variability in Python’s speed, but
by other processes interfering with your timing accuracy. So the min()
of the result is probably the only number you should be interested in.
After that, you should look at the entire vector and apply common
sense rather than statistics.
"""

-- 
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: Problem calling a base-class cached method from an overridden derived class cached method

2011-12-13 Thread Nicolas M. Thiery
On Fri, Dec 09, 2011 at 03:18:35PM -0800, Simon King wrote:
> The point is: If A.foo is a cached method and B.foo is another cached
> method that overrides A.foo but calls it via "super(B,self).foo", then
> the two cached methods would share their caches, thus, would
> potentially shoot themselves mutually into the foot.

Do you agree with the following rationale:

Since B is a subclass of A, B.foo and A.foo ought to have the same
semantic for their output: an instance b of B is also an instance of
A, so B.foo(b) and A.foo(b) should return the same result. Therefore
sharing the cache should be safe.

It might be worth it mentioning this in the documentation of cached
methods.

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


[sage-devel] Re: timeit for mathematicians

2011-12-13 Thread Jason Grout

On 12/13/11 2:34 PM, William Stein wrote:

Hi,

I was just looking at some timings for trac 12149, and it occurred to
me that our "timeout" command may be fine for programmers, but for us
mathematicians surely we want something that gives a better measure of
the distribution of timings?  Wouldn't it be nice to get both the mean
and standard deviation of the trials, rather than just the mean?

I'm guessing I'm not the first person to think of this, so maybe one
of the people reading this has already written some code for this?
I'm curious what people would think about the timeit command being
improved a bit as follows:

   (1) by default it returns/displays the mean and standard deviation.
This way we can more easily compare timings between different runs or
different code.  If the standard deviation were "10 ms", say, and two
timings differ by 2 ms, we know that it means little.

   (2) Timeit would return an object that prints itself as in 1.  But
it would also have a plot_histogram method, which would return a
histogram plot of all the timings from the runs.Also, there would
be methods on this object to return the timing as a float in seconds,
etc.   It could also give access to both wall and cputimes, since both
are very relevant for Sage (which uses pexpect sometimes).

Thoughts?Are there any experts out there in code benchmarking done
from a more mathematically sophisticated perspective than just one
number? It's entirely possible I'm making some stupid mistake in
suggesting the above.


How about a method to compare itself to another timeit object and tell 
if there is a statistically significant difference for a certain 
p-value?  We could even embed this in "<" and ">" comparison logic.


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


[sage-devel] Re: Sage Android App

2011-12-13 Thread Jason Grout

On 12/13/11 2:23 PM, William Stein wrote:

On Tue, Dec 13, 2011 at 7:06 AM, Volker Braun  wrote:

I wrote this in one day so don't expect a polished product. But you can type
in stuff and have it evaluated by the single cell server :-) If you want to
give it a spin you can get it at

http://www.stp.dias.ie/~vbraun/Sage/Sage.apk

You may have to enable Settings->Application->Unknown Sources to sideload
the apk.


I can't believe how dramatically easier it is to share an Android app
with other users over the Internet than it is to share apps developed
for Apple's iOS.I think there is real hope for a good Android app
for Sage.

For offline use, something more dramatic is surely possible, which is
that we could provide a chroot image that contains something like say
Ubuntu 10.10 with a prebuilt version of Sage in it.   One the user
starts it, it starts a Sage server, and they can then fully use it
locally via some port on localhost.This will of course require a
rooted device, and the download would be probably 1GB or so.   I'm
working on building Sage right now on my Galaxy Tab 8.9 in such a
chroot.   I'll keep people posted.



Hehe...how about a startup that sells "Sage Graphing Calculators" for 
only $699 or something?


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


[sage-devel] timeit for mathematicians

2011-12-13 Thread William Stein
Hi,

I was just looking at some timings for trac 12149, and it occurred to
me that our "timeout" command may be fine for programmers, but for us
mathematicians surely we want something that gives a better measure of
the distribution of timings?  Wouldn't it be nice to get both the mean
and standard deviation of the trials, rather than just the mean?

I'm guessing I'm not the first person to think of this, so maybe one
of the people reading this has already written some code for this?
I'm curious what people would think about the timeit command being
improved a bit as follows:

  (1) by default it returns/displays the mean and standard deviation.
This way we can more easily compare timings between different runs or
different code.  If the standard deviation were "10 ms", say, and two
timings differ by 2 ms, we know that it means little.

  (2) Timeit would return an object that prints itself as in 1.  But
it would also have a plot_histogram method, which would return a
histogram plot of all the timings from the runs.Also, there would
be methods on this object to return the timing as a float in seconds,
etc.   It could also give access to both wall and cputimes, since both
are very relevant for Sage (which uses pexpect sometimes).

Thoughts?Are there any experts out there in code benchmarking done
from a more mathematically sophisticated perspective than just one
number? It's entirely possible I'm making some stupid mistake in
suggesting the above.

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] Sage Android App

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 7:06 AM, Volker Braun  wrote:
> I wrote this in one day so don't expect a polished product. But you can type
> in stuff and have it evaluated by the single cell server :-) If you want to
> give it a spin you can get it at
>
> http://www.stp.dias.ie/~vbraun/Sage/Sage.apk
>
> You may have to enable Settings->Application->Unknown Sources to sideload
> the apk.

I can't believe how dramatically easier it is to share an Android app
with other users over the Internet than it is to share apps developed
for Apple's iOS.I think there is real hope for a good Android app
for Sage.

For offline use, something more dramatic is surely possible, which is
that we could provide a chroot image that contains something like say
Ubuntu 10.10 with a prebuilt version of Sage in it.   One the user
starts it, it starts a Sage server, and they can then fully use it
locally via some port on localhost.This will of course require a
rooted device, and the download would be probably 1GB or so.   I'm
working on building Sage right now on my Galaxy Tab 8.9 in such a
chroot.   I'll keep people posted.

 -- William


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



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


[sage-devel] Re: strange ECL RunTimeError when integrating

2011-12-13 Thread achrzesz


On Dec 13, 8:27 pm, Nils Bruin  wrote:
> On Dec 13, 11:07 am, kcrisman  wrote:
>
> > Yes, we try to turn it off as much as possible - 
> > seehttp://hg.sagemath.org/sage-main/file/9e29a3d84c48/sage/interfaces/ma...
> > and the keepfloat:true.  What an unhelpful error message, then!
>
> I think the error is triggered by an actual bug in "rationalize"
> somewhere, so it might be worth reporting the error upstream. There is
> no reason why "replace a float by a nearby rational number" should
> ever fail.
>
> Workaround:
>
> sage: integrate(f(1.5,1,t), (t,0,2*pi))
> sage: M=sage.calculus.calculus.maxima
> sage: M.eval("keepfloat: false;")
> 'false'
> sage: integrate(f(1.5,1,t), (t,0,2*pi))
> -2*pi
> sage: M.eval("keepfloat: true;") # this is the default
> 'true'
> sage: integrate(f(1.5,1,t), (t,0,2*pi))
> RuntimeError

The workaround should give a correct answer
with newer maxima. (As I have noticed) with the present maxima
version
the result -2*pi is wrong

-- 
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: openssh versus gnutls

2011-12-13 Thread William Stein
On Tue, Dec 13, 2011 at 11:14 AM, Volker Braun  wrote:
> Since libSystem.B.dylib is a os library we shouldn't have to care. Also, I
> don't think apple ships openssl since its not featured in apple ads ;-)
>
> Question for notebook developers: Do we actually use python's ssl module?
> The notebook code seems to have gnutls support, see
> e.g. sagenb/notebook/gnutls_socket_ssl.py

Quick remark:  this was something we hacked together to make Twisted
work with GNUtls, since Twisted does not support that officially.
Using openssl instead would have been much easier.

As far as I know, the ways crypto libs are used in Sage are:

  (1) to make it so the notebook can be served securely.

  (2) Mercurial requires (at least) libcrypt, or it won't do anything.

  (3) It is likely (?) that the pycrypto Python library that Sage
includes depends on having "import crypt" work, but I'm not sure.

Personally, I would love to dump the following spkg's from Sage:

   gnutls
   python_gnutls
   gcrypt
   libgpg_error
   opencdk

and either (a) require a system-wide ssl, or (b) include openssl in Sage.

Sage used to be (b) -- i.e., it did not include any of the above
packages, and did include openssl.  Then a student in my class pointed
out that openssl is not GPL-compatible [1], so I suffered greatly
swapping it out for the above libraries.  However, we never binary
link any GPL code with openssl -- any linking is done via Python at
runtime -- so maybe shipping openssl would be OK.

More to the point, (a) would be a great solution, if we're already
requiring *some* systemwide libcrypt* to build Sage anyways.  Why not
make that explicit, get rid of five annoying packages (which take a
while to build, etc.), and be done with it?According to [1] again,
"The GPL also contains a 'special exception' which allows your GPL-ed
program to link against GPL incompatible libraries which are shipped
as part of the operating system that the executable runs on.", so (a)
is legal.  However, it seems possible that (b) is not legal since the
GPL says "the source code distributed need not include  anything that
is normally distributed (in either source or binary  form) with the
major components (compiler, kernel, and so on) of the  operating
system on which the executable runs, unless that component itself
accompanies the executable."

[1] http://people.gnome.org/~markmc/openssl-and-the-gpl.html

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



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

2011-12-13 Thread Volker Braun
Eclipse project is here:

http://www.stp.dias.ie/~vbraun/Sage/SageApp.tar.bz2


-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Nils Bruin
On Dec 13, 11:07 am, kcrisman  wrote:
> Yes, we try to turn it off as much as possible - 
> seehttp://hg.sagemath.org/sage-main/file/9e29a3d84c48/sage/interfaces/ma...
> and the keepfloat:true.  What an unhelpful error message, then!

I think the error is triggered by an actual bug in "rationalize"
somewhere, so it might be worth reporting the error upstream. There is
no reason why "replace a float by a nearby rational number" should
ever fail.

Workaround:

sage: integrate(f(1.5,1,t), (t,0,2*pi))
sage: M=sage.calculus.calculus.maxima
sage: M.eval("keepfloat: false;")
'false'
sage: integrate(f(1.5,1,t), (t,0,2*pi))
-2*pi
sage: M.eval("keepfloat: true;") # this is the default
'true'
sage: integrate(f(1.5,1,t), (t,0,2*pi))
RuntimeError

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

2011-12-13 Thread William Stein
Can I see the source?
On Dec 13, 2011 10:17 AM, "Rob Beezer"  wrote:

>
>
> On Dec 13, 7:06 am, Volker Braun  wrote:
> > I wrote this in one day so don't expect a polished product.
>
> Volker,
>
> Very, very nice!  With the settings change suggested, I just entered
> the provided URL into the web browser and the installation went
> smoothly from there.  And I was off and running row-reducing
> matrices
>
> Maybe you can invest an additional day in it?  ;-)
>
> The "Sage Keyboard for Linear Algebra" from Sang-Gu Lee, et al, makes
> input easier, and not just for linear algebra.  It has common
> constructs, frequently-used symbols placed conveniently, etc.
>
> https://market.android.com/details?id=sage.keyboard.la&hl=en
>
> Rob
>
> --
> 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: openssh versus gnutls

2011-12-13 Thread Volker Braun
Since libSystem.B.dylib is a os library we shouldn't have to care. Also, I 
don't think apple ships openssl since its not featured in apple ads ;-)

Question for notebook developers: Do we actually use python's ssl module? 
The notebook code seems to have gnutls support, see 
e.g. sagenb/notebook/gnutls_socket_ssl.py



-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread kcrisman

> The problem arises from the rational approximation that maxima tries
> to do resulting from 1.5. Given that the maxima console seems to do
> this "right", my guess would be that we turn off this rational
> approximation trick and that it gets triggered later, resulting in

Yes, we try to turn it off as much as possible - see
http://hg.sagemath.org/sage-main/file/9e29a3d84c48/sage/interfaces/maxima_lib.py#l142
and the keepfloat:true.  What an unhelpful error message, then!

-- 
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: openssh versus gnutls

2011-12-13 Thread Jason Grout

On 12/13/11 12:38 PM, Volker Braun wrote:

If openssl libraries are available then Python will also build the ssl
module (which does link libcrypto), but this is not required for Sage.


Can the ssl module be built without OpenSSL?  As the first thing in our 
instructions to install the new notebook, we ask the user to get the 
python ssl module running (see 
http://code.google.com/r/jasongrout-flask-sagenb/).


On OSX, I get:

~/sage/local/lib/python2.6/lib-dynload% otool -L crypt.so
crypt.so:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 125.2.11)


Do you happen to know if that is OpenSSL?

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] openssh versus gnutls

2011-12-13 Thread Volker Braun
At least on my machine python's crypt module links against glibc's 
libcrypt, not openssl libcrypto (note the o at the end). If openssl 
libraries are available then Python will also build the ssl module (which 
does link libcrypto), but this is not required for Sage. The error you got 
is triggered by python not building the crypt module, which is required for 
Sage.

SAGE_ROOT=/home/vbraun/opt/sage-4.8.alpha4
(sage subshell) volker-desktop:lib vbraun$ ldd 
./python2.6/lib-dynload/crypt.so
linux-vdso.so.1 =>  (0x7fff70d51000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x7f8d9438a000)
libpython2.6.so.1.0 => 
/home/vbraun/opt/sage-4.8.alpha4/local/lib/libpython2.6.so.1.0 
(0x7f8d93fce000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x7f8d93db2000)
libc.so.6 => /lib64/libc.so.6 (0x7f8d939fd000)
libfreebl3.so => /lib64/libfreebl3.so (0x7f8d9379a000)
libdl.so.2 => /lib64/libdl.so.2 (0x7f8d93596000)
libutil.so.1 => /lib64/libutil.so.1 (0x7f8d93393000)
libm.so.6 => /lib64/libm.so.6 (0x7f8d9310e000)
/lib64/ld-linux-x86-64.so.2 (0x7f8d947f4000)

-- 
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: strange ECL RunTimeError when integrating

2011-12-13 Thread Nils Bruin
The bug can be triggered via the pexpect interface to maxima, so it
probably has something to do with the things that sage preloads in
maxima:

sage: maxima("integrate(sin(t)^2/(1*cos(t) + 1.5)^2,t,0,2*%pi)")
TypeError: Error executing code in Maxima
CODE:
sage1 : integrate(sin(t)^2/(1*cos(t) + 1.5)^2,t,0,2*%pi)$
Maxima ERROR:

CRECIP: attempted inverse of zero (mod 3)
 -- an error. To debug this try: debugmode(true);

versus:

sage: maxima("integrate(sin(t)^2/(1*cos(t) + 3/2)^2,t,0,2*%pi)")
-2*%pi

This shows that the problem does not lie in differences between
library mode maxima and maxima proper (this maxima interface runs the
same executable as the maxima console)

The problem arises from the rational approximation that maxima tries
to do resulting from 1.5. Given that the maxima console seems to do
this "right", my guess would be that we turn off this rational
approximation trick and that it gets triggered later, resulting in
some "mod 3" computations. CRECIP has to do with finding rational
approximations to floats.

-- 
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: openssh versus gnutls

2011-12-13 Thread Jason Grout

On 12/13/11 12:10 PM, William Stein wrote:

 > Why is it a problem for the user to link GPL software with openSSL on
their own system?  We aren't distributing, they aren't distributing it
(unless they are making a binary for someone, I guess---that might be a
big problem).
 >

We are distributing.  I clearly don't understand what you mean at all.



Ah.  I didn't understand what you meant; I didn't realize you were 
having this problem when building binaries to distribute.  I guess it's 
a "well duh" moment for me; sometimes I forget we distribute binaries 
since I always work with the source tarballs.


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


[sage-devel] Re: Sage Android App

2011-12-13 Thread Rob Beezer


On Dec 13, 7:06 am, Volker Braun  wrote:
> I wrote this in one day so don't expect a polished product.

Volker,

Very, very nice!  With the settings change suggested, I just entered
the provided URL into the web browser and the installation went
smoothly from there.  And I was off and running row-reducing
matrices

Maybe you can invest an additional day in it?  ;-)

The "Sage Keyboard for Linear Algebra" from Sang-Gu Lee, et al, makes
input easier, and not just for linear algebra.  It has common
constructs, frequently-used symbols placed conveniently, etc.

https://market.android.com/details?id=sage.keyboard.la&hl=en

Rob

-- 
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: openssh versus gnutls

2011-12-13 Thread William Stein
On Dec 13, 2011 10:06 AM, "Jason Grout"  wrote:
>
> On 12/13/11 12:00 PM, William Stein wrote:
>>
>>
>> On Dec 13, 2011 1:12 AM, "Jan Groenewald" > > wrote:
>>  >
>>  > Hi William
>>  >
>>  > On 13 December 2011 10:30, William Stein > > wrote:
>>  >>
>>  >> Hi Sage-devel,
>>  >>
>>  >> I just tried building Sage on Linux Mint 12, and it fails when
>>  >> building Python with:
>>  >>
>>  >> ...
>>  >> math module imported OK
>>  >> hashlib module imported OK
>>  >> Traceback (most recent call last):
>>  >>  File "", line 1, in 
>>  >> ImportError: No module named crypt
>>  >> crypt module failed to import
>>  >> Error: One or more modules failed to import.
>>  >> You may have to install 'dpkg-architecture'
>>  >
>>  >
>>  > apt-get install dpkg-dev and try again?
>>  >
>>  > See http://trac.sagemath.org/sage_trac/ticket/11447
>>  >
>>  > Which should all be fixed after migrating sage to python2.7.
>>
>> But is that dpkg-dev business all about getting python to find and link
>> in the systemwide libcrypto,  which is openssl?   If so,  then we have a
>> problem.
>
>
> Why is it a problem for the user to link GPL software with openSSL on
their own system?  We aren't distributing, they aren't distributing it
(unless they are making a binary for someone, I guess---that might be a big
problem).
>

We are distributing.  I clearly don't understand what you mean at all.

> According to http://people.gnome.org/~markmc/openssl-and-the-gpl.html
>
> "Now, the GPL also contains a "special exception" which allows your
GPL-ed program to link against GPL incompatible libraries which are shipped
as part of the operating system that the executable runs on:"
>
>  The source code for a work means the preferred form of the work for
>  making modifications to it.  For an executable work, complete source
>  code means all the source code for all modules it contains, plus any
>  associated interface definition files, plus the scripts used to
>  control compilation and installation of the executable.  However, as a
>  special exception, the source code distributed need not include
>  anything that is normally distributed (in either source or binary
>  form) with the major components (compiler, kernel, and so on) of the
>  operating system on which the executable runs, unless that component
>  itself accompanies the executable.
>
> 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

-- 
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: openssh versus gnutls

2011-12-13 Thread Jason Grout

On 12/13/11 12:00 PM, William Stein wrote:


On Dec 13, 2011 1:12 AM, "Jan Groenewald" mailto:j...@aims.ac.za>> wrote:
 >
 > Hi William
 >
 > On 13 December 2011 10:30, William Stein mailto:wst...@gmail.com>> wrote:
 >>
 >> Hi Sage-devel,
 >>
 >> I just tried building Sage on Linux Mint 12, and it fails when
 >> building Python with:
 >>
 >> ...
 >> math module imported OK
 >> hashlib module imported OK
 >> Traceback (most recent call last):
 >>  File "", line 1, in 
 >> ImportError: No module named crypt
 >> crypt module failed to import
 >> Error: One or more modules failed to import.
 >> You may have to install 'dpkg-architecture'
 >
 >
 > apt-get install dpkg-dev and try again?
 >
 > See http://trac.sagemath.org/sage_trac/ticket/11447
 >
 > Which should all be fixed after migrating sage to python2.7.

But is that dpkg-dev business all about getting python to find and link
in the systemwide libcrypto,  which is openssl?   If so,  then we have a
problem.


Why is it a problem for the user to link GPL software with openSSL on 
their own system?  We aren't distributing, they aren't distributing it 
(unless they are making a binary for someone, I guess---that might be a 
big problem).


According to http://people.gnome.org/~markmc/openssl-and-the-gpl.html

"Now, the GPL also contains a "special exception" which allows your 
GPL-ed program to link against GPL incompatible libraries which are 
shipped as part of the operating system that the executable runs on:"


  The source code for a work means the preferred form of the work for
  making modifications to it.  For an executable work, complete source
  code means all the source code for all modules it contains, plus any
  associated interface definition files, plus the scripts used to
  control compilation and installation of the executable.  However, as a
  special exception, the source code distributed need not include
  anything that is normally distributed (in either source or binary
  form) with the major components (compiler, kernel, and so on) of the
  operating system on which the executable runs, unless that component
  itself accompanies the executable.

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] openssh versus gnutls

2011-12-13 Thread William Stein
On Dec 13, 2011 1:12 AM, "Jan Groenewald"  wrote:
>
> Hi William
>
> On 13 December 2011 10:30, William Stein  wrote:
>>
>> Hi Sage-devel,
>>
>> I just tried building Sage on Linux Mint 12, and it fails when
>> building Python with:
>>
>> ...
>> math module imported OK
>> hashlib module imported OK
>> Traceback (most recent call last):
>>  File "", line 1, in 
>> ImportError: No module named crypt
>> crypt module failed to import
>> Error: One or more modules failed to import.
>> You may have to install 'dpkg-architecture'
>
>
> apt-get install dpkg-dev and try again?
>
> See http://trac.sagemath.org/sage_trac/ticket/11447
>
> Which should all be fixed after migrating sage to python2.7.

But is that dpkg-dev business all about getting python to find and link in
the systemwide libcrypto,  which is openssl?   If so,  then we have a
problem.

>
> Regards,
> Jan
>
>
> --
>   .~.
>   /V\ Jan Groenewald
>  /( )\www.aims.ac.za
>  ^^-^^
>
> --
> 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: strange ECL RunTimeError when integrating

2011-12-13 Thread kcrisman

> Maxima 5.25.1
>
> (%i2) display2d:false;
> (%o2) false
> (%i3) h:sin(t)^2/(cos(t)+1.5)^2;
> (%o3) sin(t)^2/(cos(t)+1.5)^2
> (%i4) integrate(h,t,0,2*%pi);
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
> (%o4) -(2*sqrt(5)-6)*%pi/sqrt(5)
>
> (Dan's result for a=3/2)

Right, but I'm wondering why I can't reproduce the " Error executing
code in Maxima: CRECIP:
attempted inverse of zero (mod 3) " bit in the Maxima currently in
Sage?The problem is that then upgrading Maxima might not fix this.

- kcrisman

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

2011-12-13 Thread Volker Braun
Whoa thats quite a lot of code. Is there more of a story behind it? You 
implemented everything including an aidl to have the most general 
multithreaded ipc between android apps but then you ran out of steam when 
it came to interfacing with the Sag server? Or did you hit some particular 
problem?

-- 
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] Linear Algebra Quickref updated

2011-12-13 Thread Rob Beezer
I have updated the Linear Algebra Quick Reference card to more closely match 
version 4.8 and to catch up on 2.5 years worth of changes.  You can find it (and 
others) at:


http://wiki.sagemath.org/quickref

Rob

--
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: strange ECL RunTimeError when integrating

2011-12-13 Thread achrzesz


On Dec 13, 3:48 pm, kcrisman  wrote:
> On Dec 12, 10:11 pm, Dan Drake  wrote:
>
>
>
> > I'm doing some integrals:
>
> > sage: a, b, t = var('a b t')
> > sage: f(a,b,t) = sin(t)^2/(a + b*cos(t))^2
> > sage: integrate(f(3/2,1,t), (t,0,2*pi))
> > -2/5*(sqrt(5) - 3)*pi*sqrt(5)
>
> > Okay, that's fine. But
>
> > sage: integrate(f(1.5,1,t), (t,0,2*pi))
>
> > blows up with:
>
> > RuntimeError: ECL says: Error executing code in Maxima: CRECIP:
> > attempted inverse of zero (mod 3)
>
> > This is with 4.7.2 on 64-bit Ubuntu. I get the same error on sage.math.
>
> > How on earth is it trying to invert something mod 3?
>
> Hmm, not obvious to me.   I can get it to happen on Mac, but I can't
> get it to happen in the Maxima console.
>
> (%i1) display2d:false;
>
> (%o1) false
> (%i2) h:sin(t)^2/(cos(t)+1.5)^2;
>
> (%o2) sin(t)^2/(cos(t)+1.5)^2
>
> (%i6) integrate(h,t,0,2*%pi);
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
>
> rat: replaced 1.5 by 3/2 = 1.5
> (%o6) -2*%pi
>
> Can you open a ticket and cc: me?
>
> - kcrisman

Maxima 5.25.1

(%i2) display2d:false;
(%o2) false
(%i3) h:sin(t)^2/(cos(t)+1.5)^2;
(%o3) sin(t)^2/(cos(t)+1.5)^2
(%i4) integrate(h,t,0,2*%pi);

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5
(%o4) -(2*sqrt(5)-6)*%pi/sqrt(5)

(Dan's result for a=3/2)

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: Sage Android App

2011-12-13 Thread Harald Schilly
I started this some time ago: http://code.google.com/p/sage-android/
Might be cool to replace its non-working backend by your cell evaluation 
code!

H

-- 
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] Sage Android App

2011-12-13 Thread Volker Braun
I wrote this in one day so don't expect a polished product. But you can 
type in stuff and have it evaluated by the single cell server :-) If you 
want to give it a spin you can get it at

http://www.stp.dias.ie/~vbraun/Sage/Sage.apk

You may have to enable Settings->Application->Unknown Sources to sideload 
the apk.

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: strange ECL RunTimeError when integrating

2011-12-13 Thread kcrisman


On Dec 12, 10:11 pm, Dan Drake  wrote:
> I'm doing some integrals:
>
> sage: a, b, t = var('a b t')
> sage: f(a,b,t) = sin(t)^2/(a + b*cos(t))^2
> sage: integrate(f(3/2,1,t), (t,0,2*pi))
> -2/5*(sqrt(5) - 3)*pi*sqrt(5)
>
> Okay, that's fine. But
>
> sage: integrate(f(1.5,1,t), (t,0,2*pi))
>
> blows up with:
>
> RuntimeError: ECL says: Error executing code in Maxima: CRECIP:
> attempted inverse of zero (mod 3)
>
> This is with 4.7.2 on 64-bit Ubuntu. I get the same error on sage.math.
>
> How on earth is it trying to invert something mod 3?

Hmm, not obvious to me.   I can get it to happen on Mac, but I can't
get it to happen in the Maxima console.

(%i1) display2d:false;

(%o1) false
(%i2) h:sin(t)^2/(cos(t)+1.5)^2;

(%o2) sin(t)^2/(cos(t)+1.5)^2

(%i6) integrate(h,t,0,2*%pi);

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5

rat: replaced 1.5 by 3/2 = 1.5
(%o6) -2*%pi

Can you open a ticket and cc: me?

- kcrisman

-- 
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] importing mpmath in 'sage -python' imports "everything"?

2011-12-13 Thread Fredrik Johansson
On Tue, Dec 13, 2011 at 12:25 PM, Jonathan Bober  wrote:
> That doesn't seem to work. (I haven't tried to figure out what the problem
> is, and I think I'm going to sleep soon instead of trying to figure it out
> right now.)
>
> I think that it doesn't do the imports, but then later it tries to use them.

Oh right, this is a bug in mpmath. It was fixed a while ago but there
hasn't been a release since then.

https://github.com/fredrik-johansson/mpmath/commit/9c5b5ad0f58d73d973a0ff6425ebcdc28a71a52e

Fredrik

-- 
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] importing mpmath in 'sage -python' imports "everything"?

2011-12-13 Thread Jonathan Bober
That doesn't seem to work. (I haven't tried to figure out what the problem
is, and I think I'm going to sleep soon instead of trying to figure it out
right now.)

I think that it doesn't do the imports, but then later it tries to use them.

bober@sage:~$ MPMATH_NOSAGE=1 sage -python -c "import mpmath"
Traceback (most recent call last):
  File "", line 1, in 
  File
"/usr/local/sage/local/lib/python2.6/site-packages/mpmath/__init__.py",
line 6, in 
from .ctx_mp import MPContext
  File
"/usr/local/sage/local/lib/python2.6/site-packages/mpmath/ctx_mp.py", line
48, in 
from sage.libs.mpmath.ext_main import Context as BaseMPContext
  File "integer.pxd", line 9, in init sage.libs.mpmath.ext_main
(sage/libs/mpmath/ext_main.c:25047)
  File "integer.pyx", line 170, in init sage.rings.integer
(sage/rings/integer.c:35083)
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/infinity.py",
line 200, in 
import sage.rings.rational
  File "fast_arith.pxd", line 3, in init sage.rings.rational
(sage/rings/rational.c:25448)
  File "fast_arith.pyx", line 51, in init sage.rings.fast_arith
(sage/rings/fast_arith.c:7557)
  File "integer_ring.pyx", line 69, in init sage.rings.integer_ring
(sage/rings/integer_ring.c:11070)
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/structure/factorization.py",
line 189, in 
from sage.misc.all import prod
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/misc/all.py", line
81, in 
from functional import (additive_order,
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/misc/functional.py",
line 36, in 
from sage.rings.complex_double import CDF
  File "complex_double.pyx", line 88, in init sage.rings.complex_double
(sage/rings/complex_double.c:14778)
  File "real_mpfr.pxd", line 15, in init sage.rings.complex_number
(sage/rings/complex_number.c:16186)
  File "real_mpfr.pyx", line 1, in init sage.rings.real_mpfr
(sage/rings/real_mpfr.c:29953)
  File "utils.pyx", line 11, in init sage.libs.mpmath.utils
(sage/libs/mpmath/utils.c:5951)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/all.py",
line 72, in 
from sage.libs.all   import *
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/libs/all.py", line
1, in 
import sage.libs.ntl.all  as ntl
  File
"/usr/local/sage/local/lib/python2.6/site-packages/sage/libs/ntl/all.py",
line 26, in 
from sage.libs.ntl.ntl_ZZ import (
  File "ntl_ZZ.pyx", line 28, in init sage.libs.ntl.ntl_ZZ
(sage/libs/ntl/ntl_ZZ.cpp:6238)
  File "integer_ring.pyx", line 1063, in
sage.rings.integer_ring.IntegerRing (sage/rings/integer_ring.c:9618)
NameError: ZZ


On Tue, Dec 13, 2011 at 2:35 AM, Fredrik Johansson <
fredrik.johans...@gmail.com> wrote:

> On Tue, Dec 13, 2011 at 8:27 AM, Jonathan Bober  wrote:
> > Does anyone happen to know why this happens? I have a feeling it is
> going to
> > annoy my sometime soon.
>
> You can prevent mpmath from trying to import Sage altogether by
> setting the MPMATH_NOSAGE environment variable. Of course, this makes
> the runtime a bit slower.
>
> Right now mpmath imports sage.all but only uses sage.Integer,
> sage.factorial, sage.fibonacci and sage.primes. I suppose the last
> three imports could be done lazily. But it definitely needs to import
> the Sage Integer type at startup or not at all.
>
> Fredrik
>
> --
> 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] openssh versus gnutls

2011-12-13 Thread Jan Groenewald
And that the command dpkg-architecture is in the package dpkg-dev.

Regards,
Jan




On 13 December 2011 12:46, Volker Braun  wrote:

> I also tripped over this yesterday. It would have been nice if the error
> message would have included the information that dpkg-architecture is not
> installed by default and you almost certainly have to install it yourself.
>
> --
> 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
>



-- 
  .~.
  /V\ Jan Groenewald
 /( )\www.aims.ac.za
 ^^-^^

-- 
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: How to write a Cython wrapper for a C++ function that has a function pointer argument

2011-12-13 Thread Volker Braun
Well a Python function does not have a function pointer, only C functions 
do. You can wrap some canned C callbacks or have a cdef function callback 
that communicates with Python. Whats best really depends on what the 
callback does.

-- 
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] openssh versus gnutls

2011-12-13 Thread Volker Braun
I also tripped over this yesterday. It would have been nice if the error 
message would have included the information that dpkg-architecture is not 
installed by default and you almost certainly have to install it yourself.

-- 
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: Representation of finite field elements

2011-12-13 Thread Jeroen Demeyer
On 2011-12-12 15:27, Johan S. R. Nielsen wrote:
> That is, change default from repr="poly" to repr="log"?
-1.

log is computationally difficult if the field gets large.  And having a
different default for small and large finite fields would only be
confusing.  Also, "poly" clearly shows elements of the base field.  If I
have GF(25), then 2 shows as "2", not as "g^6" or whatever.

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


Re: [sage-devel] importing mpmath in 'sage -python' imports "everything"?

2011-12-13 Thread Fredrik Johansson
On Tue, Dec 13, 2011 at 8:27 AM, Jonathan Bober  wrote:
> Does anyone happen to know why this happens? I have a feeling it is going to
> annoy my sometime soon.

You can prevent mpmath from trying to import Sage altogether by
setting the MPMATH_NOSAGE environment variable. Of course, this makes
the runtime a bit slower.

Right now mpmath imports sage.all but only uses sage.Integer,
sage.factorial, sage.fibonacci and sage.primes. I suppose the last
three imports could be done lazily. But it definitely needs to import
the Sage Integer type at startup or not at all.

Fredrik

-- 
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: Representation of finite field elements

2011-12-13 Thread Johan S. R. Nielsen
Wow, this opened up a can of worms I hadn't expected, but reading your
comments, I really agree.

> When I was working on similar issues for printing real numbers (i.e.,
> whether to truncate digits, etc.), Carl Witty brought up a very good
> point.  Printing representation options should be global session-wide
> defaults that apply to all output in a session, rather than options
> stored with the objects.  For example, it seems better to do something like:
>
> sage.print_options['finite field repr']='int'
>
> or
>
> sage.rings.finite_rings.finite_field_base.printing_style='int'

Yes! That would be a much better way of doing it. And then thinking it
through to make sure that it could work in all the places we would
like such a thing.

> You need to be careful that the generator, which currently is only
> required to have irreducible characteristic polynomial over the base
> field, is actually a multiplicative generator for the field:
> sage: R. = ZZ[]
> sage: k. = GF(49,modulus=x^2+5*x+2)
> sage: a.multiplicative_order()
> 24
>
> I certainly like "^" more, but we can't use the
> same name here as for the generator above.  Maybe we should have
> mult_gen_name as an option to pass to GF, with a sensible default?

I didn't realise that. That probably saved me some hours in debugging
sometime in the future ;-) Is it completely insane to change the
default field constructor to always return a multiplicative generator
instead of the above (polynomial?) generator? The above concept
certainly decreases the usefulness of printing generator^exponent. I
think it would be quite unintuitive if the user saw something like
> sage: R. = ZZ[]
> sage: k. = GF(49,modulus=x^2+5*x+2)
> sage: a
> beta^10
assuming that "beta" was the sensible default mult_gen_name. On could
of course also output
> sage: a
> (5*a+3)^10
seeing as 5a+3 is a multiplicative generator of k, but I'm not sure
we're really helping things here...

> In fact, I think it makes sense to have printing objects inherit from
> each other, so that we don't have to continually write code like
> ' + '.join(["%s * x^i"%(c.list()[i] for i in range(len(c.list()))])
> and make sure to debug all the corner cases.

Yes! Alternatively/Relatedly, use a sort of interface for printing
objects that print utility functions could use. In the above example,
useful features to ask for is when the exponent is 0 or 1, and whether
the coefficient needs parentheses around it. There are, as you point
out, _many_ places in the sage source code that implements printing
polynomial-like objects, and they all have special handling of various
cases. Would be nice to unify.

Cheers,
Johan

-- 
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] openssh versus gnutls

2011-12-13 Thread Jan Groenewald
Hi William

On 13 December 2011 10:30, William Stein  wrote:

> Hi Sage-devel,
>
> I just tried building Sage on Linux Mint 12, and it fails when
> building Python with:
>
> ...
> math module imported OK
> hashlib module imported OK
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: No module named crypt
> crypt module failed to import
> Error: One or more modules failed to import.
> You may have to install 'dpkg-architecture'
>

apt-get install dpkg-dev and try again?

See http://trac.sagemath.org/sage_trac/ticket/11447

Which should all be fixed after migrating sage to python2.7.

Regards,
Jan


-- 
  .~.
  /V\ Jan Groenewald
 /( )\www.aims.ac.za
 ^^-^^

-- 
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] openssh versus gnutls

2011-12-13 Thread William Stein
Hi Sage-devel,

I just tried building Sage on Linux Mint 12, and it fails when
building Python with:

...
math module imported OK
hashlib module imported OK
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named crypt
crypt module failed to import
Error: One or more modules failed to import.
You may have to install 'dpkg-architecture'

--

All the gnutls packages have been built already.  This means that our
Python build depends on... openssl, evidently.

Is this the case?

(1) If no, then our build is seriously broken.

(2) If YES, then Sage links in openssl, which is a non-GPL-compatible
library.The *only* reason that Sage includes the whole GNUtls
stack instead of OpenSSL (which is massively more well supported and
easier to build) is because of this license issue.  If Sage is linking
openssl anyways, this license issue is moot.


Before people pounce and say it doesn't matter, then get in a subtle
discussion involving compiled versus interpreted linking and the GPL,
I've already thought about that a lot. Personally, I would
seriously like to consider switching to shipping openssl and getting
rid of the gnutls stuff, but we would want to be careful about that,
possibly consulting a lawyer (e.g., somebody from FSF).In any
case, whatever violation there might be, we are probably already
making it because Sage appears to already links in openssl.

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