Re: Normal Disappear Problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg55341] Re: [mg55302] Normal Disappear Problem*From*: DrBob <drbob at bigfoot.com>*Date*: Sat, 19 Mar 2005 04:46:45 -0500 (EST)*References*: <200503181035.FAA14770@smc.vnet.net> <opsnuhpjmfiz9bcq@monster.ma.dl.cox.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

Oops, disregard this part of my previous post: >> Normalizing reveals the problem in a different way: >> >> #/#.# &@normVec[f][u, v] // TrigExpand >> % /. v -> 0 >> >> {-Cos[u],-Sin[u],-Cot[v]} >> >> {-Cos[u],-Sin[u],ComplexInfinity} I did the normalization right farther on. Bobby On Fri, 18 Mar 2005 12:01:57 -0600, DrBob <drbob at bigfoot.com> wrote: > Of course the sphere has a normal everywhere, but that doesn't mean a given method of computing the normal WORKS everywhere. > > ClearAll[normVec] > normVec[f_][u__] := > Block[{vars = > Table[Unique["x"], {Length@{u}}], result}, result = > Cross @@ Transpose[D[f @@ vars, {vars}]] /. Thread[vars -> {u}]; > Remove @@ vars; > result] > f[u_, v_] = {Cos[u]Sin[v], Sin[u]Sin[v], Cos[v]}; > normVec[f][u, v] > > {(-Cos[u])*Sin[v]^2, > (-Sin[u])*Sin[v]^2, > (-Cos[u]^2)*Cos[v]*Sin[v] - > Cos[v]*Sin[u]^2*Sin[v]} > > (I haven't normalized, but neither did you.) > > If you substitute u = v = 0, that's certainly the zero vector: > > normVec[f][0,0] > > {0,0,0} > > Now consider the vectors used in the cross product: > > showCross[f_][u__] := Block[{vars = Table[Unique["x"], { > Length@{u}}], > result}, result = cross @@ Transpose[D[f @@ vars, {vars}]] /. Thread[ > vars -> {u}]; > Remove @@ vars; > result] > showCross[f][0,0] > > cross[{0,0,0},{1,0,0}] > > Clearly, that cross product is zero. But why is the first vector all zeroes? > > Well, it's simply because: > > D[f[u, v], {u}] > % /. v -> 0 > > {-Sin[u] Sin[v],Cos[u] Sin[v],0} > > {0,0,0} > > And that's for ALL values of u, so: > > normVec[f][u,0] > > {0,0,0} > > That doesn't look good, but think about it. You started with a "parameterization" of the unit sphere. But it's not a one-to-one mapping: > > f[u,0] > > {0,0,1} > > If the parameterization f is no good at a point, the normal can't be computed using f at that point. > > Normalizing reveals the problem in a different way: > > #/#.# &@normVec[f][u, v] // TrigExpand > % /. v -> 0 > > {-Cos[u],-Sin[u],-Cot[v]} > > {-Cos[u],-Sin[u],ComplexInfinity} > > Everything fails when v = 0. > > So.... What's the simpler, better method? > > Normalizing actually helps: > > #.# &@normVec[f][u, v] // TrigExpand // FullSimplify > > Sin[v]^2 > > normVec[f][u, v]/Sin[v] // TrigExpand > > {-Cos[u] Sin[v], -Sin[u] Sin[v], -Cos[v]} > > We'd probably reverse the sign, and get > > f[u,v]==-% > > True > > In other words, the (outward-pointing) normal at f[u,v] is just f[u,v]. > > Bobby > > On Fri, 18 Mar 2005 05:35:18 -0500 (EST), gouqizi.lvcha at gmail.com <gouqizi.lvcha at gmail.com> wrote: > >> Hi, All: >> >> I have the following parametric equation for an unit sphere: >> >> x = cos(u)sin(v) >> y = sin(u)sin(v) >> z = cos(v) >> >> 0<=u<2*Pi ; 0<=v<=Pi >> >> Then I use >> >> normal = (Dx/Du, Dy/Du, Dz/Du) CROSS (Dx/Dv, Dy/Dv, Dz/Dv) to get the >> normal vector. >> >> I get the follwoing after calculation (with normalization): >> >> normal = [sin(v) ^2 cos(u), sin(v)^2 sin(u), cos(u)^2 cos(v) sin(v) >> + sin(u)^2 cos(v) sin(v)] >> >> Now when u=0, v=0 , Normal = (0,0,0)! How can it be? We know the fact >> that a sphere should have normal everywhere. >> >> Rick >> >> >> >> > > > -- DrBob at bigfoot.com

**References**:**Normal Disappear Problem***From:*"gouqizi.lvcha@gmail.com" <gouqizi.lvcha@gmail.com>