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

51 views (last 30 days)
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?

Sign in to comment.

Accepted Answer

Walter Roberson
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.
  1 Comment
Walter Roberson
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
simplifies to
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!