My int function is returning the function back instead of an integral

I have this function
f = (sin(2*r^2)*(16*r^4 + 1)^(1/2))/(r^2 + z^2)^(3/2)
but when I try to integrate it
int(f,r,[0 10])
it returns the function back:
ans =
int((sin(2*r^2)*(16*r^4 + 1)^(1/2))/(r^2 + z^2)^(3/2), r, 0, 10)
How do I find the integral?

댓글 수: 4

Could you confirm that you have sin(2*r^2) where r is in the range 0 to 10 and r is in radians ? So at the end of the range you would be calculating sin(200 radians) ?
The r and z are from cylindrical coord system, so r is not in radians
What is the units of r then? If it is degrees then you need to convert degrees to radians for use in the sin() call. (Actually, it would have to be in square root of degrees, since you are using r^2)
Your function does not appear to be linear if r were rescaled to be from 0 to 10*pi/180 or sqrt(10*pi/180)
r is a unit of distance, not angle.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 3월 17일
편집: Walter Roberson 2018년 3월 17일

1 개 추천

That function has no obvious closed form integral. You will need to switch to numeric integration, such as with integral() or vpaintegral(). That will require that you have a numeric value for z.
Note: sometimes I would suggest using a taylor series, but if you taylor at r = 0 or r = 5 then the results will be rather off.

댓글 수: 1

Why are you taking sin() of (distance squared) ? For example at the end of the range are you taking sin(200 in^2) ?
Ask yourself whether your formula is immune to scaling. If you were to replace r with R*c where c is some scaling factor representing a different unit, and were to change the upper bound appropriately, then would the same formula fall out?
The answer is No. For one thing, the +1 in the (16*r^4+1) is not going to scale with the change in units.
We can make an ad-hoc guess that perhaps the 1 needs to be replaced with c^4 where c is the same scaling factor. If we then restrict everything to nonnegative, the formula
sin(2*(R*c)^2)*(16*(R*c)^4+c^4)^(1/2)/((R*c)^2+(Z*c)^2)^(3/2)
simplifies to
sin(2*R^2*c^2)*(16*R^4+1)^(1/2)/(c*(R^2+Z^2)^(3/2))
this has sin() of c^2 times larger and a divisor of c.
If you choose c = 254/100 (inches to mm), and choose z = 5 for the original formula and Z = 5*100/254 for the second formula, (because Z*c is used so 5*100/254*254/100 -> 5 would give the same result as z = 5), and you plot the first formula over r = 0 to 10, and plot the second over R = 0 to 10*100/254: then at first look the graphs are much the same. But if you look carefully, the height of the first peak is different.
If you then proceed to test with r = 7 for the first formula and R = 7 * 100/254 for the second formula, then you get different results -- the formulas are not equal under a distance transform, even if you use c^4 instead of 1 so that the constant can factor out of the sqrt() part.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

질문:

2018년 3월 17일

댓글:

2018년 3월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by