cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Double integreal calculation, unknown error

llourenço
1-Newbie

Double integreal calculation, unknown error

Hello there,

I have try to calculate a volume of a torus, and for that I use a function of z and two integrals, but I got error "unknown error".

I believe my formula is right, also expression.

Capturar.PNG

You can check attaeched document.

It works in cylindrical coords, but I also have to calculate in cartezian . What I'm doing wrong?

regards, LL

1 ACCEPTED SOLUTION

Accepted Solutions

I believe my formula is right, also expression.

Both integral limits are wrong.

The outer integral has to run from 0 to 80 (R+r) and the the upper limit of the inner integral gets imaginary for values greater than 40 (which is the reason for the error). So replace it by its real part which sets it to zero for values greater than 40 and this happens to be exactyl what is needed. Furthermore you should either use the second value of z or switch the integral limits, but thats just a matter of sign.

You formula will only calculate the volume of the upper half of a quarter of the donut, so you have to multiply it by 8.

If you let the outer integral go from -80 to 80 you get the upper half (you have chosen the positive root for z) of the right half (y>0) torus and have to multiply by 4 therefore.

For better accuracy you should decrease the value of TOL - default is 10^-3 which gets you a slighty different result compared to the "exact" v.boia.

1.png

There is no symbolic evaluation necessary:

2.png

And if you like to use units, too, you have to redifine z(x,y) - best done in a general form using R and r as arguments:

3.png

View solution in original post

2 REPLIES 2

I believe my formula is right, also expression.

Both integral limits are wrong.

The outer integral has to run from 0 to 80 (R+r) and the the upper limit of the inner integral gets imaginary for values greater than 40 (which is the reason for the error). So replace it by its real part which sets it to zero for values greater than 40 and this happens to be exactyl what is needed. Furthermore you should either use the second value of z or switch the integral limits, but thats just a matter of sign.

You formula will only calculate the volume of the upper half of a quarter of the donut, so you have to multiply it by 8.

If you let the outer integral go from -80 to 80 you get the upper half (you have chosen the positive root for z) of the right half (y>0) torus and have to multiply by 4 therefore.

For better accuracy you should decrease the value of TOL - default is 10^-3 which gets you a slighty different result compared to the "exact" v.boia.

1.png

There is no symbolic evaluation necessary:

2.png

And if you like to use units, too, you have to redifine z(x,y) - best done in a general form using R and r as arguments:

3.png

Hello WE,

Okay, I just use the real function of square root. And now its fine.

Thank you for your help.

Regards, LL

Top Tags