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

28 views (last 30 days)
Marc Adams on 17 Mar 2018
Commented: Walter Roberson on 17 Mar 2018
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?
Marc Adams on 17 Mar 2018
r is a unit of distance, not angle.

Walter Roberson on 17 Mar 2018
Edited: Walter Roberson on 17 Mar 2018
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.
Walter Roberson on 17 Mar 2018
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.