ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 16 Sep 2018 03:21:31 -0500How to load local PARI/GP script in Sage notebook?http://ask.sagemath.org/question/43681/how-to-load-local-parigp-script-in-sage-notebook/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?Sat, 15 Sep 2018 16:50:41 -0500http://ask.sagemath.org/question/43681/how-to-load-local-parigp-script-in-sage-notebook/Answer by vdelecroix for <p>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:</p>
<pre><code>%default_mode gp
</code></pre>
<p>But, it throws the following error:</p>
<blockquote>
<p>UsageError: Line magic function '%default_mode` not found.</p>
</blockquote>
<p>Please note that I'm using Sage 8.3. How can I run a PARI/GP script locally?</p>
http://ask.sagemath.org/question/43681/how-to-load-local-parigp-script-in-sage-notebook/?answer=43682#post-id-43682To 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.Sun, 16 Sep 2018 03:21:31 -0500http://ask.sagemath.org/question/43681/how-to-load-local-parigp-script-in-sage-notebook/?answer=43682#post-id-43682