Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Integrating complicated expression with two variables

I am trying to compute a double integral with respect to variables x and y. I first compute the integral with respect to the variable x:

first_int = integral(h, x, 1, 5)

which gives me as an output :

integrate(1/(log(abs(x^4 + 13*x^3*y - 30*x^2*y^2 + 2*x*y^3 - 3*x^2*y + x*y^2 + x^2 + x*y + y^2 + 2*x + 13))^log(abs(x^4 + 13*x^3*y - 30*x^2*y^2 + 2*x*y^3 - 3*x^2*y + x*y^2 + x^2 + x*y + y^2 + 2*x + 13))), x, 1, 5)

instead of an expression now only depending on the second variables y.

Then, when I try to integrate with respect to the second variable y by writing

second_int = first_int.integrate(y, 1, 5)

I get the following output:

integrate(integrate(log(abs(x^4 + 13*x^3*y - 30*x^2*y^2 + 2*x*y^3 - 3*x^2*y + x*y^2 + x^2 + x*y + y^2 + 2*x + 13))^(-log(abs(x^4 + 13*x^3*y - 30*x^2*y^2 + 2*x*y^3 - 3*x^2*y + x*y^2 + x^2 + x*y + y^2 + 2*x + 13))), x, 1, 5), y, 1, 5)

finally if I try to write (to get the numerical value)

second_int = n(first_int.integrate(y, 1, 5))

I get the error message ValueError: The function to be integrated depends on 2 variables (x, y), and so cannot be integrated in one dimension. Please fix additional variables with the 'params' argument

I have tried integrating the same type of function when there is only one variable and the integration works fine, so I am thinking something goes wrong in the double integration but I can't figure out what!

Thanks.