45 views (last 30 days)

Hello.

I was going to solve this symbolic integral with int():

clear all

clc

syms k r R CosTheta M m

I=int((k*sin(k*r)/(k*r))*(1/(1+exp(0.2*((2.06*(10^7)*k*k)-M)))),k,[0 9.18])

but I got this as the solution:

I =

int(sin(k*r)/(r*(exp(4120000*k^2 - M/5) + 1)), k, 0, 459/50)

I found out that if remove the term 'k*k' from the expression, the the integral will be solved; in dact if I run:

clear all

clc

syms k r R CosTheta M m

I=int((k*sin(k*r)/(k*r))*(1/(1+exp(0.2*((2.06*(10^7))-M)))),k,[0 9.18])

then I get this as the solution:

I =

(2*sin((459*r)/100)^2)/(r^2*(exp(4120000 - M/5) + 1))

Now what can I do th solve my integral expression?

Regards.

John D'Errico
on 21 Aug 2019

Your need is not relevant. Mathematics is not something that just works because you want it to. (Unless you have a magic wand, and can use it well.)

When you took out the k*k term from the second hanf of that kernel, it became just a constant, independent of k. Integration is easy in that case.

With the k^2 term in there, it becomes something for which apparently no analytical solution exists. It is trivial to write down such an expression, and they are embarrasingly common. This part:

(k*sin(k*r)/(k*r))

which can be trivially simplified to

sin(k*r)/r

is something that most students can handle. But with the second part in there, as a function now of k, will be apparently more difficult.

So, what can you do? You can write it as a nested numerical integration, something a tool like integral2 can handle. But that will require values of all the unknown variables, thus M. A numerical integration cannot be done with a symbolic parameter in there.

Note that this term:

exp(4120000*k^2 - M/5)

where k varies from 0 to 9.18, will be almost impossible to handle however. Whatever the value of M is, as k varies, the first part of that will be so huge as to be impossble to compute.

k = 9.18;

4120000*k^2

ans =

347202288

vpa(exp(sym(347202288)))

ans =

6.0615491251051549511122437574585e+150788037

So that is a number with 150 million decimal digits. I think perhaps you might not understand how large that number is. Double precision arithmetic cannot handle a number larger than

realmax

ans =

1.79769313486232e+308

And your exponential is so much more huge than that. We don't know what M is, of course. But hear my words, you will have huge numerical problems in trying to solve this problem

Walter Roberson
on 22 Aug 2019

When M gets into the range of one and a half billion, then the curve goes to value +/- 1/2-ish between and roughly 4, and then very suddenly drops to effectively 0. The drop appears to be at the point where 4120000*k^2 == M/5, which makes sense. Note that for small M, the point at which the curve effectively vanishes can be pretty close to 0.

Before that point there is a sin-like curve, and the number of half-cycles appears to be approximately r / sqrt(2) . For example, the curve vanishes by k = 1/1000 below M = 20.6

Walter Roberson
on 22 Aug 2019

Note that exp(4120000*k^2 - M/5) is effectively 0 until 4120000*k^2 approaches comes to within about 35 of M/5 . Below that,

sin(k*r)/(r*(exp(4120000*k^2 - M/5) + 1))

effectively becomes

sin(k*r)/(r*(0+1))

which is to say

sin(k*r)/r

When 4120000*k^2 exceeds M/5 by more than about 40 or so, then the denominator of sin(k*r)/(r*(exp(4120000*k^2 - M/5) + 1)) becomes numerically close enough to infinity that the expression will not contribute anything to the integral (well, not actually to infinity, but would exceed r*10^18 so unless r is pretty small then the contribution becomes numeric noise.)

So you have an expression that is pretty much just sin(k*r)/r except for the narrow band from k = sqrt(515*M - 90125)/103000 to k = sqrt(515*M + 103000)/103000

I figure that to make the expression "interesting" all the way out to k = 9.81, that M would have to be 1982463460, in which case the "interesting" part of the integral would be betweeen k = 9.809999072 and 9.81

I figure that the "interesting" width, the gap between where sin(k*r)/r behavior stops being the major factor, versus where the denominator becomes as close to indefinitely large as to make no numeric difference, cannot exceed about 4/1000

With the denominator becoming large, the overall expression quickly goes to zero. So what you have, then, is effectively sin(k*r)/r for part of the stretch, followed by a very narrow stretch in which the sin(k*r)/r behavior is modified to go to zero pretty quickly, followed by a numerically zero stretch for the rest.

There is a range of r values for which you could show that k = sqrt(515*M - 90125)/103000 to k = sqrt(515*M + 103000)/103000 would not complete even a single period, in which case there would be no change of sign of the sin(k*r) over the stretch, permitting you to establish a bound on the contribution of the "interesting" area. However, it is true that for large enough r, you would have several rapidly decaying oscillations in that k range and that could potentially make a significant difference to the integral since sin(k*r)/r is periodic symmetric around zero, so potentially effectively all of the interesting part is that decayed oscillation, trying to figure out exactly which portion is not exactly canceled by another part of the same cycle...

You are talking about a very very fine balance potentially. I have to wonder whether your equations are correct for your situation.

Sign in to comment.

Torsten
on 19 Aug 2019

There are integrals with no analytical antiderivative - yours seems to be one of them.

In other words: assign values to r and M and use "integral" instead of "int".

Walter Roberson
on 19 Aug 2019

I would expect the exp() to overflow to infinity unless M/2 is fairly large.

Sign in to comment.

Hamed Pouria
on 26 Aug 2019

Walter Roberson
on 26 Aug 2019

You just gave us a single integral.

The details are going to matter a fair bit to figuring out how to handle the situation. I suspect that you are going to need to analyze a number of different configurations to establish bounds in which the integral has manageable behavior.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/476511-how-can-i-solve-a-complicated-symbolic-integral#comment_736590

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/476511-how-can-i-solve-a-complicated-symbolic-integral#comment_736590

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/476511-how-can-i-solve-a-complicated-symbolic-integral#comment_737721

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/476511-how-can-i-solve-a-complicated-symbolic-integral#comment_737721

Sign in to comment.