How to load and use a PARI/GP script in Sage notebook?

1.9k Views Asked by At

I don't know whether this is the correct place to ask such a question, but I am dealing with this problem for a couple of days.

Take for example the script http://math.stanford.edu/~stange/scripts/tate_via_nets.gp.

What I do is: copy the script to a txt file and name it tate_via_nets.gp. Then I go to my sage notebook and choose above the option 'gp'. In the first block I write

\r filename

where filename is the whole path of the file tate_via_nets.gp (so C:....\tate_via_nets.gp) and "evaluate" it. But then I get the error

* at top-level: read("/home/sage/.sa * ^--------------------

* read: error opening input file: `C:\Users...\tate_via_nets.gp'.

If you see me doing things wrongly please let me know it :-) I am working with sage 4.7.1

Thanks

EDIT: I have changed the "source" of the problem

2

There are 2 best solutions below

3
On

In https://cloud.sagemath.com do this:

  1. Create a project and a new Sage worksheet in the project.

  2. Paste in this line and press shift+enter: gp.read(get_remote_file('http://math.stanford.edu/~stange/scripts/tate_via_nets.gp'))

  3. In another cell, type this to confirm that you've loaded the code.

    %gp
    tate_pairing_alg 
    
  4. Use it -- type %gp at the start of a cell to use gp.

0
On

Why does it not work if I copy and paste the code in Sage notebook? If I copy the code to a cell in Sage notebook and evaluate it, it just keeps running. The solution provided by user1286 is okay if I would not have to adjust the code and so on.