MathGroup Archive 2002

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

Search the Archive

Re: Re: PlotVectorField3D in Cylindrical Coordinates

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

So ArcTan can take two arguments... what a concept! Here's a cleaner 
version of my previous post.


<< "Graphics`PlotField`";

Off[ArcTan::indet];

rot[q_] := {{Cos[q], -Sin[q]}, {Sin[q], Cos[q]}};

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

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

<< "Graphics`PlotField3D`";

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

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

----
Selwyn Hollis



I wrote:
> 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: help on bootstrap sample
  • Next by Date: Re: Pascal's Triangle
  • Previous by thread: Re: PlotVectorField3D in Cylindrical Coordinates
  • Next by thread: Problems about NSolve