MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: PlotVectorField3D in Cylindrical Coordinates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37347] Re: [mg37312] PlotVectorField3D in Cylindrical Coordinates
  • From: Selwyn Hollis <selwynh at earthlink.net>
  • Date: Thu, 24 Oct 2002 02:56:11 -0400 (EDT)
  • References: <200210230656.CAA04825@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here's a way of plotting a polar vector field {f(r,q], g[r,q]} (q is the 
angle) by means of PlotField:

<<Graphics`PlotField`;

angle[x_, y_] := Which[x<0, ArcTan[y/x]+Pi, x*y<0, ArcTan[y/x]+2*Pi, 
x!=0, ArcTan[y/x], x==0, Sign[y]*(Pi/2)];

Off[Power::infy, Infinity::indet];

PlotPolarVectorField[{f_,g_}, {r_,q_}, {x_,x1_,x2_}, {y_,y1_,y2_}, 
opts___Rule] :=
  PlotVectorField[{f*Cos[q] - g*Sin[q], f*Sin[q] + g*Cos[q]} /.
    {r -> Sqrt[x^2 + y^2], q -> angle[x, y]},
    {x, x1, x2}, {y, y1, y2}, opts];

(* Example *)

PlotPolarVectorField[{r, Sin[q]}, {r, q}, {x, -1, 1}, {y, -1, 1}]


This uses the same idea to plot a 3D vector field in cylindrical 
coordinates:

<<Graphics`PlotField3D`;

PlotCylindricalVectorField[{f_,g_,h_}, {r_,q_,z_}, {x_,x1_,x2_},
  {y_, y1_, y2_}, {z_, z1_, z2_}, opts___Rule] :=
   PlotVectorField3D[{f*Cos[q] - g*Sin[q], f*Sin[q] + g*Cos[q], h} /.
      {r -> Sqrt[x^2 + y^2], q -> angle[x, y]},
      {x, x1, x2}, {y, y1, y2}, {z, z1, z2}, opts];

(* Example *)

PlotCylindricalVectorField[{0,1,0},{r,q,z},{x,-1,1},{y,-1,1},{z,0, 1}]

----
Selwyn Hollis




stefano fricano wrote:
> Hi,
> 
> Someone known if is possible to create a 3DPlot Vector
> Field using Cylindrical coordinates.
> 
> Using Calculus`VectorAnalysis` Add-on, I can set
> coordinates but Graphics`PlotField3D` seems not using
> the coordinates setted, it works in Cartesian system
> in any case.
> 
> Any idea?
> 
> Thanks in advance,
> Stefano Fricano.
> 
> ______________________________________________________________________
> Mio Yahoo!: personalizza Yahoo! come piace a te 
> http://it.yahoo.com/mail_it/foot/?http://it.my.yahoo.com/
> 
> 




  • Prev by Date: RE: RE: how to extract parameter values
  • Next by Date: matrix multiplication
  • Previous by thread: PlotVectorField3D in Cylindrical Coordinates
  • Next by thread: Re: Re: PlotVectorField3D in Cylindrical Coordinates