Re: Intersection of line and a surface of revolution - a problem with

• To: mathgroup at smc.vnet.net
• Subject: [mg102589] Re: [mg102577] Intersection of line and a surface of revolution - a problem with
• From: "David Park" <djmpark at comcast.net>
• Date: Sun, 16 Aug 2009 06:39:11 -0400 (EDT)
• References: <22608339.1250329856036.JavaMail.root@n11>

```First define the height and line functions used in the plot:

height[r_] := 1/2 - r^2 + 1/2 r^4
line[t_] := {t, -t, 4 t - 1}

Then write and solve the equations for the intersection. We want the values
of t for which the line intersects the surface. Note that r is the radial
distance in the xy-plane.

eqns = {height[Sqrt[x^2 + y^2]] == z,
Sequence @@ Thread[{x, y, z} == line[t]]};
tsols = Select[NSolve[eqns, t, {x, y, z}], FreeQ[#, Complex] &]

{{t -> 1.42607}, {t -> 0.327201}}

Then the plotting is much simpler using Presentations.

Needs["Presentations`Master`"]

Draw3DItems[
{{Opacity[.4, Blue],
RevolutionDraw3D[height[r], {r, 0.05, 2.4},
Mesh -> None]},
{Red, AbsoluteThickness[2],
ParametricDraw3D[line[t], {t, 0, 2}]},
{Black, AbsolutePointSize[6],
Point[line[t]] /. tsols}},

NeutralLighting[0, .5, .1],
NiceRotation,
Axes -> True,
BoxRatios -> {1, 1, 1},
ViewPoint -> 2 {1.333, 1.765, 0.3479},
ImageSize -> 400]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

From: Bob F [mailto:deepyogurt at gmail.com]

Can someone explain why there is such a difference in the observed
intersection points of a line and a surface of resolution and the
calculated intersections? Here is some code that should illustrate the
issue (especially the second plot).

Clear[sr3, l, nsol3, sol3, ip3, ip4, nip3, nip4, x, y, z, t];

sr3 = RevolutionPlot3D[1/2 - x^2 + x^4/2, {x, 0.05, 2.4},

PlotStyle -> Opacity[0.4], Axes -> True,
AxesLabel -> {"x", "y", "z"}, Mesh -> False,
BoxRatios -> {1, 1, 1},
PlotRange -> {{-4., 4.}, {-4., 4.}, {0., 8.0}}, AspectRatio -> 1];

l = ParametricPlot3D[{t, -t, 4*t - 1}, {t, -3, 3},
PlotStyle -> {Thickness[0.01], Red}];

nsol3 = NSolve[{z == 1/2 - x^2 + x^4/2, x == t, y == -t,

z == 4*t - 1}, {x, y, z, t}]

sol3 = Solve[{z == 1/2 - x^2 + x^4/2, x == t, y == -t,

z == 4*t - 1}, {x, y, z, t}]

ip3 = Show[
Graphics3D[{{AbsolutePointSize[10],
Point[{x, y, z} /. sol3[[3]]]}}]];
nip3 = Show[
Graphics3D[{{AbsolutePointSize[10],
Point[{x, y, z} /. nsol3[[3]]]}}]];
ip4 = Show[
Graphics3D[{{AbsolutePointSize[10],
Point[{x, y, z} /. sol3[[4]]]}}]];
nip4 = Show[
Graphics3D[{{AbsolutePointSize[10],
Point[{x, y, z} /. nsol3[[4]]]}}]];

Show[sr3, l, ip3, ip4, ViewPoint -> {1.333, 1.765, 0.3479}]
Show[sr3, l, nip3, nip4, ViewPoint -> {1.333, 1.765, 0.3479}]

Both "Show[]" commands have both intersection points as large black
points - one of them isn't even close to being on the surface, and the
other is closer but still obviously not on the surface itself (you
might need to zoom in (use the Option key on the Mac version of
Mathematica) and/or rotate the surface around to get a better look at
how close the point isn't to the surface. The difference between the
two surfaces is the first shows the exact solutions from Solve[] and
the second shows the numerical solutions from NSolve[].

Thanks for any help or suggestion as to what might be the cause of the
difference.

-Bob

```

• Prev by Date: Re: Re: CUDA and Mathematica
• Next by Date: Re: Imported Image In Manipulate Resizing in 7
• Previous by thread: Re: Intersection of line and a surface of revolution - a problem with
• Next by thread: Re: Intersection of line and a surface of revolution - a problem with