# Revision history [back]

### Double-integration and logs

I am running into various odd problems while trying to compute a double integral. My code is as follows:

x, y = var('x y')
##### Two different ways of generating random polynomials F(x,y) to test double-integration ########
#F = ZZ['x','y'].random_element(4, 1000)
F = randint(-1000, 1000)*x**4*y**4 + randint(-1000, 1000)*x**3*y + randint(-1000, 1000)*x**2*y**3 +randint(-1000, 1000)*x  + randint(-1000, 1000)*y**2
G = randint(0, 1000)*x**4*y + randint(0, 1000)*x**3 + randint(0, 1000)*x**2*y**2 +randint(0, 1000)*x  + randint(0, 1000)*y**4
###### Defining the function we want to integrate over dx dy ##########
f =  log(F)
####### Double integration  #####
g= integrate(f, x, 1, 2)
print 'after integration dx:', g
assume(y>0)
print n(g.integral(y, 1, 2))


Problems: 1) If I use the random polynomial F generated by .random_element, the integration generates the following error : TypeError: integral() takes exactly one argument (3 given). However, if I use the other one I manually generate, then it integrates okay. If I copy from the terminal the .random_element() polynomial and explicitly write it in my code, then it will also work. Why not directly from the .random_element() function then ?

2) If I set f = F or even f = FG, then the double integral works fine. However, as soon as I introduce the *log function, the calculation never terminates (if I work with an example in the terminal with a log function, then it does integrate properly).

Any idea what might cause these weird bugs ? Thanks!