# Revision history [back]

This works for me in (Python 3 based) Sage 8.8.beta7:

sage: y, z = var('y z')
sage: cauchy = y.substitute(solve(z*y^3 + y^2 - 2*z*y + 2, y)[0])
sage: def F(u):
....:     return arg(cauchy).substitute(z=u).n()
....:
sage: numerical_integral(F, 1, 2)
(0.6116545934235456, 6.790730127365591e-15)


Here are links to Jupyter notebooks on CoCalc showing it

To determine whether what matters is SageMath 8.7 vs 8.8.beta7 or Py2 vs Py3, I'll test Py2-based SageMath 8.8.beta7, and report.

This works for me in (Python 3 based) Sage 8.8.beta7:

sage: y, z = var('y z')
sage: cauchy = y.substitute(solve(z*y^3 + y^2 - 2*z*y + 2, y)[0])
sage: def F(u):
....:     return arg(cauchy).substitute(z=u).n()
....:
sage: numerical_integral(F, 1, 2)
(0.6116545934235456, 6.790730127365591e-15)


Here are links to Jupyter notebooks on CoCalc showing itshowing

This also fails with Py2-based SageMath 8.78.8.beta7.

So the "easy" solution for you is: switch to Python3-based Sage!

For this, follow the instructions to install from source

• works with Py3-based SageMath 8.8.beta7
• To determine whether what matters is SageMath 8.7 vs 8.8.beta7 or Py2 vs Py3, I'll test Py2-based SageMath 8.8.beta7, , paying attention to the discussion about Python 3.

Or if you want to turn your existing SageMath into a Python3-based one, you could open a terminal, cd to your Sage directory, and report.

type

make distclean
make configure
./configure --with-python=3
make


which will work if you have all the prerequisites.