 
 
 
 
 
 
Re: Vector Field
- To: mathgroup at smc.vnet.net
- Subject: [mg16308] Re: Vector Field
- From: adam.smith at hillsdale.edu
- Date: Sun, 7 Mar 1999 01:05:38 -0500
- Organization: Deja News - The Leader in Internet Discussion
- References: <7bg1g5$5l8@smc.vnet.net> <7bntqq$diq@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Boy you guys must think that I am a total idiot.  I accidentally pasted Jens
text in my previous post.
Anyway here is my suggestion:
In[1]:=
<<Calculus`VectorAnalysis`
In[2]:=
SetCoordinates[Cartesian[x,y,z]];
In[3]:=
<<Graphics`PlotField3D`
In[4]:=
sphere = ParametricPlot3D[{Sin[x]*Cos[y],Sin[x]*Sin[y],Cos[x]},{x,0,Pi},{y,0,
      2*Pi},DisplayFunction->Identity];
In[5]:=
f = x^2 + y^2 + z^2;
In[6]:=
gf = Grad[f]
Out[6]=
{2 x,2 y,2 z}
In[7]:=
normals = Flatten[
		Table[
		{{Sin[u]*Cos[v],Sin[u]*Sin[v],Cos[u]},{Sin[u]*Cos[v],Sin[u]*Sin
[v],
          Cos[u]}},{u,0,Pi, Pi/4},{v,0,2 Pi, Pi/4}],1];
In[8]:=
vec = ListPlotVectorField3D[normals,Axes->True,VectorHeads->True,
    DisplayFunction->Identity]
In[9]:=
Show[{sphere,vec},DisplayFunction->$DisplayFunction]
In article <7bntqq$diq at smc.vnet.net>,
  Jens-Peer Kuska <kuska at informatik.uni-leipzig.de> wrote:
> Hi Luke,
>
> why to use Photoshop to overlay the images ? The combination is easy:
>
> field = PlotGradientField3D[1/(1 + x^2 + y^2 + z^2), {x, -1.2, 1.2},
>     {y, 0, 1.2}, {z, -1.2, 1.2}, VectorHeads ->
> True,DisplayFunction->Identity]
>
> sph = ParametricPlot3D[{Cos[phi]*Sin[th], Sin[phi]*Sin[th], Cos[th]},
>     {phi, 0, Pi}, {th, 0, Pi},DisplayFunction->Identity]
>
> Show[{sph, field},DisplayFunction->$DisplayFunction]
>
> Hope that helps
>   Jens
>
> Luke wrote:
> >
> > I am trying to create a picture of a sphere with Normal vectors on the
> > surface to demonstrate the Divergence Theorum. I am quite new to Mathematica
> > and I was wondering if it could be done.
> >
> > I have created the sphere using:
> >
> > ParametricPlot3D[{Sin[x]*Cos[y],Sin[x]*Sin[y],Cos[x]},{x,0,Pi},{y,0,2*Pi}]
> >
> > I am hoping to be able to use PlotVectorField3D to create a vector field and
> > overlay in on the image using Photoshop where I could remove the vector
> > which should not be in view. I'm not sure how to plot the field desired.
> >
> > Anyone have any suggestions?
> >
> > Luke
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

