Ask Your Question

wrogn's profile - activity

2022-01-16 15:33:38 +0200 received badge  Notable Question (source)
2021-09-29 22:04:29 +0200 received badge  Famous Question (source)
2021-03-01 11:52:54 +0200 received badge  Popular Question (source)
2018-03-08 19:36:10 +0200 received badge  Famous Question (source)
2017-11-07 02:42:03 +0200 received badge  Popular Question (source)
2017-11-07 02:42:03 +0200 received badge  Notable Question (source)
2017-03-17 22:21:01 +0200 received badge  Notable Question (source)
2017-03-17 22:21:01 +0200 received badge  Popular Question (source)
2017-03-01 15:47:08 +0200 asked a question Sage cell server dead after one request from client

I want to access the SAGE cell server programatically from Python 3. I found this example here, which uses the Websockets interface.

It works nice and smooth, but only for exactly one request, because after that the execution_state of the connection is dead. The documentation even describes that:

You’ll get a kernel dead message on the IOPub channel when the cell times out. If you don’t have 
interacts, it will time out pretty much immediately. If you do have interacts, then the timeout 
is something 30 or 60 seconds between each execute_request.

If I connect each time anew it will be slower for me and waste much more resources on the server side (I guess), so it would be best if I could somehow re-use the connection. Timeout only needs to be some 1-5 seconds, basically a couple of RTTs of the Internet.

Is there anything I could do?

2016-03-24 12:12:54 +0200 received badge  Supporter (source)
2016-03-23 11:50:12 +0200 asked a question Puiseux series expansion

Is there a function for a Puiseux series expansion? I found a posting (here) that is from 2011, but it seems that the code has not found its way into the distribution. Can someone confirm this or please point me to the right function? Thanks!

2016-03-23 11:43:41 +0200 asked a question Plotting an algebraic curve

I'm looking for the right function that lets me 2D-plot an algebraic curve like $x^2+y^2=1$. I know this example will get me a circle, but I want to use this to get an idea about how the curve looks like, so using a special function like sage.plot.circle.Circle doesn't help me.

I would be happy if anyone could point me to the right function. Thanks!

2016-02-23 17:25:55 +0200 received badge  Nice Question (source)
2016-02-22 13:45:31 +0200 received badge  Student (source)
2016-02-22 10:56:18 +0200 commented answer matrix over TropicalSemiring

Is there anything I could do about it? Like deriving a class from matrix and overloading the contructor? I'm new to Sage, so I have no idea how easy or hard that is.

2016-02-22 10:53:36 +0200 received badge  Scholar (source)
2016-02-19 22:11:41 +0200 asked a question matrix over TropicalSemiring

I try to build a matrix with entries from TropicalSemiring, but I get an error. This was done on SageMathCell:

T=TropicalSemiring(RR)
matrix([[T(1),T(2)],[T(3),T(4)]])

and yields:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-415e7359a236> in <module>()
      1 T=TropicalSemiring(RR)
----> 2 matrix([[T(Integer(1)),T(Integer(2))],[T(Integer(3)),T(Integer(4))]])

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
    647 
    648             if nrows > 0 and ncols > 0 and ring is None:
--> 649                 entries, ring = prepare(entries)
    650 
    651         elif isinstance(args[0], dict):

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in prepare(w)
    805         ring = rings.CDF
    806     elif not is_Ring(ring):
--> 807         raise TypeError("unable to find a common ring for all elements")
    808     return entries, ring
    809 

TypeError: unable to find a common ring for all elements

If instead I use this syntax:

T=TropicalSemiring(RR)
matrix(T,[[1,2],[3,4]])

I get a different error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-02718e38d49f> in <module>()
      1 T=TropicalSemiring(RR)
----> 2 matrix(T,[[Integer(1),Integer(2)],[Integer(3),Integer(4)]])

/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
    713                 raise ValueError("Invalid matrix constructor.  Type matrix? for help")
    714     else:
--> 715         raise ValueError("Invalid matrix constructor.  Type matrix? for help")
    716 
    717     if nrows is None:

ValueError: Invalid matrix constructor.  Type matrix? for help

How can I do it correctly?