Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Strange problem with double integrals

I need to calculate a double of integral a large expression numerically. But, I found a strange error. The code:

[code] def doubleIntegral(): def f2(theta): def f1(phi): return thetaphi/pi return numerical_integral(f1,0,2pi)[0] return numerical_integral(f2,0,pi) [\code]

works. but

[code] a = theta*phi/pi # Suppose this is a huge expression that came out of previous calculations

def doubleIntegral(): def f2(theta): def f1(phi): return a return numerical_integral(f1,0,2*pi)[0] return numerical_integral(f2,0,pi) [\code]

doesn't work [code] unable to simplify to float approximation unable to simplify to float approximation . . . [/code] . What is going on? And how can I fix this?

Strange problem with double integrals

I need to calculate a double of integral a large expression numerically. But, I found a strange error. The code:

[code]

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return thetaphi/pi
        return numerical_integral(f1,0,2pi)[0]
theta*phi/pi
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)
[\code]

works. but

[code] a = theta*phi/pi # Suppose this is a huge expression that came out of previous calculations

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return a
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)
[\code]

doesn't work [code] work

unable to simplify to float approximation
unable to simplify to float approximation
.
.
.
[/code]
. 

What is going on? And how can I fix this?

Strange problem with double integrals

I need to calculate a double of integral a large expression numerically. But, I found a strange error. The code:

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return theta*phi/pi
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)

works. but

a = theta*phi/pi  # Suppose this is a huge expression that came out of previous calculations

calculations

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return a
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)

doesn't work

unable to simplify to float approximation
unable to simplify to float approximation
.
.
.

What is going on? And how can I fix this?