Integrate a SymPy expression with a complex factor which does not involve x
up vote
1
down vote
favorite
I want to integrate complex functions with sympy.integrate. I realized that it takes too much time (at least I stopped process after 2.5 hours).
I am planning to give an equation to the program as simply as possible.
Lets assume I have a function :
alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
I only part I will integrate is
MainPart = x**(-rho/(rho - 1))
IntegMainPart=sympy.integrate(MainPart)
and rest are only parameters and they will be
Rest=alpha*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
So is it possible that i can take only important part and integrate it and than multiple with rest like
IntegMainPart*Rest
?
python sympy
add a comment |
up vote
1
down vote
favorite
I want to integrate complex functions with sympy.integrate. I realized that it takes too much time (at least I stopped process after 2.5 hours).
I am planning to give an equation to the program as simply as possible.
Lets assume I have a function :
alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
I only part I will integrate is
MainPart = x**(-rho/(rho - 1))
IntegMainPart=sympy.integrate(MainPart)
and rest are only parameters and they will be
Rest=alpha*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
So is it possible that i can take only important part and integrate it and than multiple with rest like
IntegMainPart*Rest
?
python sympy
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to integrate complex functions with sympy.integrate. I realized that it takes too much time (at least I stopped process after 2.5 hours).
I am planning to give an equation to the program as simply as possible.
Lets assume I have a function :
alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
I only part I will integrate is
MainPart = x**(-rho/(rho - 1))
IntegMainPart=sympy.integrate(MainPart)
and rest are only parameters and they will be
Rest=alpha*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
So is it possible that i can take only important part and integrate it and than multiple with rest like
IntegMainPart*Rest
?
python sympy
I want to integrate complex functions with sympy.integrate. I realized that it takes too much time (at least I stopped process after 2.5 hours).
I am planning to give an equation to the program as simply as possible.
Lets assume I have a function :
alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
I only part I will integrate is
MainPart = x**(-rho/(rho - 1))
IntegMainPart=sympy.integrate(MainPart)
and rest are only parameters and they will be
Rest=alpha*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
So is it possible that i can take only important part and integrate it and than multiple with rest like
IntegMainPart*Rest
?
python sympy
python sympy
edited Nov 4 at 14:47
Welcome to Stack Overflow
25.7k92646
25.7k92646
asked Nov 4 at 9:59
i2_
4817
4817
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
SymPy is capable of correctly handling the factors that do not involve the variable of integration. You should not need to remove them manually. Here is how this integral works for me.
from sympy import symbols, pi, integrate
x, alpha, gamma, mu, rho, l = symbols('x, alpha, gamma, mu, rho, l')
expr = alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
print(integrate(expr, x))
SymPy 1.3 prints the integral at once.
alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1))
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
SymPy is capable of correctly handling the factors that do not involve the variable of integration. You should not need to remove them manually. Here is how this integral works for me.
from sympy import symbols, pi, integrate
x, alpha, gamma, mu, rho, l = symbols('x, alpha, gamma, mu, rho, l')
expr = alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
print(integrate(expr, x))
SymPy 1.3 prints the integral at once.
alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1))
add a comment |
up vote
0
down vote
SymPy is capable of correctly handling the factors that do not involve the variable of integration. You should not need to remove them manually. Here is how this integral works for me.
from sympy import symbols, pi, integrate
x, alpha, gamma, mu, rho, l = symbols('x, alpha, gamma, mu, rho, l')
expr = alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
print(integrate(expr, x))
SymPy 1.3 prints the integral at once.
alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1))
add a comment |
up vote
0
down vote
up vote
0
down vote
SymPy is capable of correctly handling the factors that do not involve the variable of integration. You should not need to remove them manually. Here is how this integral works for me.
from sympy import symbols, pi, integrate
x, alpha, gamma, mu, rho, l = symbols('x, alpha, gamma, mu, rho, l')
expr = alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
print(integrate(expr, x))
SymPy 1.3 prints the integral at once.
alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1))
SymPy is capable of correctly handling the factors that do not involve the variable of integration. You should not need to remove them manually. Here is how this integral works for me.
from sympy import symbols, pi, integrate
x, alpha, gamma, mu, rho, l = symbols('x, alpha, gamma, mu, rho, l')
expr = alpha*x**(-rho/(rho - 1))*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(gamma*mu)
print(integrate(expr, x))
SymPy 1.3 prints the integral at once.
alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1))
answered Nov 4 at 14:46
Welcome to Stack Overflow
25.7k92646
25.7k92646
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139574%2fintegrate-a-sympy-expression-with-a-complex-factor-which-does-not-involve-x%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password