Ask Your Question

psniady's profile - activity

2021-11-08 06:39:24 +0200 received badge  Notable Question (source)
2019-12-20 17:57:39 +0200 received badge  Popular Question (source)
2019-06-06 11:18:59 +0200 received badge  Student (source)
2019-06-06 09:41:56 +0200 asked a question 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(z*y^3 +y^2 - 2*z*y+2, y)[0])

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

numerical_integral(F, 1, 2)