[sage-devel] Re: Start a Sage session from a session of its own Python interpreter ?

2018-08-15 Thread Pedro Cruz



>>> from sage.all import *

>>> exec(preparse(r"""
... a = 2^3
... print a
... """))8>>> a8>>> exit> py$a8

or also:

>>> load("some.sage")  #I believe all sage power is available in load() but not 
>>> all in exec(preparse()).



segunda-feira, 13 de Agosto de 2018 às 18:07:41 UTC+1, Emmanuel Charpentier 
escreveu:
>
> Motivation : see this ask.sagemath.org question 
> 
> .
> Tl;dr : I want to call sage from the R reticulate 
>  package in order to create mixed 
> text/R/Sage documents. 
>
>- I am aware that Sagetex allows this, at least when using Sage's R in 
>a \LaTeX document.
>- But this solution doesn't extend to noweb Markdown documents, which 
>are more and more in demand (Web pages, ebooks, other interactive gadgets).
>- I have checked that the \LaTeX--> Markdown/whatever conversion 
>currently doable with pandoc or similar tools is cumbersome to the extreme 
>and/or loses a lot of information.
>
> Done so far : when used as the "Python" interpreter, Sage starts a Python 
> session of its own interpreter (i. e. doesn't start the usual IPython 
> session). The various environment variables are correctly defined.
>
> Thanks to Thierry Monteil, I have been able to create this Sage IPython 
> session, with correct initialization (preparsing, imports, etc...). I have 
> checked that this session can access  R objects, and that the R session can 
> access objects created in Sage.
>
> But this is insufficient :
>
>- The Sage session does not (re-)starts automatically : one has to 
>explicitly call IPython.embed(). Not a problem when tran manually ; 
>problematic for the intended use (creating Sage code chunks in a noweb 
>document).
>- To get back to R, you have to exit twice : from the IPython session 
>then from the Python session. Again not a problem in interactive use, 
> again 
>a serious problem for the intended use.
>
> So the question is : how can one *replace* the Python REPL  with Sage's ? 
> A serious look at $SAGE_ROOT/src/sage/repl/ipython_extension.py wasn't 
> specially enlightening...
>
> Any ideas ?
>
> [ Note that this answer is necessary to the "right" function, but not 
> sufficient : the name of the Python object interfacing Python to the 
> **calling** R session is, unfortunately "r". Which is the standard name 
> we have picked for our **called** R interpreter... So some r-handling 
> will be necessary from reticulate's side. Keeping the distinction between 
> those may be necessary (e. g. : reusing old code...).
> But I feel that asking for a patch has better chances if we "do our 
> homework first", by solving *our* side of the problem *before* asking for 
> help... ]
>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: How to make package managers cry

2018-05-09 Thread Pedro Cruz
Thank you,
Pedro
(not in sage-packaging)

terça-feira, 8 de Maio de 2018 às 23:21:29 UTC+1, François Bissey escreveu:
>
> Forwarding this from on another list. I was going to only post it 
> to sage-packaging but I really think it belongs here. 
>
> PDF: 
>
> https://fosdem.org/2018/schedule/event/how_to_make_package_managers_cry/attachments/slides/2297/export/events/attachments/how_to_make_package_managers_cry/slides/2297/how_to_make_package_managers_cry.pdf
>  
>
> youtube video of the presentation at fosdem (must watch) 
> https://www.youtube.com/watch?v=NSemlYagjIU 
>
> François

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Python notebooks/worksheets in education

2017-06-22 Thread Pedro Cruz
Thanks,
Pedro

quarta-feira, 21 de Junho de 2017 às 18:34:03 UTC+1, William escreveu:
>
> There are some good questions that Thomas Kluyver asks here in 
> preparation for a talk he is giving at EuroPython on Monday: 
>
> https://groups.google.com/forum/#!topic/jupyter-education/bM502mn5LtA 
>
> about how people use interactive python notebooks in education and 
> teaching.   People who have used them might want to join the mailing 
> list and share some of their experiences (like I just did). 
>
>  -- William 
>
> -- 
> William (http://wstein.org) 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] broken: http://old.files.sagemath.org/src-old/

2017-05-11 Thread Pedro Cruz
Thank you.
I've got the file I was looking for.
Pedro

quarta-feira, 10 de Maio de 2017 às 15:32:57 UTC+1, Harald Schilly escreveu:
>
> Hi, yes, the url is correct and file is hosted at 
> http://old.files.sagemath.org/src-old/ 
>
> The only problem was the server wasn't running. I don't know why, 
> something bad must have happened on the server. 
>
> @william, yes, those old tarballs are stored on GCS, too.  It's too 
> expensive to use it for hosting, though. 
>
> -- harald 
>
>
> On Wed, May 10, 2017 at 12:45 AM, William Stein <wst...@gmail.com 
> > wrote: 
> > Hi, 
> > 
> > I *have* a USB drive with all these files still.  It's 36GB of tarballs, 
> from 
> > 
> > sage-v0.3-2005-04-21-src.tar to sage-6.5.tar.gz 
> > 
> > I've posted them here so you can grab the one you want: 
> > 
> > 
> https://k8s.sagemath.org/187e8e97-d814-44c7-a8a5-ca9da39e5234/raw/src-old/index.html
>  
> > 
> > Any new thoughts about to host this stuff? 
> > 
> > Harald: what about uploading them to Google Cloud Storage? 
> > 
> > William 
> > 
> > 
> > On Tue, May 9, 2017 at 8:50 AM, kcrisman <kcri...@gmail.com 
> > wrote: 
> >> 
> >> 
> >> On Monday, May 8, 2017 at 10:36:55 AM UTC-4, William wrote: 
> >>> 
> >>> On Mon, May 8, 2017 at 7:17 AM, Pedro Cruz <pedrocr...@gmail.com> 
> wrote: 
> >>> > Hello, 
> >>> > 
> >>> > I'm looking for version 5.2 and the above link is broken in master 
> >>> > www.sagemath.org pages. 
> >>> > 
> >>> > Some emails, in this forum, are also pointing to that link. 
> >>> > 
> >>> > Where can I find SageMtath 5.2 to try to compile it on Ubuntu 16.04? 
> >>> 
> >>> That's disturbing.  I don't know what the answer is. 
> >>> 
> >> 
> >> I believe that in this very forum some people discussed this and 
> although 
> >> some people (well, me) said it wasn't a good idea, the rest said it 
> wasn't 
> >> worth keeping.  If I recall this - see 
> >> 
> https://groups.google.com/forum/#!searchin/sage-devel/old$20tarballs%7Csort:date/sage-devel/WwguaTyKhE0/4YwXautvJLYJ
>  
> >> from a couple years ago, but that is not the discussion I am thinking 
> of. 
> >> 
> >> -- 
> >> 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+...@googlegroups.com . 
> >> To post to this group, send email to sage-...@googlegroups.com 
> . 
> >> Visit this group at https://groups.google.com/group/sage-devel. 
> >> For more options, visit https://groups.google.com/d/optout. 
> > 
> > 
> > 
> > -- 
> > William (http://wstein.org) 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] broken: http://old.files.sagemath.org/src-old/

2017-05-08 Thread Pedro Cruz
Hello,

I'm looking for version 5.2 and the above link is broken in master 
www.sagemath.org pages.

Some emails, in this forum, are also pointing to that link.

Where can I find SageMtath 5.2 to try to compile it on Ubuntu 16.04?

Thank you.

Pedro


-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: how we develop sage

2016-04-12 Thread Pedro Cruz
(1) Sage developers could be better informed of what are they are going to 
affect if sage, as an "author tool",  send usage statistics about each 
"sage-lib" related function:

- Author should put sage in "send usage statistics mode"
- The same author would be warned if any of those functions starts to be 
deprecated.
- And maybe, if authors freely send files to be kept and seen as "testing 
examples" like in "sage -t .sage"


But after a new deprecation warning, I'm thinking of implement one of this 
solutions to my code:

(2) A tool to automatically change the deprecated "simplify_exp" for 
"canonicalize_radical" inside sage files;

(3) Create my own local "simplify_exp" that mimics original "simplify_exp" 
because here authors enjoy applying "simplify_exp" to exponential 
expressions.

Pedro
(a developer of a package that uses sagemath and will be in pypi as 
suggested)


sexta-feira, 8 de Abril de 2016 às 17:43:46 UTC+1, William escreveu:
>
> On Fri, Apr 8, 2016 at 9:33 AM, Luca De Feo  > wrote: 
> >> How often do you feel that changes in Sage breaks your code? 
> > 
> > Looking at my log (this project 
> > https://github.com/defeo/ss-isogeny-software) 
> > 
> > - Sage 6.2: module renamed in Pari/GP interface (without deprecation, as 
> far 
> > as I recall) 
> > - Sage 6.4: frankly, I don't know, but possibly a change in the finite 
> > fields implementation 
> > - Sage 6.7: changes in cython, not really Sage's fault, I guess 
> > - Sage 6.7: changes in the finite fields implementation (with proper 
> > deprecation, this time) 
> > - Sage 6.10: changes in richcmp (did not get deprecation warnings, but 
> the 
> > change concerns an internal function) 
> > - Sage 7.1: affected by #19941 (properly deprecated, note that 7.1 is 
> stable 
> > right now, but not yet in SMC) 
> > 
> > It may be argued that I'm taking risks because I sometimes fiddle with 
> "the 
> > internals" of Sage, but one other problem of Sage is that it does not 
> define 
> > clearly what's the public API and what's internal. 
>
> +1 -- this "one other problem of Sage is that it does not define 
> clearly what's the public API and what's internal." is a HUGE problem 
> -- and we're not aware of it because "user code" is typically private. 
>
> If there were a large body of pip-installable packages, which are user 
> code, this would help *define* what the public API of Sage really is, 
> and also give us a much larger body of code to test against before 
> making new releases. 
>
> As an example, when working on 
>
>   https://github.com/williamstein/sage_modabvar 
>
> the first thing I noticed in that from sage-6.10 to sage-7.x 
>
>import sage.rings.arith 
>
> completely BROKE.  It became "import sage.arith". 
>
> This is (who knows?) a change in the public api of the core sage 
> library.  Maybe it's a gratituous one, and in this case one I'm 
> puzzled by why this change was made.  (I wrote sage.rings.arith in the 
> first place, and it was meant to be some misc arith needed to 
> implement rings.  Why move it to its own top level module like that?) 
>
> By writing Python packages that depend on "the core sage library" we 
> will be forced to define what the core library is and stabilize it. 
> If you guys want Sage to survive/thrive, this **MUST HAPPEN**.   The 
> core sage library should -- like with Python -- be the place where 
> code, which has been tested/used by people and got stable, goes to 
> stay stable (at least API-wise).  Like the standard Python library. 
>
> William 
>
> > 
> > Luca 
> > 
> > -- 
> > 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+...@googlegroups.com . 
> > To post to this group, send email to sage-...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] catch a "sagemath" DeprecationWarning

2016-04-08 Thread João Pedro Cruz
Hello,

I was expecting the following to catch the DeprecationWarning

import warnings

warnings.filterwarnings('error',category=DeprecationWarning)
try:
print (exp(x)*exp(3*x)).simplify_exp()   #example with exp function
except DeprecationWarning:
print 'MegBook.py say: exercise needs review!'

but it does not. I still got

DeprecationWarning: simplify_exp is deprecated. Please use 
canonicalize_radical instead.
See http://trac.sagemath.org/11912 for details.
  print (exp(x)*exp(_sage_const_3 *x)).simplify_exp()   #example with exp 
function


*How can we catch this "type" of* DeprecationWarning  ?

I've checked 
   https://github.com/sagemath/sage/blob/master/src/sage/misc/superseded.py
but reached no conclusion.

I appreciate help,
Thank you.

Pedro


The following works easy:
try:
raise DeprecationWarning
except DeprecationWarning :
print 'Got it'


-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: output results depending on platform

2016-03-08 Thread João Pedro Cruz
oh, that simple!! 
I should not program at late hours (portugal) :)
Thank you !
Pedro

terça-feira, 8 de Março de 2016 às 00:41:22 UTC, Nils Bruin escreveu:
>
> On Monday, March 7, 2016 at 4:22:04 PM UTC-8, João Pedro Cruz wrote:
>>
>> Hello,
>>
>> I would like to output results with the following code:
>> if MEGUA_PLATFORM=='sagews':
>> fullpath = os.path.join(self.working_dir, 
>> self.unique_name()+'.tex')
>> salvus.file(fullpath)
>> else: #MEGUA_PLATFORM=='commandline'
>> fullpath = os.path.join(self.working_dir, 
>> self.unique_name()+'.pdf')
>> print "exlatex module: open pdf file",fullpath
>>
>>
>>
>> and this code is inside a module and "MEGUA_PLATFORM" got value in a 
>> configuation file.
>>
>> How to import "salvus"  identifier to use salvus.file() into some module ?
>>
>  
> The usual would be "import salvus". Is your issue that this command may 
> fail if MEGUA_PLATFORM!='sagews'?
> You could just put the "import salvus" line directly above 
> "salvus.file(...)". That only has a slight runtime penalty for being 
> executed multiple times.
> If that penalty is too high (I doubt it would be), you can just do the 
> import one time, guarded by an "if":
>
> if MEGUA_PLATFORM=='sagews':
> import salvus
>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] output results depending on platform

2016-03-07 Thread João Pedro Cruz
Hello,

I would like to output results with the following code:
if MEGUA_PLATFORM=='sagews':
fullpath = os.path.join(self.working_dir, 
self.unique_name()+'.tex')
salvus.file(fullpath)
else: #MEGUA_PLATFORM=='commandline'
fullpath = os.path.join(self.working_dir, 
self.unique_name()+'.pdf')
print "exlatex module: open pdf file",fullpath



and this code is inside a module and "MEGUA_PLATFORM" got value in a 
configuation file.

How to import "salvus"  identifier to use salvus.file() into some module ?

Thank you,
Pedro

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Sage code for educational purposes only?

2015-02-26 Thread Pedro Cruz

+1 for the  package educational-algorithms but called 
educational-packages or educational-library.

MathSciNet catalog has the category Mathematics education

http://www.ams.org/mathscinet/msc/msc2010.html?t=97-XX

being the last topic after all the mathematical edge cutting works.

This could inspire an educational-library (this name is maybe more 
general than just algorithms).

Pedro

 


On Thursday, February 26, 2015 at 6:23:36 AM UTC, Jori Mantysalo wrote:

 On Wed, 25 Feb 2015, Jeroen Demeyer wrote: 

  Should there be code in Sage which is extremely slow and for educational 
  purposes only? 

 As an additional package educational-algorithms? 

 -- 
 Jori Mäntysalo 


-- 
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: 10 year anniversary of Sage

2015-01-21 Thread Pedro Cruz
Dear William and developers,

I was just using Sage to help the (re-)creation of problems for my classes 
at this time Sage is making 10 years. 

Congratulations for the concept and working persistence that kept this 
project growing for the last 10 years.

Thanks to all developers and contributors for making sage as it is now.

Pedro



On Tuesday, January 20, 2015 at 7:48:09 PM UTC, William wrote:

 Hi, 

 If you look at http://wstein.org/sage_old/ you'll find the first few 
 tarballs of Sage I ever released.  The first one [1] has a README that 
 starts: 

 -- 
  SAGE -- Software for Algebra and Geomtry 
  Copyright (C) 2004 William Stein w...@math.harvard.edu javascript: 


  Distributed under the terms of the GNU General Public License (GPL) 
  See http://www.gnu.org/licenses/ 
 -- 

 This is the README.txt file for the source distribution of SAGE, 
 version 0.1, 2005-01-23. 

 ... 

 I think this was the first-ever public release of Sage.   I made it 
 inspired by a conversation at the 2005 JMM with David Joyner, who saw 
 me working on my private code there. 

 Based on that date, we could say that Sage will be 10 years old this 
 Friday.Alternatively, it seems the first tarball I posted has the 
 date Feb 28, 2005. 



 [1] http://wstein.org/sage_old/sage-2005-02-28-2112-src-0.1.tar 


 -- 

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


-- 
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] How to make a gallery of pairs code and sample ?

2014-01-23 Thread Pedro Cruz
Good morning,

in the context of Sage and Sphinx documentation system (or other doc 
system)  is there any direct way to do something like the TikZ community is 
doing ( http://www.texample.net/tikz/examples/ ) ?

We are looking for a ready to use framework. 
The problem with Sphinx is that it puts thinks vertically like in 
http://www.sagemath.org/doc/a_tour_of_sage/ .

Thank you. 
Pedro.





-- 
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/groups/opt_out.


[sage-devel] Re: documentation with SetPartitionsAk(k)

2013-11-04 Thread Pedro Cruz
Dear Volker,

I will try not to import all from sage and import only those modules needed.

Thank you for support.

Pedro

On Saturday, November 2, 2013 7:23:25 PM UTC, Volker Braun wrote:

 You should never from sage.all import *. For starters, that is already 
 imported in the doctest framework. The doctest framework might have 
 redefined something for doctesting purposes.



 On Saturday, November 2, 2013 5:51:47 PM UTC, Pedro Cruz wrote:

 Dear Sage 5.12 developers,

 when using 

  sage -docbuild pt/megua html 

 we are getting the right documentation of our module but in the middle 
 (and we believe is after this line):

 from sage.all import *

 we are getting documentation from  functions like: SetPartitionsAk(k) 
 ou SetPartitionsPRk(*k*) and many more similar but we are not 
 using/calling them.

 This effect can be seen here:

 https://dl.dropboxusercontent.com/u/10518224/megua/ur.html

 Please, check for SetPartitionsAk in the middle of the document.

 What could be wrong or what should I do?

 Thank you.

 Pedro Cruz





-- 
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/groups/opt_out.


[sage-devel] documentation with SetPartitionsAk(k)

2013-11-02 Thread Pedro Cruz
Dear Sage 5.12 developers,

when using 

 sage -docbuild pt/megua html 

we are getting the right documentation of our module but in the middle (and 
we believe is after this line):

from sage.all import *

we are getting documentation from  functions like: SetPartitionsAk(k) ou 
SetPartitionsPRk(*k*) and many more similar but we are not using/calling 
them.

This effect can be seen here:

https://dl.dropboxusercontent.com/u/10518224/megua/ur.html

Please, check for SetPartitionsAk in the middle of the document.

What could be wrong or what should I do?

Thank you.

Pedro Cruz



-- 
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/groups/opt_out.


[sage-devel] cloud.sagemath.org, Sage Notebook, command line, etc

2013-07-15 Thread Pedro Cruz
Hello,

what sequence of instructions could tell what Sage 5.10 user-interface is 
currently being used ?

Possible answers are:

 - cloud.sagemath.org
 - Sage Notebook
 - linux command line
 - windows command line (?)
 - cygwin command line (?)
 - new others...

Long ago I used to check if variable
   sage.plot.plot.EMBEDDED_MODE
is defined to see if notebook is being used.

Thank you,
Pedro





-- 
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/groups/opt_out.




[sage-devel] Re: Touch Interacts on iOS

2012-01-22 Thread Pedro Cruz
Can people test this functionality before we try to add it to the sage 
notebook? 
 If you have an iOS or
Android device, create an interact at aleph.sagemath.org and try 
manipulating the controls.  

On iPod Touch, the n^2 example,

@interact
def f(n=(1..10)):
print n^2

works well.
Pedro

-- 
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, sphinx, and external package

2011-09-16 Thread Pedro Cruz

We  would like to use Sphinx :automodule: in our sage external package that 
depends on sage library (from sage.all import *)
Because of this dependency, my local sphinx-build tries to import sage.all 
 and this error occurs:

/home/jpedro/all/meg/meg-0.2/doc/source/meg/ur.rst:6: (WARNING/2) autodoc 
can't import/find module 'meg.ur', it reported error: No module named 
sage.all, please check your spelling and sys.path

I've added all paths I know to Sphinx conf.py:
  sys.path.append('/home/jpedro/sage/devel/sage/')
  os.environ['SAGE_ROOT'] = '/home/jpedro/sage/devel/sage/'
  os.environ['LD_LIBRARY_PATH'] = '/home/jpedro/sage/devel/sage/local/lib'
but it will always produces a different error.

For Sage modules there are instructions here:
   
http://www.sagemath.org/doc/developer/sage_manuals.html#building-the-manuals

Is there a way to use Sage own sphinx-build to avoid all those path 
problems ?

Pedro

-- 
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, sphinx, and external package

2011-09-16 Thread Pedro Cruz
Well, it seems this solution works but maybe there is something simple:

Inside sphinx Makefile use:

SPHINXBUILD   = /home/jpedro/sage/sage -python 
/home/jpedro/all/meg/meg-0.2/doc/sphinx-build

where file sphinx-build file is a copy

# -*- coding: utf-8 -*-

Sphinx - Python documentation toolchain
~~~

:copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.


import sys

if __name__ == '__main__':
from sphinx import main
sys.exit(main(sys.argv))

#END

-- 
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: documentation strings

2011-09-15 Thread Pedro Cruz
Dear Minh and Keshav ,

thank you for fast answer.

There are now two facts I think new sage programmers like me would like to 
read in the development user guide:

1. An example that   ... is currently in use instead of natural ...: 
(until the fix is done).

2. An example for modules in section Beyond the Sage library:

 If you are building an external optional package please use 
 SAGE_PATH=/my/module in .bashrc.

otherwise sage -t file1.py wont find a file2.py in same folder.

Thank you,

Pedro

-- 
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: documentation strings

2011-09-15 Thread Pedro Cruz
I appreciate help on using multiline strings containing % (this is usefull 
for latex strings). In the following I want that % is not converted 
to _ip.magic.

This also affects sage docstrings (using ... for continuation). In pure 
python docstrings this is not a problem.

CASE 1

sage: txt = One
: Two
: %Three
: Four
: 
sage: txt
'One\nTwo\n_ip.magic(Three )\nFour\n'

CASE 2

sage: txt = rOne
: Two
: %Three
: Four
: 
sage: txt
'One\nTwo\n_ip.magic(Three )\nFour\n'

Pedro

-- 
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: documentation strings

2011-09-15 Thread Pedro Cruz
Thank you!


2011/9/15 Keshav Kini keshav.k...@gmail.com:
 That is an IPython bug which was fixed in 0.11:
 https://github.com/ipython/ipython/issues/114 We could perhaps backport it
 but it might make more sense to just upgrade IPython soon.

 -Keshav

 
 Join us in #sagemath on irc.freenode.net !


-- 
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: documentation strings

2011-09-14 Thread Pedro Cruz
I've search here 

http://www.sagemath.org/doc/developer/conventions.html#documentation-strings

looking for this type of docstring:


   sage: txt=r''' hello
   : this goes on '''



This does not work using sage -t module.py. 

However python works like:

r
1+1
   2
txt = r''' um
   ... ola  dois '''
print txt
 um
ola  dois 
 


How can I test multiline instructions using sage: ?

Thanks. Pedro

-- 
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: documenting a new package out of Sage Math tree.

2011-09-02 Thread Pedro Cruz
Dear Leif,

thank you for the amazing and trivial suggestion

 Adding your directory where m1.py and m2.py live to SAGE_PATH and
 running (e.g.)

This link is related:

http://ask.sagemath.org/question/415/how-do-i-get-sage-to-honor-my-pythonpath

So this info could be in Sage Developers manual.

Pedro


2011/8/25 leif not.rea...@online.de

 On 25 Aug., 10:13, Pedro Cruz pedrocruzave...@gmail.com wrote:
  Dear Maarten Derickx (and Sage developers)
 
  thank you for reply.
 
  Using:
sage -t /home/jpedro/sage/local/lib/python2.6/site-packages/
  meg/paramparse.py
  causes ImportError as before but if I use
sage -python -m doctest paramparse.py
  using  instead of sage: everything works on each module.
 
  The problem occurs in this small example:
 
  $ sage -t m1.py
 
  WHERE:
 
  FILE m1.py 
  from sage.all_cmdline import * # import sage library
  from m2 import funfun
  def square(n):
  
  Return the square of n.
   EXAMPLES::
  sage: square(2)
  8
  
  return n**2 * funfun(n)
 
  FILE m2.py -
  def funfun(n):
  return n
 
  Again, something wrong with import m2. (Sage 4.7)
  I believe that sage -t works well only:
  (1) for a single file.
  (2) for a package that is being build inside sage structure.

 Adding your directory where m1.py and m2.py live to SAGE_PATH and
 running (e.g.)

 sage -t /path/to/m1.py

 should just work.


 -leif

 --
 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] documenting a new package out of Sage Math tree.

2011-08-25 Thread Pedro Cruz
Dear Maarten Derickx (and Sage developers)

thank you for reply.

Using:
  sage -t /home/jpedro/sage/local/lib/python2.6/site-packages/
meg/paramparse.py
causes ImportError as before but if I use
  sage -python -m doctest paramparse.py
using  instead of sage: everything works on each module.


The problem occurs in this small example:

$ sage -t m1.py

WHERE:

FILE m1.py 
from sage.all_cmdline import * # import sage library
from m2 import funfun
def square(n):

Return the square of n.
 EXAMPLES::
sage: square(2)
8

return n**2 * funfun(n)

FILE m2.py -
def funfun(n):
return n

Again, something wrong with import m2. (Sage 4.7)
I believe that sage -t works well only:
(1) for a single file.
(2) for a package that is being build inside sage structure.

I'm going to post this for more people to read it since this is a reply of a 
reply.

Yet, if anything occurs please let me know.
Thanks,

Pedro

-- 
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] documenting a new package out of Sage Math tree.

2011-08-24 Thread Pedro Cruz
Dear William and Sage developers,

I request help once more about testing sage -t  a package that was not 
installed on Sage using sage -i.

The package name we are developing is named meg and is almost ready. 
Testing (sage -t) is this last step.
All of the package code is on /home/jpedro/all/meg/meg-0.2/  (a set of 16 
*.py small modules)

To use it while writing/changing code I've created a symbolic link to
   /home/jpedro/all/meg/meg-0.2/
from 
  /home/sage/local/lib/python2.6/site-packages/meg
and using
sage: from meg.all import *
all package functionality is working well.

EXCEPT that
 sage -t some_module.py 
is producing details at message bottom.

Must I do the following cycle ?
1. pack (tar)
2. install
3. issue sage -t some_module.py
4. change some_module.py
5. go to 1.

What am I missing here 
http://www.sagemath.org/doc/developer/producing_spkgs.html ?

Thank you.

Pedro

MORE DETAILS:

jpedro@noblepath-ubuntu:~/all/meg/meg-0.2/meg$ sage -t -force_lib 
paramparse.py 
sage -t -force_lib paramparse.py  
**
File /home/jpedro/all/meg/meg-0.2/meg/paramparse.py, line 25:
sage: from meg.paramparse import parameter_change
Exception raised:
Traceback (most recent call last):
  File /home/jpedro/sage/local/bin/ncadoctest.py, line 1231, in 
run_one_test
self.run_one_example(test, example, filename, compileflags)
  File /home/jpedro/sage/local/bin/sagedoctest.py, line 38, in 
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
  File /home/jpedro/sage/local/bin/ncadoctest.py, line 1172, in 
run_one_example
compileflags, 1) in test.globs
  File doctest __main__.example_0[2], line 1, in module
from meg.paramparse import parameter_change###line 25:
sage: from meg.paramparse import parameter_change
  File 
/home/jpedro/sage/local/lib/python/site-packages/meg/paramparse.py, line 
53, in module
from meg.all import *
  File /home/jpedro/sage/local/lib/python/site-packages/meg/meg.py, 
line 78, in module
from meg.localstore import LocalStore
ImportError: No module named localstore

-

But there exists a localstore.py module in meg directory.

END.

-- 
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] documenting a new package out of Sage Math tree.

2011-08-23 Thread Pedro Cruz
The -force_build did not work and I believe it's a problem of how to use 
import on new Sage packages.

Recalling first message, I want to build a new optional package based on 
*.py modules.
It seems that 
   sage -t my_module.py
moves my_module.py to a .sage/tmp folder and there executes the sage: 
examples.

But if   my_module.py  contains import my_other_module a problem came up 
because my_other_module.py is not going to be moved to the .sage/tmp 
directory.

What design principle am I missing?

Thank you,
Pedro

-- 
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] documenting a new package out of Sage Math tree.

2011-08-19 Thread Pedro Cruz

I am creating a new package in python separated from Sage tree (following 
[1]) but depends entirely on Sage Math library (and also on Sage Notebook), 
However
   sage -t somemodule.py
is not working because of imports. == But using this package normally 
causes no problems with imports!  

I'm following [2] for documenting python sources.

[1] http://www.sagemath.org/doc/developer/producing_spkgs.html
[2] http://www.sagemath.org/doc/developer/coding_in_python.html

Maybe sage -t somemodule.py is only when coding directly on sage tree. Is 
this the problem? 
Should I put the new package directly on Sage tree using [3] ?
[3] http://www.sagemath.org/doc/developer/walk_through.html

Any advice?
Thank you, 
Pedro 
 
During production I have created a link inside
   ~/sage/local/lib/python2.6/site-packages
to 
   ~/my_package
to avoid reinstalling the package everytime.

To test the package we wrote commands in Rest strings like:

EXAMPLE:

   sage: from new_package import MyClass
   sage: a = MyClass(10) + MyClass(12)
   MyClass(22)


-- 
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: MATLAB: viable alternative...?

2011-08-16 Thread Pedro Cruz


Dear Sage project leader,

My experience is about Sage 4.6.2:
For numerical computations I have quieted of Sage/Sagenotebook and use only 
scipy/numpy directly using vim and shell. 

Sagenotebook has the advantage of shareable over the net worksheets but the 
editing 83 functions on it became hardwork because of those jumps on screen 
and no colors. I had problems making/seeing graphics. (maybe that is not a 
problem now)
Sage has the advantage of symbolic calculus which could help confirming some 
numerical calculations but the integration with scipy/numpy needs some 
attention to know if a given parameter is in Sage world or scipy/numpy 
world. Also Sage has the problem of taking to much time to load and using 
attach reveals some problems.

This is what I remember that lead me to the decision of quiting 
sage/sagenotebook for the specific purpose of pure numerical computation. 
(matlab was never needed).

I will improve this notes as soon as a new numerical projects began. Is 
there any thematic group or wiki for numerical sage ?

Pedro Cruz

Assistant Teacher

University of Aveiro

Portugal

-- 
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] 1=2 produces a silent answer in sage notebook

2011-01-22 Thread Pedro Cruz
I was tring to remember if simple equality was = or ==.

The email is just to mention this:

#1/3 Sage command-line: (4.6)
sage: 1=2
()
TypeError: Must construct a function with a tuple (or list) of
symbolic variables.


#2/3 Sage notebook:
1=2
(returns nothing)

#3/3 Python command line:

 1=2
  File stdin, line 1
SyntaxError: can't assign to literal


Pedro

-- 
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: search_methods() to search the methods of an object

2010-10-21 Thread Pedro Cruz

Maybe there's an advantage in change from

   X.kertab  (look through ker* methods...)

to

   X.kertab  (look through methods that contain ker in name ...)

In fact, it's what

   X.tab  (look through * methods...)

do.


Pedro

On Oct 20, 5:24 am, Dan Drake dr...@kaist.edu wrote:
 Here's something that happens to me: I have an object X that has a *lot* of
 methods -- matrices and graphs, often -- and I'm wondering if X has a
 certain method. Often, I find myself doing

         X.atab  (look through a methods...)
         X.btab  (look through b methods...)

 and so on, through the alphabet. This is annoying. I don't like things
 that are annoying.

 How about a function, somewhat like search_doc, search_def, and friends,
 that accepts an object and a string, and returns methods that match that
 string? Would you find that useful?

 Here's what I just wrote. Try dropping this into sage/misc/sagedoc.py,
 and adding search_methods to all.py in that directory:

 def search_methods(x, s):
     r
     Given an object x and a string s, this returns a list of methods of
     x that contain s. A better version of this would have an option to
     include or exclude methods that begin with an underscore, do proper
     regexps, etc.
     
     return [m for m in dir(x) if s in m]

 Then you get:

 sage: m = matrix(2, [1,2,3,4])
 sage: search_methods(m, 'kernel')
 ['_decomposition_using_kernels', '_kernel_matrix_using_padic_algorithm', 
 '_kernel_matrix_using_pari', '_rational_kernel_iml', '_right_kernel_matrix', 
 '_right_kernel_trivial', 'integer_kernel', 'kernel', 'kernel_matrix', 
 'kernel_on', 'left_kernel', 'right_kernel']
 sage: g = graphs.PetersenGraph()
 sage: search_methods(g, 'loop')
 ['allow_loops', 'allows_loops', 'has_loops', 'loop_edges', 'loop_vertices', 
 'loops', 'number_of_loops', 'remove_loops']

 Thoughts? Should I open a ticket for this?

 Dan

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

  signature.asc
  1KViewDownload

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