Ask Your Question

juanpool's profile - activity

2017-11-24 17:52:24 +0100 received badge  Famous Question (source)
2017-09-18 23:30:22 +0100 received badge  Famous Question (source)
2017-09-18 02:21:57 +0100 received badge  Student (source)
2017-09-18 01:46:15 +0100 received badge  Notable Question (source)
2017-09-18 01:46:11 +0100 received badge  Popular Question (source)
2015-06-18 15:10:29 +0100 received badge  Notable Question (source)
2015-01-18 11:23:54 +0100 received badge  Notable Question (source)
2014-09-15 05:36:15 +0100 received badge  Famous Question (source)
2014-01-13 15:29:10 +0100 received badge  Popular Question (source)
2013-10-29 18:11:32 +0100 received badge  Popular Question (source)
2013-04-08 16:52:51 +0100 received badge  Notable Question (source)
2013-01-16 09:39:54 +0100 commented answer how to calculate in SAGE the cumulative distribution function of a "stable distribution"?

Finally option 3 did the job.

2013-01-15 16:48:38 +0100 received badge  Popular Question (source)
2012-08-16 23:24:06 +0100 commented answer is it possible to run a ipython notebook in sage?

If I try to install the IPython 0.13 it will not work?

2012-08-16 23:15:54 +0100 marked best answer is it possible to run a ipython notebook in sage?

The ipython notebook was released with version 0.12 (see http://ipython.org/ipython-doc/rel-0....), but we ship an older version, 0.10.2 with Sage. There is some progress to upgrading the ipython package in Sage here.

2012-08-16 22:14:32 +0100 asked a question is it possible to run a ipython notebook in sage?

If I run

$ sage -ipython notebook

then the IPython notebook does not start up, instead the following message appears,

Could not open file <notebook> for safe execution.

Is it possible to run an IPython notebook in sage?

2012-05-19 13:11:44 +0100 received badge  Supporter (source)
2012-05-19 13:11:35 +0100 marked best answer how to use sage's f2py from linux command line?

Try running

$ sage -sh

from the command-line first. When you then run,

$ f2py -m -c rw2 rw2.f90

it will pick up Sage's copy of f2py (which will use Sage's Python).

2012-05-17 12:20:02 +0100 asked a question how to use sage's f2py from linux command line?

I usually run python scripts using SAGE via the command,

sage -python program.py

Now I want to use f2py to use a FORTRAN subroutine in my program. In my Linux version (Ubuntu 12.04) I have installed f2py (version 2), but that version does not use SAGE's Python as I can see from the following. I have a FORTRAN code in rw2.f90 and I run in a linux console,

$f2py -m -c rw2 rw2.f90

and it throws the following message,

error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/tmpyFNYE_/src.linux-x86_64-2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.c -o /tmp/tmpyFNYE_/tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.o" failed with exit status 1

From the message, it is clear that f2py is trying to use the version of Python that comes with my ubuntu. But I want that f2py to use the SAGE's Python. How I do that?

Best regards

2012-04-11 22:15:26 +0100 answered a question how to calculate in SAGE the cumulative distribution function of a "stable distribution"?

I am considering tree possible solutions.

  1. Implementing this algorithm withing a python function.
  2. Using the GNU Scientific Library (GSL) from within a SAGE program. More specifically this GSL function.
  3. Using R from SAGE with the fBasic R package.

Best Regards.

2012-04-11 19:01:10 +0100 received badge  Editor (source)
2012-04-11 18:56:26 +0100 asked a question how to calculate in SAGE the cumulative distribution function of a "stable distribution"?

A stable distribution, defined in wiki is basically defined by,

In probability theory, a random variable is said to be stable (or to have a stable distribution) if it has the property that a linear combination of two independent copies of the variable has the same distribution, up to location and scale parameters.

As far as I know, the family of stable distributions is defined by four parameters: mu, c, alpha and beta. I need to generate random numbers according to a given stable distribution, that is, to a given choice of the parameters of the stable distribution family.

How can it be done in SAGE? Is there some "statistical package" which provides this?

Best regards.

2012-02-13 12:31:40 +0100 marked best answer Convert Sage's Graph to NetworkX graph

You can simply call the method .networkx_graph():

sage: import networkx as nx
sage: G = graphs.PetersenGraph()             
sage: ng = G.networkx_graph()                
sage: ng
<networkx.classes.graph.Graph object at 0xd3c2f8c>
sage: nx.double_edge_swap(ng)                
1

Incidentally, I didn't know this five minutes ago, so I should tell you how I found out. Lots of functionality for Sage objects lives inside them, in methods. Typically conversion functions are either called ".targettype" or "._targettype_", so I tried

sage: G.netw[HERE I HIT TAB]
      G.networkx_graph

which looked promising. And then typing

sage: G.networkx_graph?

gives the documentation:

       Creates a new NetworkX graph from the Sage graph.

       INPUT:

       * "copy" - if False, and the underlying implementation is a
         NetworkX graph, then the actual object itself is returned.

       EXAMPLES:

          sage: G = graphs.TetrahedralGraph()
          sage: N = G.networkx_graph()
          sage: type(N)
          <class 'networkx.classes.graph.Graph'>

          sage: G = graphs.TetrahedralGraph()
          sage: G = Graph(G, implementation='networkx')
          sage: N = G.networkx_graph()
          sage: G._backend._nxg is N
          False

          sage: G = Graph(graphs.TetrahedralGraph(), implementation='networkx')
          sage: N = G.networkx_graph(copy=False)
          sage: G._backend._nxg is N
          True

PS: Okay, to be perfectly honest, I tried it first and only looked at the documentation when I came to write this. But I would've looked at the documentation if it hadn't worked, I promise! :^)

2012-02-13 12:31:40 +0100 received badge  Scholar (source)
2012-02-13 12:31:33 +0100 commented answer Convert Sage's Graph to NetworkX graph

Thanks very much DSM. That solves my problem. Fool of me. I tried using TAB in sage's notebook, and googled a lot. But I couldn't find it.

2012-02-13 11:03:40 +0100 asked a question Convert Sage's Graph to NetworkX graph

I want to use a function of networkx. More specifically I want to use the function

double_edge_swap()

provided in the networkx package included in Sage. For more information see here.

But, I have a Sage graph constructed with:

Graph()

So I want to convert the Sage's Graph() object to a networkx object. How I do that?

Best regards.