[sage-support] Connection beetwen sage and notebook/sagemathcloud

2014-03-15 Thread Андрей Ширшов
Hello!

I decided to make a study of internationalization of error messages (python 
traceback).
I came to decision there should be next steps:
1. to find error messages at code of all functions/modules and systematize 
these messages.
2. to translate all messages and create table (maybe, .csv file).
3. to learn how notebook or sagemathcloud connect to sage.
4. to write function that catch error messages from sage to notebook or 
sagemathcloud and translate these messages.

I tried to understand how notebook connects to sage (I read source code or 
notebook_object.py, run_notebook.py and online documentation and some code 
on twisted site) but not I can't to understand how it's realized. Please 
advise me where I can read about setting and getting information beetwin 
sage and notebook. Because there isn't any way to install sagemathcloud on 
local computer I don't know how I can do such internationalization for 
sagemathcloud. Is there any way to do know how sagemathcloud connect to 
sage? Help me please.

Best regards,
Andrei Shirshov.

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


Re: [sage-support] Re: Optimizing this function with Cython

2014-03-15 Thread Robert Bradshaw
On Fri, Mar 14, 2014 at 2:03 PM, Georgios Tzanakis  wrote:
>
> On Fri, Mar 14, 2014 at 4:49 PM, Robert Bradshaw
>  wrote:
>>
>> Note that
>>
>>  L[i][rows[i]] + j %w == 0:
>>
>> would probably be just (or nearly) as fast as
>>
>>  (((L[i])[(rows[i])])+j %w)==0
>
>
> Good to know, thanks..
>
>>
>>
>> If you're going to be dealing with arrays of ints you might want to
>> look into NumPy
>
>
> Hmm.. I wish I knew that earlier, I deal with many of such arrays.
>
>>
>> and/or memory views for even more speed.
>
>
> Could you elaborate a bit on that? Or just give me a link?

https://www.google.com/search?q=numpy+cython

>> On Thu, Mar 13, 2014 at 7:58 PM, Georgios Tzanakis 
>> wrote:
>> > Hi Simon,
>> >
>> > I really appreciate your thorough answer! Indeed there was a bug and I
>> > had
>> > to do a couple of changes
>> > to the code, but I understood a lot of things about how to use Cython
>> > and
>> > was able to use it properly
>> > and have improvements. On top of that, I didn't know about the timeit
>> > function which is a life saver.
>> >
>> > Everything is clear.. Thank you, sir!
>> >
>> > Best,
>> > George
>> >
>> >
>> > On Thu, Mar 13, 2014 at 8:48 AM, Simon King 
>> > wrote:
>> >>
>> >> Hi!
>> >>
>> >> On 2014-03-12, geo909  wrote:
>> >> > But I'm still not sure how to use things properly. So, for instance,
>> >> > is
>> >> > the
>> >> > following optimization reasonable?
>> >> > (there is an ~30% increase in speed from pure python code)
>> >>
>> >> It is easy to get more.
>> >>
>> >> But first: Is there a bug in your code?
>> >>
>> >> You write
>> >> if all( [(L[i][rows[i]]+j %w)==0] ):
>> >> Thus, the argument to "all" is a list with precisely one item.
>> >>
>> >> If it is not a bug, then you should replace it with
>> >>if (L[i][rows[i]]+j%w)==0:
>> >>
>> >> I assume that it is not a bug, and thus I used this improvement in all
>> >> my
>> >> attempts that I describe below.
>> >>
>> >> > # L: A list of tuples of positive integers, each having a couple of
>> >> > hundred
>> >> > elements.
>> >> > # L itself has length at most 3 or 4.
>> >> >
>> >> > # e: A tuple of integers. e has length no more than a couple of
>> >> > hundred.
>> >> > # w a small integer
>> >>
>> >> Since there is frequent access to the items of L and e, you should tell
>> >> Cython
>> >> that L is a list and that e is a tuple.
>> >>
>> >> Also, itertools.product yields tuples, so, "rows" in your function is a
>> >> tuple. Again, there is frequent acces to the items, thus, you should
>> >> declare that rows is a tuple.
>> >>
>> >> On the other hand, commonzeros is accessed at most a couple of times,
>> >> thus, no need to make it "cdef int".
>> >>
>> >> But it seems to me that the most important line is (after removing the
>> >> needless "all") this:
>> >> if (L[i][rows[i]]+j %w)==0:
>> >>
>> >> Let's try to be particularly careful here, since it occurs in an inner
>> >> loop, and the annotation appears dark yellow.
>> >>
>> >> The items of L are tuples. Thus, one could do
>> >>(L[i])[rows[i]]+j
>> >> to make access to the tuple items faster.
>> >>
>> >> Furthermore, the items in the tuple L[i] are ints, and we want to add
>> >> it
>> >> with an int. Hence,
>> >>if (((L[i])[rows[i]])+j %w)==0:
>> >> will make it faster (actually, inserting the  makes the execution
>> >> time drop to 50% compared with a version that only has ).
>> >>
>> >> With
>> >>   L = [tuple([randint(1,10^8) for i in range(400)]),
>> >> tuple([randint(1,10^8) for i in range(300)]),
>> >> tuple([randint(1,10^8)
>> >> for i in range(500)]), tuple([randint(1,10^8) for i in
>> >> range(200)])]
>> >>   e = tuple([randint(1,10^8) for i in range(350)])
>> >>   w = 5
>> >>
>> >> and a pure Python version of your function (where I have replaced the
>> >> "all(...)" as indicated above), I get
>> >>   sage: timeit("myfunction(L,e,w)")
>> >>   5 loops, best of 3: 1.11 s per loop
>> >>
>> >> However, when cythoning your function as follows
>> >> {{{
>> >> %cython
>> >> import itertools
>> >> def myfunction(list L, tuple e, int w):
>> >> cdef int lenL = len(L)
>> >> cdef int i,j
>> >> cdef tuple rows
>> >> for rows in itertools.product(range(w), repeat=lenL):
>> >> commonzeros=0
>> >> for j in e:
>> >> for i in range(lenL):
>> >> if (((L[i])[(rows[i])])+j %w)==0:
>> >> commonzeros+=1
>> >> if commonzeros==4:
>> >> return(1)
>> >> return(0)
>> >> }}}
>> >> I get
>> >>   sage: timeit("myfunction(L,e,w)")
>> >>   5 loops, best of 3: 18.6 ms per loop
>> >>
>> >> If you now look at the annotated version of the function, you'll see
>> >> that
>> >>   for rows in itertools.product
>> >> remains dark yellow.
>> >>
>> >> So, if one wanted to optimise further, one should try to improve that.
>> >> Since you iterate over len(L) copes of range(w) (rather than over the
>> >> product of lists of different size), it should be 

[sage-support] Re: trouble with deepcopy

2014-03-15 Thread Nils Bruin
On Thursday, March 13, 2014 3:05:22 PM UTC-7, Lee Worden wrote:
>
> sage: s = symbolic_expression( 'a(x)' ) 
> sage: s.substitute_function( 
> sage.symbolic.function_factory.function('a'), 
> sage.symbolic.function_factory.function('A') ) 
> A(x) 
> sage: t = deepcopy( s ) 
>

Since symbolic expressions are not mutable, you shouldn't have a need to 
make deep copies of them. The behaviour does seem problematic, though.
The problem you are seeing stems from:

sage: sage.symbolic.function_factory.function('a') == s.operator()
True
sage: sage.symbolic.function_factory.function('a') == t.operator()
False

It looks like deep copy is a little too eager: it shouldn't make a copy of 
the function 'a', but it does. You end up with a different function 
(accessible via t.operator() ) which also prints as 'a' but isn't equal to 
the function 'a' you can create via 
sage.symbolic.function_factory.function. Basically, you got what you asked 
for: a COPY of the function, not the function itself.

Something fishy is going on, though, because

sage: a=s.operator()
sage: deepcopy(a)
a
sage: deepcopy(a) == a
True
sage: deepcopy(a) is a
False
sage: deepcopy(a)(x).substitute_function(
: sage.symbolic.function_factory.function('a'),
: sage.symbolic.function_factory.function('A') ) 
A(x)

so a function object by itself does get "deepcopied" correctly, but when 
it's sitting in an expression it is not.

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


[sage-support] sage: %runfile "test.spyx" -----------> output redirection to a file

2014-03-15 Thread Prakash Dey
sage: %runfile "test.spyx"

compiles the file "test.spyx", but output is shown in the terminal.
The output is too large.

How to redirect the output to a file like 

$ ./test.spyx > out.txt 

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


[sage-support] [ANN] OpenOpt Suite release 0.53: Stochastic programming addon now is BSD-licensed

2014-03-15 Thread dmitrey
 
  
hi all,
I'm glad to inform you about new OpenOpt Suite release 0.53:

Stochastic programming addon now 
is available for free (license: BSD)
Some minor changes

--
Regards, D.
http://openopt.org/Dmitrey

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


Re: [sage-support] How to install sagemathcloud on local computer?

2014-03-15 Thread William Stein
On Sat, Mar 15, 2014 at 6:04 AM, Андрей Ширшов  wrote:
> Hello!
> I'd like to install sagemathcloud on my own computer to lunch it and try to
> patch it.
> How can I install sagemathcloud? I downloaded files from github and tried to
> lunch it but I haven't ~/.sagemathcloud directory
> I tried to find installation instructions via Yandex and Google but I didn't
> find anything.
> Best regards, Andrei Shirshov.

Hi,

SageMathCloud is not available for local install.

 -- William


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



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

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


[sage-support] Re: How to install sagemathcloud on local computer?

2014-03-15 Thread Андрей Ширшов


> I'd like to install sagemathcloud on my own computer to lunch it and try 
> to patch it.
>

Sorry, launch, not lunch :) 

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


[sage-support] How to install sagemathcloud on local computer?

2014-03-15 Thread Андрей Ширшов
Hello!
I'd like to install sagemathcloud on my own computer to lunch it and try to 
patch it.
How can I install sagemathcloud? I downloaded files from github and tried 
to lunch it but I haven't ~/.sagemathcloud directory
I tried to find installation instructions via Yandex and Google but I 
didn't find anything.
Best regards, Andrei Shirshov.

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