Ask Your Question

# Revision history [back]

### Numerical integration and plot failing

I have a function which can be efficiently calculated on some interval on the real line and if I feed sage with concrete arguments, sage gives concrete numerical values. Nevertheless, if I try to integrate it numerically (or plot it), something goes terribly wrong and sage is not able to calculate the values.

In my case I get the error message "negative number cannot be raised to a fractional power"

The function itself is a solution to the cubic equation so it involves square root and a cubic root.

is it some bug in sage and if there is some workaround?

MINIMAL NON_WORKING EXAMPLE

y = var('y'); z = var('z');

cauchy= y.substitute(solve(zy^3 +y^2 - 2z*y+2 ,y))

def F(u): return arg(cauchy).substitute(z=u).n()

numerical_integral(F,1,2) 2 None

### Numerical integration and plot failing

I have a function which can be efficiently calculated on some interval on the real line and if I feed sage Sage with concrete arguments, sage Sage gives concrete numerical values. Nevertheless, if I try to integrate it numerically (or plot it), something goes terribly wrong and sage Sage is not able to calculate the values.

In my case I get the error message

"negative
negative number cannot be raised to a fractional power"power


The function itself is a solution to the cubic equation so it involves square root and a cubic root.

is it some bug in sage and if there is some workaround?

MINIMAL NON_WORKING EXAMPLE

y = var('y');
var('y')
z = var('z');var('z');
cauchy= y.substitute(solve(zy^3 cauchy = y.substitute(solve(z*y^3 +y^2 - 2z*y+2 ,y))2*z*y+2, y))
def F(u):
return arg(cauchy).substitute(z=u).n()arg(cauchy).substitute(z=u).n()
numerical_integral(F,1,2)numerical_integral(F, 1, 2)