The length of the intersection curve between a sphere and a cylinder
6 views (last 30 days)
Show older comments
Sora Kagami
on 26 May 2019
Commented: John D'Errico
on 27 May 2019
How can I compute the length of the intersection curve between the sphere
x^2+y^2+z^2=16
and the cylinder
x^2+y^2=2x
3 Comments
John D'Errico
on 26 May 2019
It would seem this would have been a far more interesting problem if they changed the cylinder by a bit. Perhaps something like:
x^2 + y^2 = 6*x - 4
That should probably combine the disjoint segments into one continuous curve.
Or, if they had made it a cylinder with an elliptical cross-section.
So maybe good that I am not teaching this class. ;-)
Accepted Answer
John D'Errico
on 26 May 2019
Edited: John D'Errico
on 26 May 2019
I won't do your homework. I'll get you off to a good start, in fact, probably more than you deserve, since you appear to have made no serious effort.
The sphere is a sphere centered at the origin, of radius 4.
The cylinder is a circle in the (x,y) plane, so the same for all z. Completing the square, it can be written as:
(x^2 - 2*x +1) + y^2 = 1
or
(x - 1)^2 + y^2 = 1
So the cylinder has center (1,0,z), for all z.
That tells me the two objects do intersect, as well, they will intersect in TWO disjoint curves, one for positive z, the second for negative z.
In fact, if you view the intersection curve from the top, it will look perfectly circular. And this should be the clue you need.
Suppose you thought about this in terms of polar coordinates? To make it simple, translate the problem so the cylinder is centered at (0,0) in (x,y). Then the equation of the sphere is just:
(x+1)^2 + y^2 + z^2 == 16
The cylinder is now
x^2 + y^2 == 1
Nothing changes about the length of the curve. But perhaps now you can visualize that happens when we re-write this all in polar form. Actually, cylindrical coordiantes, thus (r,theta,z)
In cylindrical coordinates, the cylinder has equation
r == 1
Now, substitute into the sphere equation. Remember, since we now know that r==1,
x = r*cos(theta) = cos(theta)
y = r*sin(theta) = sin(theta)
now, lets look at what happened to the sphere.
(I've deleted the stuff that gives you a formula for z as a function of theta. In fact there is a remarkably simple form for z that will result.)
z = stufffffffffffff
Can you now find the arc length of that function, as theta varies from 0 to 2*pi? (I hope so.) A quick numerical computation of my own had the arc length as roughly 6.3864. My guess is only the first few digits of that are accurate, because of the approach I took for that first pass. But it should be close to 2*pi, but a bit larger, just as a visual assessment from a plot.
How do you find the arc length of a curve? I might be lazy, and use my arclength utility, as posted on the file exchange.
theta = linspace(0,2*pi,10000);
x = cos(theta);y = sin(theta);z = ????????;
arclength(x,y,z,'spline')
ans =
6.39448891369661
You should be able to do the same however, using an integration. A google search for the phrase
"arc length of a parametric curve"
might give you some ideas. Don't forget that this curve is in the form (x(theta),y(theta),z(theta)). x(theta) is just cos(theta), etc. In fact, when I do that computation, integral tells me the arc length should be
ans =
6.39448891369662
int did not find a symbolic solution however. Que sera, sera. But vpaintegral gives me:
ans =
6.3944889136966193144
I would note that the answer is indeed just a wee bit more than 2*pi, as I predicted it should be.
So, now all you need to do is do the algebra, then do some numerical methods work to replicate my results. IF you do decide to make a serious effort, then show what you did as a comment here. If you come at least close, showing that you have thought about the problem, then I might raise some of the veil on my answer.
4 Comments
John D'Errico
on 27 May 2019
The point of much that I said was you did not need MATLAB to do it. In fact, almost everything I did was written first on a piece of paper, where I needed to know nothing more than how to convert to polar coordinates, thus
x = r*cos(theta)
y = r*sin(theta)
and the basic identity
sin(theta)^2 + cos(theta)^2 = 1
Anyway, I gave you explicit instructions of what to do. You can follow them, and derive a simple solution on paper for z as a function of theta in polar form. Once you have that, IF you show what you get, and make any credible shot at putting it into MATLAB, I'll be more forthcoming. But until then, I don't do homework, although I am willing to help a person who seriously tries and shows the effort made. So go for it. I gave you entirely enough to solve the problem.
More Answers (1)
darova
on 26 May 2019
It's clear enough to see that all x, y of the curve are belong to cylinder:
And z coordinate we can get from sphere equation since we have all x,y:
Curve intersection looks like circle so its length has to be about 2pi*r:
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!