Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

numerical_integral (GSL C library) does not work with complex integrands?

I am unable to use numerical_integral (GSL C library) with a complex integrand. I haven't found anything about this issue in the documentation. Is this correct? nintegral works correctly.

e.g.

f(x) = (exp(i*x) + exp(-i*x))/2
f(x).nintegral(x,0,1)
numerical_integral(f,0,1)

the above code outputs

(0.8414709848078965, 9.34220461887732e-15, 21, 0)
Error in lines 3-3
...
TypeError: unable to coerce to a real number

Tested with SageMath version 7.5.1 and Cocalc.

Cordially