[sage-devel] Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread Paul Graham
Im working on one of the beginner tickets, where you have to fix something 
in the developers guide, http://www.sagemath.org/doc/developer/index.html.  
I saved the changes i made to sage_manuals.rst at 
/home/me/sage/src/doc/en/developer/sage_manuals.rst then do:

sage --docbuild developer html

and it says i should look at 
/usr/lib/sagemath/src/doc/output/html/en/developer. But when i open the 
sage_manuals.html file there, i dont see any of the changes i made?

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread kcrisman
You have to do sage -b first, though I don't know if this is well 
advertised.

On Friday, August 8, 2014 2:01:48 AM UTC-4, Paul Graham wrote:

 Im working on one of the beginner tickets, where you have to fix something 
 in the developers guide, http://www.sagemath.org/doc/developer/index.html.  
 I saved the changes i made to sage_manuals.rst at 
 /home/me/sage/src/doc/en/developer/sage_manuals.rst then do:

 sage --docbuild developer html

 and it says i should look at 
 /usr/lib/sagemath/src/doc/output/html/en/developer. But when i open the 
 sage_manuals.html file there, i dont see any of the changes i made?


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread Jeroen Demeyer

On 2014-08-08 09:15, kcrisman wrote:

You have to do sage -b first, though I don't know if this is well
advertised.


Or even easier, you can replace

$ sage -b
$ sage --docbuild developer html

by the simple command

$ make

And sorry to state the obvious, but you might need to hit the refresh 
button on your browser.


--
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Difficulties with resultant

2014-08-08 Thread John Cremona
On 8 August 2014 03:21, rjf fate...@gmail.com wrote:
 There is a different answer from Maxima, at least different from what is
 posted.

 algebraic:true;
 tellrat(x^3+3*x+1);
 resultant(f,g,y)
 gives

 2201*x^2-2042*x-885

This certainly the correct answer, as one can check by going back to
first principles:  the resultant of 2 quadratics is a homogenous
polynomial in the 6 coefficients, actually bihomogeneous of bidegree
(2,2), given by a 4x4 determinant.  It makes no difference when one
reduces modulo the modulus:

sage: x = polygen(QQ)
sage: a,b,c,d,e,f = [x^4, x^3+1, x-2, x^3+2*x+1, x+1, x^4+x^3+x^2+1]
sage: M = Matrix(4,4,[a,0,d,0,b,a,e,d,c,b,f,e,0,c,0,f]); M
[x^4   0   x^3 + 2*x + 1
0]
[x^3 + 1 x^4   x + 1   x^3
+ 2*x + 1]
[  x - 2 x^3 + 1 x^4 + x^3 + x^2 + 1
x + 1]
[  0   x - 2   0 x^4 + x^3
+ x^2 + 1]
sage: M.det() % (x^3+3*x+1)
2201*x^2 - 2042*x - 885

John


 Note that Maxima can also compute the resultant wrt x without
 renaming variables.



 On Thursday, August 7, 2014 10:25:19 AM UTC-7, Bill Hart wrote:

 Thanks Peter. That clears it up well.

 I actually thought that you could specify which variable Pari/GP took the
 resultant with respect to. But this obviously doesn't get you around the
 variable ordering issue.

 I was vaguely aware of that problem, but had no idea I wasn't working
 around it already.

 I'm glad to hear this is also fixed in Sage. I tend to use the latest
 stable release of Sage, but not usually the beta, so I missed that this had
 been fixed.

 Thanks again for the help.

 Bill.

 On Thursday, 7 August 2014 17:02:56 UTC+2, Peter Bruin wrote:

 Hi Bill,

 This bug was only fixed two weeks ago (Trac tickets #15061 and #16360),
 so it only works in the most recent beta versions of Sage.

 The reason why PARI gives the wrong answer has to do with variable
 ordering; for example, f is translated to

 f = Mod(-3*y^2*x^2 + (-y^2 - 3*y + 1)*x - 2, x^3 + 3*x + 1)

 which is not a polynomial at all.  If you want to do this computation in
 PARI, you have to replace x by a variable with lower priority than y:

 gp  y; z;
 gp  f = (z^4*y^2 + (z^3 + 1)*y + (z - 2)) * Mod(1, z^3 + 3*z + 1) *
 Mod(1, 487326487);
 gp  g = ((z^3 + 2*z + 1)*y^2 + (z + 1)*y + (z^4 + z^3 + z^2 + 1)) *
 Mod(1, z^3 + 3*z + 1) * Mod(1, 487326487);
 gp  polresultant(f, g)
 %4 = Mod(Mod(2201, 487326487)*z^2 + Mod(487324445, 487326487)*z +
 Mod(487325602, 487326487), z^3 + 3*z + 1)

 Peter


 Bill Hart wrote:

  I think that is the correct answer. It agrees with one of the answers
  Magma gives, and someone else says Mathematica agrees.
  My version of Sage is 'Sage Version 6.2, Release Date: 2014-05-06'
  Bill.
 
  On Thursday, 7 August 2014 16:10:52 UTC+2, Frédéric Chapoton wrote:
 
Hello,
it works for me on sage 6.3.beta8, giving:
2201*xbar^2 + 487324445*xbar + 487325602
which version of sage do you use ? type version() to know that.
By the way, you should rather have asked that question on
  sage-support
or on ask.sagemath.org
Le jeudi 7 août 2014 16:03:43 UTC+2, Bill Hart a écrit :
 
   I'm having difficulties with the polynomial resultant function in
   Sage.
   I'm trying to find the resultant of two polynomials.
   I compute the resultant of the polynomials below to be:
   6768454*x^2+257200062*x+20305258
   Pari/GP says the resultant is 1, which I don't believe, so I thought
   I'd try Sage 6.2:
   sage: R = Integers(487326487)
   sage: S.x = PolynomialRing(R)
   sage: T = QuotientRing(S, x^3 + 3*x + 1)
   sage: U.y = PolynomialRing(T)
   sage: f = x^4*y^2 + (x^3 + 1)*y + (x - 2)
   sage: g = (x^3 + 2*x + 1)*y^2 + (x + 1)*y + (x^4 + x^3 + x^2 + 1)
   sage: f.resultant(g)
 
  ---
   PariError Traceback (most recent call
   last)
   ipython-input-9-14f40f55d982 in module()
    1 f.resultant(g)
 
  /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/structure/element.so
   in sage.structure.element.NamedBinopMethod.__call__
   (sage/structure/element.c:25475)()
 
  /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so
   in sage.rings.polynomial.polynomial_element.Polynomial.resultant
   (sage/rings/polynomial/polynomial_element.c:33908)()
 
  /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so
   in sage.rings.polynomial.polynomial_element.Polynomial._pari_with_name
   (sage/rings/polynomial/polynomial_element.c:33119)()
 
  /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/libs/pari/gen.so
   in sage.libs.pari.gen.gen.Polrev (sage/libs/pari/gen.c:12936)()
 
  /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/libs/pari/handle_error.so
   in 

[sage-devel] Background documentation

2014-08-08 Thread Clemens Heuberger
In http://trac.sagemath.org/ticket/16782, I propose a patch implementing the
Riemann Zeta function for complex intervals.

For bounding the errors, I needed some rather boring estimates, in particular
explicitly bounding errors in Taylor's theorem in my situation. These boring
estimates now exist in the form of a TeX file (translating to 2 pages PDF) on my
hard disk.

I suppose that this is not an ideal solution, because reviewers might want to
check what I did without having to do everything by themselves, and the same
holds for future extensions/bugfixes etc.

I find none of the following possibilities very appealing:

- keep it on my hard disk (that is probably the traditional approach in
mathematical papers, the boring details are somewhat buried and inaccessible).

- Moving the TeX-code into the docstring (we are speaking about 2 pages, after 
all).

- Moving the TeX-code as comments into the code (same problem and you'd have to
read the TeX code instead of a compiled version).

- Putting it into arxiv (way to boring content for arxiv).

- Putting it onto my web page and inserting a link to it (may be a compromise)

Is there any canonical place for such background documentation, possibly within
the sage source tree?

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Difficulties with resultant

2014-08-08 Thread Dima Pasechnik
On 2014-08-08, John Cremona john.crem...@gmail.com wrote:
 On 8 August 2014 03:21, rjf fate...@gmail.com wrote:
 There is a different answer from Maxima, at least different from what is
 posted.

 algebraic:true;
 tellrat(x^3+3*x+1);
 resultant(f,g,y)
 gives

 2201*x^2-2042*x-885

 This certainly the correct answer, as one can check by going back to
 first principles:  the resultant of 2 quadratics is a homogenous
 polynomial in the 6 coefficients, actually bihomogeneous of bidegree
 (2,2), given by a 4x4 determinant.  It makes no difference when one
 reduces modulo the modulus:

 sage: x = polygen(QQ)
 sage: a,b,c,d,e,f = [x^4, x^3+1, x-2, x^3+2*x+1, x+1, x^4+x^3+x^2+1]
 sage: M = Matrix(4,4,[a,0,d,0,b,a,e,d,c,b,f,e,0,c,0,f]); M
 [x^4   0   x^3 + 2*x + 1
 0]
 [x^3 + 1 x^4   x + 1   x^3
 + 2*x + 1]
 [  x - 2 x^3 + 1 x^4 + x^3 + x^2 + 1
 x + 1]
 [  0   x - 2   0 x^4 + x^3
 + x^2 + 1]
 sage: M.det() % (x^3+3*x+1)
 2201*x^2 - 2042*x - 885

and this is in agreement with the direct computation in GF(487326487)
done on Sage 6.3.rc0, 
as  -2042 % 487326487 == 487324445 and -885 % 487326487 == 487325602.


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] category weirdness

2014-08-08 Thread John Cremona
I do not understand the following, probably because I do not
understand why, when I create an object of class EllipticCurve_field
it ends up having type EllipticCurve_field_with_category:

in my code I have the lines

E0 = ...
print type(E0)
auts = E0.automorphsims()

I get the AttributeError: 'EllipticCurve_field_with_category' object
has no attribute 'automorphsims'

If I construct the same object in an interactive session, the method
automorphisms() runs fine.

Help!

John

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Nathann Cohen


 If I construct the same object in an interactive session, the method 
 automorphisms() runs fine. 


Does it produce the same output even without the typo in automorphsims ?

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: category weirdness

2014-08-08 Thread John Cremona
On 8 August 2014 14:21, Nathann Cohen nathann.co...@gmail.com wrote:
 If I construct the same object in an interactive session, the method
 automorphisms() runs fine.


 Does it produce the same output even without the typo in automorphsims ?


red face no...  thanks, Nathann!  I even tried E0.isomorphsims(E0)
but of course I only changed the first3 letters so that did not work
either.

Time to go on holiday...

John

 Nathann

 --
 You received this message because you are subscribed to the Google Groups
 sage-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-devel.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Volker Braun
Unlike #16644 / #16707 this is actually an AttributeError and diagnosed 
correctly ;-)



On Friday, August 8, 2014 2:16:58 PM UTC+1, John Cremona wrote:

 I do not understand the following, probably because I do not 
 understand why, when I create an object of class EllipticCurve_field 
 it ends up having type EllipticCurve_field_with_category: 

 in my code I have the lines 

 E0 = ... 
 print type(E0) 
 auts = E0.automorphsims() 

 I get the AttributeError: 'EllipticCurve_field_with_category' object 
 has no attribute 'automorphsims' 

 If I construct the same object in an interactive session, the method 
 automorphisms() runs fine. 

 Help! 

 John 


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: category weirdness

2014-08-08 Thread Nathann Cohen
 Unlike #16644 / #16707 this is actually an AttributeError and diagnosed
 correctly ;-)

But why isn't it reported as an attribute error of the class that was
created by the user, i.e. EllipticCurve_field ? I understand that the
category mechanism will try to find the method elsewhere if it is not
defined, but still: it seems to say that whatever the method that was
not found it should have been implemented in some category code
instead of  in EllipticCurve_field directly.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: category weirdness

2014-08-08 Thread Volker Braun
Your code for parent/element structures is supposed to look like:

class FooE(Element):
... stuff ...

class FooP(Parent):
Element = FooE

def _element_constructor_(self, arg)
return self.element_class(arg)

... more stuff...

The FooP.element_class is dynamically generated from FooP.Element, and this 
is the class that is named FooE_with_category. You never use FooE directly, 
always FooP.element_class. In particular, if you later add a derived class

class DerivedFooP(FooP):
Element = DerivedFooE

then the inherited methods will automatically use the derived 
self.element_class. Some of the category stuff uses that dynamically 
generated class as a mechanism to implement its functionality, which is 
where the name comes from. Its a bit of a misnomer. IMHO the category 
functionality would have been better implemented by a proper metaclass than 
by dynamically assigning to __class__ to dynamically construct the class at 
import time, not at construction time. And only have one class instead of 
the confusion with FooE vs. FooE_with_category. And as a further warning, 
this was for Python element classes---Cython classes are different again. 

   


On Friday, August 8, 2014 3:04:39 PM UTC+1, Nathann Cohen wrote:

 But why isn't it reported as an attribute error of the class that was 
 created by the user, i.e. EllipticCurve_field ? I understand that the 
 category mechanism will try to find the method elsewhere if it is not 
 defined, but still: it seems to say that whatever the method that was 
 not found it should have been implemented in some category code 
 instead of  in EllipticCurve_field directly. 



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: link to git.sagemath.org

2014-08-08 Thread Volker Braun
I deleted /var/cache/cgit on the trac server and that fixed the issue 
finally.


On Tuesday, June 17, 2014 12:06:58 PM UTC+1, Volker Braun wrote:

 I can confirm it... the trailing slash is a common trap with url rules, I 
 guess thats the issue.



 On Tuesday, June 17, 2014 11:32:17 AM UTC+1, Thierry 
 (sage-googlesucks@xxx) wrote:

 Hi, 

 i noticed that the link to the git repo (from www.sagemath.org) is 
 http://git.sagemath.org/sage.git/ that is locked to 6.3.beta1, while 
 http://git.sagemath.org/sage.git (without trailing slash) seems to offer 
 a fresher view. It is not only a question about trailing slash in the 
 link, since when i click on 'refs', in both case i go to 
 http://git.sagemath.org/sage.git/refs/ which shows that the 'develop' 
 branch is 6.3.beta1 (not beta3). Are there two repos conflicting there, 
 or perhaps a caching issue ? 

 Ciao, 
 Thierry 



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Background documentation

2014-08-08 Thread Nils Bruin
On Friday, August 8, 2014 1:48:20 AM UTC-7, Clemens Heuberger wrote:


 Is there any canonical place for such background documentation, possibly 
 within 
 the sage source tree? 


If your work is interesting then you'll probably be doing computations with 
it that warrant publication. That could be a non-boring submission to 
ArXiv. On ArXiv you can attach supporting (data) files to your preprint, 
which are allowed to be boring. Now you can refer to *those* from the sage 
code. 

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Simon King
Hi Volker,

some remark:

On 2014-08-08, Volker Braun vbraun.n...@gmail.com wrote:
 IMHO the category 
 functionality would have been better implemented by a proper metaclass than 
 by dynamically assigning to __class__ to dynamically construct the class at 
 import time, not at construction time.

This would mean: You provide the category functionality during the
construction of the *class*, rather than during the construction time of
the *instance* of the class.

Let Foo be a class whose instances may be objects in different categories
(such as matrix spaces, which are algebras if the matrices are square, and
modules otherwise). A metaclass can easily add methods of, say,
Modules(Rings()).parent_class to Foo (until recently, you would have needed
to explicitly provide a base ring, rather than just saying that it belongs
to Rings()).

But what would you do if Foo(args) has more structure and in fact belongs to
Algebras(Rings())? I don't think that this can be solved on the level of
the class Foo, unless of course you provide Foo with a classcall
metaclass that, depending an the given arguments, dynamically creates a new
class Foo_algebras adding the methods from Algebras(Rings()).parent_class, and
then Foo(args) returns an instance of this new class Foo_algebras.

But then, how would this be any better than what the category framework is
currently doing?

Hmm. Perhaps actually it *is* better. Currently, the following happens:

1) Foo.__init__ choses a category CAT depending on the given arguments.
2) _init_category_ replaces self.__class__ by a sub-class Foo_cat, that is
dynamically created using Foo and CAT. If Foo is a cython class, then
overriding self.__class__ by Foo_cat is impossible.

With a (classcall) metaclass, we could make the following work:

1) When Foo(args) is called, we defer to Foo.__classcall__.
2) In Foo.__classcall__, the category CAT is chosen depending on the
given args. Perhaps this could be done in some static method
Foo._choose_category_.
3) Depending on CAT, a sub-class Foo_cat of Foo will be created and an instance
O of it will be created and initialised.
4) __classcall__ returns O.

Advantages of the second scenario:
- Chosing the category is done in a separate method. Looks cleaner than
  doing it in __init__.
- There will be no change of O.__class__ after creation of O, since O is
  created as an instance of Foo_cat right away.
- This would work even if Foo was a Cython class.

However, it would be an awful lot of work to change...

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Volker Braun
IMHO the majority of Sage doesn't actually use dynamic category refinement 
and/or make the category depend on the arguments. And the latter is just a 
special case of the former.

If you really need to dynamically change the category then let the 
metaclass construct a suitable class and assign to __class__ or use a 
getattr hack. You still don't need differently-named classes Foo and 
Foo_with_category. 



On Friday, August 8, 2014 4:44:23 PM UTC+1, Simon King wrote:

 Hi Volker, 

 some remark: 

 On 2014-08-08, Volker Braun vbrau...@gmail.com javascript: wrote: 
  IMHO the category 
  functionality would have been better implemented by a proper metaclass 
 than 
  by dynamically assigning to __class__ to dynamically construct the class 
 at 
  import time, not at construction time. 

 This would mean: You provide the category functionality during the 
 construction of the *class*, rather than during the construction time of 
 the *instance* of the class. 

 Let Foo be a class whose instances may be objects in different categories 
 (such as matrix spaces, which are algebras if the matrices are square, and 
 modules otherwise). A metaclass can easily add methods of, say, 
 Modules(Rings()).parent_class to Foo (until recently, you would have 
 needed 
 to explicitly provide a base ring, rather than just saying that it belongs 
 to Rings()). 

 But what would you do if Foo(args) has more structure and in fact belongs 
 to 
 Algebras(Rings())? I don't think that this can be solved on the level of 
 the class Foo, unless of course you provide Foo with a classcall 
 metaclass that, depending an the given arguments, dynamically creates a 
 new 
 class Foo_algebras adding the methods from Algebras(Rings()).parent_class, 
 and 
 then Foo(args) returns an instance of this new class Foo_algebras. 

 But then, how would this be any better than what the category framework is 
 currently doing? 

 Hmm. Perhaps actually it *is* better. Currently, the following happens: 

 1) Foo.__init__ choses a category CAT depending on the given arguments. 
 2) _init_category_ replaces self.__class__ by a sub-class Foo_cat, that is 
 dynamically created using Foo and CAT. If Foo is a cython class, then 
 overriding self.__class__ by Foo_cat is impossible. 

 With a (classcall) metaclass, we could make the following work: 

 1) When Foo(args) is called, we defer to Foo.__classcall__. 
 2) In Foo.__classcall__, the category CAT is chosen depending on the 
 given args. Perhaps this could be done in some static method 
 Foo._choose_category_. 
 3) Depending on CAT, a sub-class Foo_cat of Foo will be created and an 
 instance 
 O of it will be created and initialised. 
 4) __classcall__ returns O. 

 Advantages of the second scenario: 
 - Chosing the category is done in a separate method. Looks cleaner than 
   doing it in __init__. 
 - There will be no change of O.__class__ after creation of O, since O is 
   created as an instance of Foo_cat right away. 
 - This would work even if Foo was a Cython class. 

 However, it would be an awful lot of work to change... 

 Best regards, 
 Simon 




-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Simon King
Hi Volker,

On 2014-08-08, Volker Braun vbraun.n...@gmail.com wrote:
 IMHO the majority of Sage doesn't actually use dynamic category refinement 

I was not talking about dynamic category *refinement*. But so-called
dynamic classes (that are created on the fly) are fundamental for the
category framework to work. And since you suggested using metaclasses: A
metaclass that combines a given class Foo with methods inherited from
parent classes of categories does exactly the same. The metaclass
would return the exact same dynamic class that is currently used to
override self.__class__.

 and/or make the category depend on the arguments.

But these are important cases. Modules versus vector spaces, for
example.


 You still don't need differently-named classes Foo and 
 Foo_with_category. 

I am not sure if I agree with you here. Both the actual metaclass that
you suggest and the virtual metaclass that is in use by the current
category framework takes an explicitly given class Foo (defined in some
module) and adds methods that are taken from somewhere else. Nontrivial
steps are involved to create the result. It *is* substantially different
from Foo. Therefore I believe it is honest (and less confusing) to give
it a new name, since it is *not* Foo.

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread Paul Graham
Okay. No worries, at this point nothing is very obvious to me yet! About 
how hours does it normally take for sage to build the first time? I guess i 
should of done 

./sage -br

instead of 

make

since i didnt change any third party packages, just documentation, as make 
has been running for the past 4 hours... Part of the learning process i 
suppose.

On Friday, August 8, 2014 12:40:54 AM UTC-7, Jeroen Demeyer wrote:

 On 2014-08-08 09:15, kcrisman wrote: 
  You have to do sage -b first, though I don't know if this is well 
  advertised. 

 Or even easier, you can replace 

 $ sage -b 
 $ sage --docbuild developer html 

 by the simple command 

 $ make 

 And sorry to state the obvious, but you might need to hit the refresh 
 button on your browser. 


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Volker Braun
On Friday, August 8, 2014 8:10:32 PM UTC+1, Simon King wrote: 

 metaclass that combines a given class Foo with methods inherited from 
 parent classes of categories does exactly the same.


Not quite, metaclasses don't have to use the inheritance crutch to combine 
the actual class read from the library with a dynamic class. You can just 
generate any class you want directly, with the method layout that you want.

Therefore I believe it is honest (and less confusing) to give 
 it a new name, since it is *not* Foo. 


Having a class name that is nowhere in the sources appear out of nothing is 
utterly confusing. John has quite some experience developing Sage. It would 
of course be less confusing to have the actual name shown, duh. Right now 
you can only figure this thing out by reading the category source code, and 
it is often not a pretty sight.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Background documentation

2014-08-08 Thread Jeroen Demeyer

Hello,

Perhaps move the .tex file into the Sage source tree as a separate file, 
in the same directory as the .py/.pyx file? That makes it accessible but 
still it will not be in anybody's way.


Jeroen.

--
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: category weirdness

2014-08-08 Thread John Cremona
I don't have anything to contribute to the discussion which my
stupidity started, except to say that I was so distracted by the class
name being different to what I expected that I did not notice the
simple typo.

John

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread Paul Graham
I end up getting a permission denied error after running like this:

user1@computer0:~/sage$ make


I tried doing other things so the exact message went away but i know it 
said permission error.

THen i tried doing:

user1@computer0:~/sage$ sudo sage -b

user1@computer0:~/sage$ sudo sage --docbuild developer html

but 
file:///usr/lib/sagemath/src/doc/output/html/en/developer/sage_manuals.html 
, still doesnt show my changes...

Am i modifying the wrong file 
/home/user1/sage/src/doc/en/developer/sage_manuals.rst ? Should i instead 
be modifying /usr/lib/sagemath/src/doc/en/developer/sage_manuals.rst? It 
says permission denied if i try to edit and save that one...


On Friday, August 8, 2014 12:45:37 PM UTC-7, Paul Graham wrote:

 Okay. No worries, at this point nothing is very obvious to me yet! About 
 how hours does it normally take for sage to build the first time? I guess i 
 should of done 

 ./sage -br

 instead of 

 make

 since i didnt change any third party packages, just documentation, as make 
 has been running for the past 4 hours... Part of the learning process i 
 suppose.

 On Friday, August 8, 2014 12:40:54 AM UTC-7, Jeroen Demeyer wrote:

 On 2014-08-08 09:15, kcrisman wrote: 
  You have to do sage -b first, though I don't know if this is well 
  advertised. 

 Or even easier, you can replace 

 $ sage -b 
 $ sage --docbuild developer html 

 by the simple command 

 $ make 

 And sorry to state the obvious, but you might need to hit the refresh 
 button on your browser. 



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Background documentation

2014-08-08 Thread Volker Braun
If its 2 pages with 12pt font and normal margins then I would think its 
small enough to be put into a docstring. Of course could be a lot more. 
Putting it into  a separate file is also OK, but then I would suggest to 
put it into a notes subdirectory. There is also at least one 
precedent: src/sage/misc/notes/bernoulli_mod_p.tex (though I would prefer 
it to be in src/sage/rings/notes/bernoulli_mod_p.tex).



On Friday, August 8, 2014 9:00:45 PM UTC+1, Jeroen Demeyer wrote:

 Hello, 

 Perhaps move the .tex file into the Sage source tree as a separate file, 
 in the same directory as the .py/.pyx file? That makes it accessible but 
 still it will not be in anybody's way. 

 Jeroen. 


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Simon King
Hi Volker,

On 2014-08-08, Volker Braun vbraun.n...@gmail.com wrote:
 metaclass that combines a given class Foo with methods inherited from 
 parent classes of categories does exactly the same.


 Not quite, metaclasses don't have to use the inheritance crutch to combine 
 the actual class read from the library with a dynamic class. You can just 
 generate any class you want directly, with the method layout that you want.

It needs to add some methods to the class Foo. Whether it does so by
creating a dynamic class whose bases are (1) Foo and (2) some parent
class, or whether it does so by taking methods from the parent class and
putting them into Foo's __dict__, is a boring detail.

 Having a class name that is nowhere in the sources appear out of nothing is 
 utterly confusing.

I admit that I found it very confusing myself. And it was the reason for
me to put some work into sage.misc.sageinspect, so that ?? shows the
correct sources more reliably.

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread John H Palmieri


On Friday, August 8, 2014 2:09:36 PM UTC-7, Paul Graham wrote:

 I end up getting a permission denied error after running like this:

 user1@computer0:~/sage$ make


 I tried doing other things so the exact message went away but i know it 
 said permission error.

 THen i tried doing:

 user1@computer0:~/sage$ sudo sage -b

 user1@computer0:~/sage$ sudo sage --docbuild developer html

 but 
 file:///usr/lib/sagemath/src/doc/output/html/en/developer/sage_manuals.html 
 , still doesnt show my changes...

 Am i modifying the wrong file 
 /home/user1/sage/src/doc/en/developer/sage_manuals.rst ? Should i instead 
 be modifying /usr/lib/sagemath/src/doc/en/developer/sage_manuals.rst? It 
 says permission denied if i try to edit and save that one...


 On Friday, August 8, 2014 12:45:37 PM UTC-7, Paul Graham wrote:

 Okay. No worries, at this point nothing is very obvious to me yet! About 
 how hours does it normally take for sage to build the first time? I guess i 
 should of done 

 ./sage -br

 instead of 

 make

 since i didnt change any third party packages, just documentation, as 
 make has been running for the past 4 hours... Part of the learning process 
 i suppose.

 On Friday, August 8, 2014 12:40:54 AM UTC-7, Jeroen Demeyer wrote:

 On 2014-08-08 09:15, kcrisman wrote: 
  You have to do sage -b first, though I don't know if this is well 
  advertised. 

 Or even easier, you can replace 

 $ sage -b 
 $ sage --docbuild developer html 

 by the simple command 

 $ make 

 And sorry to state the obvious, but you might need to hit the refresh 
 button on your browser. 


First, if you're just modifying .rst files, you shouldn't have to run 
'make' or 'sage -b'; just rebuilding the documentation should be good 
enough. Second, if when you rebuild the documentation, it tells you to look 
in /usr/lib/..., then you should be editing the files in /usr/lib/... On 
the other hand, if you want to edit files in /home/me/sage/src/..., then 
you should run '/home/me/sage/sage --docbuild ...' to rebuild them.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: category weirdness

2014-08-08 Thread Volker Braun
On Friday, August 8, 2014 11:06:03 PM UTC+1, Simon King wrote:

 It needs to add some methods to the class Foo. Whether it does so by 
 creating a dynamic class whose bases are (1) Foo and (2) some parent 
 class, or whether it does so by taking methods from the parent class and 
 putting them into Foo's __dict__, is a boring detail. 


I agree that its an implementation detail (you can make it work either 
way). But I still claim that the way it is implemented right now is not 
ideal for new developers. And, really, being developer-friendly is just as 
important as correctness when you what to design a basic framework that 
everybody is forced to use.

Plain Python also adds additional attributes to classes that are not 
defined in the source, for example __new__. This is a familiar fact to 
every Python programmer. We could have built upon that convention and added 
__category__ attributes through a Sage-specific metaclasses. But no, our 
implementation of additional autogenerated attributes is totally different. 

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] On scientific computing, Python and Julia

2014-08-08 Thread rjf


On Thursday, August 7, 2014 10:55:37 PM UTC-7, Robert Bradshaw wrote:

 On Thu, Aug 7, 2014 at 9:02 AM, rjf fat...@gmail.com javascript: 
 wrote: 
  
  
  On Wednesday, August 6, 2014 8:11:21 PM UTC-7, Robert Bradshaw wrote: 
  
  
  
  The are two representations of the same canonical object. 
  
  
  The (computer algebra) use of the term, as in simplified to a canonical 
  form  means 
  the representation is canonical.  It doesn't make much sense to claim 
 that 
  all these 
  are canonical:   1+1, 2,  2*x^0,  sin(x)^2+cos(x)^2 + exp(0). 

 The point was that there's a canonical domain in which to do the 
 computation. 


I have not previously encountered the term canonical domain.  There is
a CAS literature which includes the concept of simplification to a 
canonical form.
There is also a useful concept of a zero-equivalence test, whereby E1-E2
can be shown to be zero, although there is not necessarily a simplification
routine that will canonically simplify  E1  to E3 and also E2 to E3.
 


   And what structure is that?  Does Sage know about   Z_{nonprime} ? 
  
  Of course, as illustrated. 
  
  sage: Integers(13^1024) 
  Ring of integers modulo 4764...1 
  
  
  How much does it know? Does it know that it is not a field, but that 
  Integers(13) is a field? 

 sage: Integers(13).is_field() 
 True 
 sage: Integers(13^1024).is_field() 
 False 

   I'm still confused.   Is the term Real Field in Sage  the (or some) 
   real 
   field? 
   
   If it is an approximation to a field, but not a field, why are you 
   calling 
   it a field? 
  
  Because it's shorter to type and easier to find/discover than 
  ApproximateRealField or something like that. 
  
   If that doesn't get you in trouble, why doesn't it?  Does Real Field 
   inherit 
   from 
   Field?  Does every non-zero element have an inverse? 
  
  Of course it suffers from the same issues that (standard) floating 
  point numbers do in any language, user be aware (and we at least 
  document that). 
  
  And you know that everyone reads the documentation? 
  No, it doesn't suffer from the same issues as in other languages, 
 because 
  those other languages probably don't refer to it as a field. 

 The issues of floating point errors and rounding are much larger than 
 the question of whether every element has an inverse. You seem very 
 fixated on the name. 


Just that for a mathematician to call something a field when it isn't
would, I think, be a serious mistake.  You seem to think that it is
ok for a computer system to do so.I certainly agree that there are
more important issues with floating point computation than the
fact that these numbers do not constitute a real closed field.
 


 We also have an object called the ring of integers, but really it's 
 the ring of integers that fits into the memory of your computer. 
 Should we not call it a Ring? 


The domain of arbitrary-precision integers is an excellent model of the
ring of integers.  It is true that one can specify a computation that would
fill up the memory of all the computers in existence. or even all the atoms
in the (known?) universe.  Presumably a well-constructed support system
will give an error message on much smaller examples.   I assume 
that your Real Field  operation of   division would give an error if the
result is inexact.


   Does Sage have other um, approximations, in its nomenclature? 
  
  Sure. RealField(123)[x]. Power series rings. P-adics. 
  
  These approximations are approximations by their nature.  If you are 
  computing with a power series, the concept inherently includes an error 
 term 
  which you are aware of.  Real Field is (so far as I know) a concept that 
  should have the properties of a field.  The version in Sage does not. 
  It's like saying someone isn't pregnant.  well only a little pregnant. 

 They're no more approximate by nature than the real numbers. 


Huh?  How so? I was not aware that real numbers (at least the ones
that you can construct) are approximate by nature.  But maybe you
can direct me to some reference on this.


 The p-adic numbers form a field. For any choice of representation some 
 of them can be represented exactly on a computer, most can't. When 
 doing computations with p-adic numbers one is typically chooses a 
 precision (e.g. how many digits, not unlike a choice of number of 
 bits) to use. 

 Power series (to make things concrete, say the power series in one 
 variable over the integers) form a ring. For any choice of 
 representation some of them can be represented exactly on a computer, 
 most can't. When doing computations with power series one is typically 
 chooses a precision (e.g. how many terms, not unlike a choice of 
 number of bits) to use. 


Truncated power series with coefficients that are typically exact rational
numbers  (but could be, you say , elements of a finite field)  form a
computation structure that has exact operations.   Just because you
associate some other concept that 

Re: [sage-devel] Re: Cant see changes made to developer guide when rebuilding?

2014-08-08 Thread Paul Graham
Okay ya i did:

user1@computer0:~$ /home/user1/sage/sage --docbuild developer html

and that worked great, thanks :)

On Friday, August 8, 2014 3:11:46 PM UTC-7, John H Palmieri wrote:



 On Friday, August 8, 2014 2:09:36 PM UTC-7, Paul Graham wrote:

 I end up getting a permission denied error after running like this:

 user1@computer0:~/sage$ make


 I tried doing other things so the exact message went away but i know it 
 said permission error.

 THen i tried doing:

 user1@computer0:~/sage$ sudo sage -b

 user1@computer0:~/sage$ sudo sage --docbuild developer html

 but 
 file:///usr/lib/sagemath/src/doc/output/html/en/developer/sage_manuals.html 
 , still doesnt show my changes...

 Am i modifying the wrong file 
 /home/user1/sage/src/doc/en/developer/sage_manuals.rst ? Should i instead 
 be modifying /usr/lib/sagemath/src/doc/en/developer/sage_manuals.rst? It 
 says permission denied if i try to edit and save that one...


 On Friday, August 8, 2014 12:45:37 PM UTC-7, Paul Graham wrote:

 Okay. No worries, at this point nothing is very obvious to me yet! About 
 how hours does it normally take for sage to build the first time? I guess i 
 should of done 

 ./sage -br

 instead of 

 make

 since i didnt change any third party packages, just documentation, as 
 make has been running for the past 4 hours... Part of the learning process 
 i suppose.

 On Friday, August 8, 2014 12:40:54 AM UTC-7, Jeroen Demeyer wrote:

 On 2014-08-08 09:15, kcrisman wrote: 
  You have to do sage -b first, though I don't know if this is well 
  advertised. 

 Or even easier, you can replace 

 $ sage -b 
 $ sage --docbuild developer html 

 by the simple command 

 $ make 

 And sorry to state the obvious, but you might need to hit the refresh 
 button on your browser. 


 First, if you're just modifying .rst files, you shouldn't have to run 
 'make' or 'sage -b'; just rebuilding the documentation should be good 
 enough. Second, if when you rebuild the documentation, it tells you to look 
 in /usr/lib/..., then you should be editing the files in /usr/lib/... On 
 the other hand, if you want to edit files in /home/me/sage/src/..., then 
 you should run '/home/me/sage/sage --docbuild ...' to rebuild them.

 -- 
 John



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.