ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 18 Mar 2021 22:37:39 +0100Issue on numerical_integral with a Pari/GP functionhttps://ask.sagemath.org/question/56235/issue-on-numerical_integral-with-a-parigp-function/Hello there,
I tried to evaluate the integral of a Pari/GP function but failed so far. Here is an example code on (SageMath version 8.9, Release Date: 2019-09-29 and windows 10):
sage: lchi4 = DirichletGroup(4).list()[1].lfunction(); lchi4
PARI L-function associated to Dirichlet character modulo 4 of conductor 4 mapping 3 |--> -1
sage: numerical_integral(lambda t: lchi4(t).real(), 2,3)
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
/opt/sagemath-8.9/local/lib/python2.7/site-packages/sage/all_cmdline.pyc in <module>()
----> 1 numerical_integral(lambda t: lchi4(t).real(), Integer(2),Integer(3))
/opt/sagemath-8.9/local/lib/python2.7/site-packages/sage/calculus/integration.pyx in
sage.calculus.integration.numerical_integral (build/cythonized/sage/calculus/integration.c:4061)()
353 _b = b
354 W = <gsl_integration_workspace*> gsl_integration_workspace_alloc(n)
--> 355 sig_on()
356 gsl_integration_qag(&F,_a,_b,eps_abs,eps_rel,n,rule,W,&result,&abs_err)
357 sig_off()
SystemError: calling remove_from_pari_stack() inside sig_on()
However, for the Riemann zeta function, numerical_integral works fine as below:
sage: numerical_integral(lambda t: zeta(t), 2,3)
(1.3675256886839795, 1.518258506343328e-14)
It looks like it would work for lchi4 if it can be coerced into a symbolic expression like zeta(x) as shown below:
sage: type(lchi4(3))
<type 'sage.rings.complex_number.ComplexNumber'>
sage: type(zeta(3))
<type 'sage.symbolic.expression.Expression'>
Can you please let me know how to evaluate the integral numerically for a Pari/GP function as lchi4?
Thank you in advance.jbThu, 18 Mar 2021 22:37:39 +0100https://ask.sagemath.org/question/56235/Using multiple lines of pari/gp code in a Sage notebookhttps://ask.sagemath.org/question/41758/using-multiple-lines-of-parigp-code-in-a-sage-notebook/I am struggling to get multiple lines of pari/gp code working in a Jupyter Sage notebook.
When I enter:
%%gp
for(x=1,10,print(x))
it all works fine, however when I for instance write:
%%gp
for(x=1,10,{
print(x);
})
the system just 'hangs' and doesn't return any output. The same issue occurs in the Cocalc Sage cloud environment. I also tried 'pari/gp in your browser' and there it works fine.
Am I doing something wrong or isn't the multi-line pari/gp option supported in Sage?RuudHSun, 25 Mar 2018 22:58:41 +0200https://ask.sagemath.org/question/41758/RuntimeError when starting pari/library not foundhttps://ask.sagemath.org/question/33725/runtimeerror-when-starting-parilibrary-not-found/ Hello,
I am using a binary distribution of sage 7.1 for debian jessie and "installed" it to /opt.
Now, when I want to use pari, I get a runtime error:
```
sage: %gp
```
```
--> Switching to PARI/GP interpreter <--
```
```
pari: sqrt(4)
```
```
RuntimeError: unable to start pari
```
The full backtrace can be found here: paste.kde.org/pvqeoh3ve
however, the following works:
```
LD_LIBRARY_PATH=/opt/sage-7.1/local/lib sage
```
It seems that sage is unable to find that library when starting pari.
Setting SAGE_ROOT does not help. Did I miss some configuration file to set the library path for sage?
fxrhThu, 09 Jun 2016 14:58:27 +0200https://ask.sagemath.org/question/33725/