Problem with integration need help

2 views (last 30 days)
Hi guys,
The next code is to solve an integration. The code will keep running without show any result. Please, need your help if you know the reason.
The code is;
syms T1 T2 r1 r2 r w m k Tb
clc
b=(-4*m*w^2*r1^4)/(k*(r2^2-r1^2));
c1=((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1));
c2=T1-((b*r2^4)/(4*r1^2))-(((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1)))*log(r1);
Tb=(int((((c1*r/2)+(c2/r))*((b*r2^4/4*r^2)+(c1*log(r)+c2))*r),r,r1,r2))/....
(int(((((-2*w*r1^2)/(r2^2-r1^2))*(r/2))+(((w*r1^2*r2^2)/(r2^2-r1^2))*(1/r)))*r,r,r1,r2));

Accepted Answer

Walter Roberson
Walter Roberson on 20 Dec 2013
Try breaking Tb up into two pieces, numerator and denominator, so that you can figure out which of the two integrations is giving the problem.
In my tests with a different mathematics system, the integrations were fast.
  2 Comments
Abdulaziz
Abdulaziz on 20 Dec 2013
Hi Walter your suggestion was really helpful the problem was in the numerator but i still can not find why
Walter Roberson
Walter Roberson on 20 Dec 2013
In both your original equation and the modified one you give about half an hour ago, none of the b, c1, or c2 involve "r". Because of that, you can do the integration just by
syms b c1 c2 r1 r2 r
Tb1 = int((((c1*r/2)+(c2/r))*((b*r2^4/4*r^2)+(c1*log(r)+c2))*r),r,r1,r2);
and then take that result and substitute in the values for b, c1, c2:
b=(-4*m*w^2*r1^4)/(k*(r2^2-r1^2));
c1=((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1));
c2=T1-((b*r2^4)/(4*r1^2))-(((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1)))*log(r1);
Tb = subs(Tb1);
As the integral will be simpler, it is less likely that it will run indefinitely.

Sign in to comment.

More Answers (1)

Abdulaziz
Abdulaziz on 20 Dec 2013
Edited: Walter Roberson on 20 Dec 2013
the code is simplify like next:
clear all
syms T1 T2 r1 r2 r w m k Tb
clc
b=(-4*m*w^2*r1^4)/(k*(r2^2-r1^2));
c1=((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1));
c2=T1-((b*r2^4)/(4*r1^2))-(((T2-T1)+(b*r2^2/4)*(((r2/r1)^2)-1))/(log(r2/r1)))*log(r1);
Tb=(int((((c1*r/2)+(c2/r))*((b*r2^4/4*r^2)+(c1*log(r)+c2))*r),r,r1,r2));
the processor is running endlessly to solve the integration until i stop it by ctl/c

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!