Re: Question:Polar Field Plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg21664] Re: [mg21589] Question:Polar Field Plot*From*: "ZEE MEANT NG" <Zee.Ng-1 at stud.umist.ac.uk>*Date*: Fri, 21 Jan 2000 04:00:15 -0500 (EST)*Reply-to*: mchpizn2 at stud.umist.ac.uk*Sender*: owner-wri-mathgroup at wolfram.com

Dear Hartmut, I have tried the solution which you have given for question 2 using Mathematica 4. The undesired output is not suppressed. On the other hand, the plot which is exactly the same as the one earlier (In[6]) was produced. I would be very helpful if you could help me in solving this problem. regards, zee meant ZEE MEANT NG schrieb: > > I am trying to plot a 2D vector field. Equations which i have are in > polar form ie r and theta. > r^2= x^2+y^2 > Er=f(r,Theta) > Ep=g(r,Theta) > > I have changed them to cartesian form ie Ex, Ey . > and put Theta= arctan[y/x] > My plot covers the region {x,-1,1} and {y-1,1} > > Question 1: > The values of theta produced by mathematica are > -90<Theta<90 degree but what i required is theta which gives the > value from 0 to 360 degree. > I have used the if statement as follows but it does not work. > If[x >= 0, [Theta] = ArcTan[y/x], [Theta] = ArcTan[y/x] + \[Pi]]; > PlotVectorField[{Ex1, Ey1}, {x, - R, R}, > {y, - R, R }] > > Question 2: > Using the built-in function to plot the vector field, it plots all > the field for the entire region. How do i set some constraints so > that it only plots at the desired region (eg. plot where x^2+y^2 < R) > ? > > I am having the same problem in the contour plot as well. hi Zee, To question 1: simply use ArcTan[x,y] which regards the quandrant where {x,y} lies. To question 2: a simple method would be to just suppress unwanted output, e.g.: In[1]:= << Graphics`PlotField` In[6]:= PlotVectorField[{-y, x}, {x, -1, 1}, {y, -1, 1}] and then In[9]:= Show[%6 /. Arrow[{x_, y_}, __] /; x^2 + y^2 > 1.1 -> Sequence[] ] look, that I didn't write x^2 + y^2 > 1 because this gives a somewhat ugly appearance (on obvious grounds as you will see) Of course one could try to write a function PlotSphericalVectorField but it might be difficult to get the sampling points right at nearly constant density (perhaps with the exclusion of a hexgonal pattern, or any of Escher's for that matter). kind regards, Hartmut Zee Menat NG