First time here? Check out the FAQ!

Ask Your Question
1

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

asked 6 years ago

ninho gravatar image

updated 6 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 6 years ago

vdelecroix gravatar image

updated 6 years ago

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.

Preview: (hide)
link

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: 6 years ago

Seen: 656 times

Last updated: Sep 16 '18