Ask Your Question
1

How to load local PARI/GP script in Sage notebook?

asked 2018-09-15 16:50:41 -0500

ninho gravatar image

updated 2018-09-15 16:51:45 -0500

I have a PARI/GP script which I want to load and run locally on my laptop inside a Sage notebook. I tried to open a new notebook in the same directory where my script is located, and run this:

%default_mode gp

But, it throws the following error:

UsageError: Line magic function '%default_mode` not found.

Please note that I'm using Sage 8.3. How can I run a PARI/GP script locally?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-09-16 03:21:31 -0500

vdelecroix gravatar image

updated 2018-09-16 03:23:01 -0500

To run gp in your jupyter notebook, you would better use the pari/gp kernel.

Next, to run a single cell in gp mode while you are using the SageMath kernel you can use

%%gp
forperm(3, p, print(p))

Finally, to load a script from Sage, let say gp_script.gp you can use the method read

gp.read('my_script.gp')

This last method is valid in Jupyter and in the console.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-09-15 16:50:41 -0500

Seen: 22 times

Last updated: Sep 16