Why Didn't I Get the Number in the End?

  • Thread starter Thread starter Petar Mali
  • Start date Start date
  • Tags Tags
    Mathematica
Petar Mali
Messages
283
Reaction score
0
I don't understand why I didn't get the number in the end? Thanks for your answer!
 

Attachments

Physics news on Phys.org
The problem is that the numerical integration diverges at the limits. Try integrating to within a small distance of the limits, and then take this small distance smaller and smaller and see if it converges. It seems to converge to a limit of 0.43137. See attached:
 

Attachments

Ok! I will see!

Just to ask you. This boundaries

\{x,\in ,\pi-\epsilon\},\{y,\in ,\pi-\epsilon\},\{z,\in ,\pi-\epsilon\}

What that means? How Mathematica read that. Because I'm integrate from 0 to \pi.

And what means

Table[\sigma[0.45,1.0,10^{-n}],\{n,1,7\}]

Thanks for your answer!
 
Last edited:
You tried integrating from 0 to pi, but the integrand goes to infinity at 0 and pi, so Mathematica can't come up with an answer. So instead of integrating from 0 to pi, we try integrating from just a little bit more than zero to just a litlle bit less than pi, then we make the "little bit" smaller and smaller. If we make the "little bit" small enough, it will get as close to the answer you want as we like. So we tell Mathematica to integrate from \epsilon (a small number) to \pi-\epsilon. The Table line then evaluates your function with \epsilon having values of .1, .01, .001, .0001, .00001, .0000001, and .00000001. As you can see, it is getting very close to your answer. Does this make sense?
 
phyzguy said:
You tried integrating from 0 to pi, but the integrand goes to infinity at 0 and pi, so Mathematica can't come up with an answer. So instead of integrating from 0 to pi, we try integrating from just a little bit more than zero to just a litlle bit less than pi, then we make the "little bit" smaller and smaller. If we make the "little bit" small enough, it will get as close to the answer you want as we like. So we tell Mathematica to integrate from \epsilon (a small number) to \pi-\epsilon. The Table line then evaluates your function with \epsilon having values of .1, .01, .001, .0001, .00001, .0000001, and .00000001. As you can see, it is getting very close to your answer. Does this make sense?

Yes I think this make sense. If I understand you, you think that this not converge for

\sigma[0.45,1]

I tried to calculate

\sigma[0.431,1]

but I also didn't get result? I need to get this result using recursion. If I understand this correctly I need to take for example

\sigma[blaaa,1]

and get for example blabc

and then take

\sigma[blabc,1]

and get for example blaac

and then take

\sigma[blaac,1]

and then say result is blaa. Right?

Why then I didn't get result for 0.431?
 

Attachments

You're still not getting it. It's not the 0.45 that is the problem. It is the limits of integration (the 0 and pi) that are the problem. When (x,y,z) = (0,0,0) or (pi,pi,pi), then the denominator of the integrand goes to zero, so the integrand goes to infinity. So you can't numerically integrate all the way to (0,0,0) or (pi,pi,pi) - you have to stop the numerical integration before you get all the way to (0,0,0) and (pi,pi,pi). Do you see?
 
I understand you now. Sometimes in Mathematica we have singularities but we get numbers. How to transform this what I wrote to get numbers and try to do some recursion.

I need to integrate

\int^{\pi-\epsilon}_{\epsilon}\int^{\pi-\epsilon}_{\epsilon}\int^{\pi-\epsilon}_{\epsilon}dxdydzf

How to write that in Mathematica?
 
Now you're getting it. This is exactly what I wrote:
Code:
NIntegrate[f,{x,e,p-e},{y,e,p-e},{z,e,p-e}]
 
Of course :) I talked about recursion. But that result for me is just that table what you get in your Mathematica file.

{0.538265, 0.441277, 0.432402, 0.431477, 0.431379, 0.431369, 0.431368}

I can say now that the result converge to

0.43136

for T=1

Right?
 
  • #10
Right.
 
  • #11
I am trying to plot a function of two variables but it will be piecewise:
f[x_, y_] := {x^2/(x^2 + y^2),-1<=x<=1,-1<=y<=1} and {0, otherwise}
How can I write these commands? It doesn't work...
Please help...
 
  • #12
The attached notebook will do it.
 

Attachments

Similar threads

Replies
30
Views
2K
Replies
6
Views
3K
Replies
8
Views
2K
Replies
9
Views
2K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
9
Views
2K
Back
Top