Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multivariable numerical-symbolic integration

I need to find the symbolic expression of a multivariable integral. The real integrand contains 11 variables (I have to integrate "only" four of them) so example code is simplified here:

x, y = var('x','y')
integrand = sin(x)*cos(y)
result = integrand.integral(x, 0, pi)

It works just fine generally but given the complexity of the integral no algorithm gives me a result and returns just:

integrate(sin(x)*cos(y), x, 0, pi)

Is there a built in way to numerically evaluate an integral on some variables that returns symbolic result with the numerical integration found coefficients (or constants)? Namely, in this case:

2*cos(y)

Multivariable numerical-symbolic integration

I need to find the symbolic expression of a multivariable integral. The real integrand contains 11 variables (I have to integrate "only" four of them) so example code is simplified here:

x, y y, z = var('x','y')
var('x','y','z')
integrand = sin(x)*cos(y)
sin(x)*cos(y)*z
result = integrand.integral(x, 0, pi)
pi).integral(z, 0, 1)

It works just fine generally but given the complexity of the integral no algorithm gives me a result and it returns just:

integrate(sin(x)*cos(y), integrate(integrate(sin(x)*cos(y), x, 0, pi)
pi), z, 0, 1)

Is there a built in way to numerically evaluate an integral on some variables that returns symbolic result with the numerical integration found coefficients (or constants)? Namely, in this case:

2*cos(y)
cos(y)

Multivariable numerical-symbolic integration

I need to find the symbolic expression of a multivariable integral. The real integrand contains 11 variables (I have to integrate "only" four of them) so example code is simplified here:

x, y, z = var('x','y','z')
integrand = sin(x)*cos(y)*z
result = integrand.integral(x, 0, pi).integral(z, 0, 1)

It works just fine generally but given the complexity of the integral no algorithm gives me a result and it returns just:

integrate(integrate(sin(x)*cos(y), x, 0, pi), z, 0, 1)

Is there a built in way to numerically evaluate an integral on some variables that returns symbolic result with the numerical integration found coefficients (or constants)? Namely, in this case:

cos(y)

EDIT1: I managed to get a very very simple example of the function I need:

def numsym_integral( f, variable, a, b, points = 1000):
dx = (b-a)/points
result = 0
for i in range(0,points):
    result = result + f.substitute({variable:a + i*dx}) * dx
return result

It still doesn't work though in my specific case because of the complexity of the equation. I get the number of terms gets multiplied by "points" per integration, leading to something too big. Something could something built in be more efficient?

Multivariable numerical-symbolic integration

I need to find the symbolic expression of a multivariable integral. The real integrand contains 11 variables (I have to integrate "only" four of them) so example code is simplified here:

x, y, z = var('x','y','z')
integrand = sin(x)*cos(y)*z
result = integrand.integral(x, 0, pi).integral(z, 0, 1)

It works just fine generally but given the complexity of the integral no algorithm gives me a result and it returns just:

integrate(integrate(sin(x)*cos(y), x, 0, pi), z, 0, 1)

Is there a built in way to numerically evaluate an integral on some variables that returns symbolic result with the numerical integration found coefficients (or constants)? Namely, in this case:

cos(y)

EDIT1: I managed to get a very very simple example of the function I need:

def numsym_integral( f, variable, a, b, points = 1000):
dx = (b-a)/points
result = 0
for i in range(0,points):
    result = result + f.substitute({variable:a + i*dx}) * dx
return result

It still doesn't work though in my specific case because of the complexity of the equation. expression. I get the number of terms gets multiplied by "points" per integration, leading to something too big. Something could something built in be more efficient?

Multivariable numerical-symbolic integration

I need to find the symbolic expression of a multivariable integral. The real integrand contains 11 variables (I have to integrate "only" four of them) so example code is simplified here:

x, y, z = var('x','y','z')
integrand = sin(x)*cos(y)*z
result = integrand.integral(x, 0, pi).integral(z, 0, 1)

It works just fine generally but given the complexity of the integral no algorithm gives me a result and it returns just:

integrate(integrate(sin(x)*cos(y), x, 0, pi), z, 0, 1)

Is there a built in way to numerically evaluate an integral on some variables that returns symbolic result with the numerical integration found coefficients (or constants)? Namely, in this case:

cos(y)

EDIT1: I managed to get a very very simple example of the function I need:

def numsym_integral( f, variable, a, b, points = 1000):
dx = (b-a)/points
result = 0
for i in range(0,points):
    result = result + f.substitute({variable:a + i*dx}) * dx
return result

It still doesn't work though in my specific case because of the complexity of the expression. I get the number of terms gets multiplied by "points" per integration, leading to something too big. Something could Could something built in be more efficient?