       Re: QUESTION ABOUT PLOT VECTOR FIELD

• To: mathgroup at smc.vnet.net
• Subject: [mg18960] Re: QUESTION ABOUT PLOT VECTOR FIELD
• From: adam.smith at hillsdale.edu
• Date: Fri, 30 Jul 1999 01:33:49 -0400
• References: <7ni60c\$5nj@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I don't currently have access to Mathematica 2.1, but I have
encountered the same basic problem in 3.0.  The program does not bomb,
but it does output the annoying error messages.  One very easy solution
is to change the number of points that the plot is sub-divided into.
The default is PlotPoints->15.  If you are picking a region symmetric
about zero like {x,-1,1},{y,-1,1} as most of us do, this odd number for
PlotPoints means the point {0,0} is taken.  The fix is to pick an even
number for PlotPoints.

Here is a sample that works for me.  I am assuming the by plotting 1/r
you mean that you want the vector that has x componets of 1/r*Cos
[theta] which equals x/(x^2 + y^2)^(3/2) and similar for the y-
components:

PlotVectorField[ {x/(x^2 + y^2)^(3/2),y/(x^2 + y^2)^(3/2)},
{x,-1,1},{y,-1,1},PlotPoints->12]

Experiment with the value of PlotPoints to get things looking like you
want.  I have also found that for display purposes it is often useful
to "cheat" on the scaling of the length of the arrows.  In the
following I scale each vector by its fourth root, this makes it so that
things don't get small so quickly and you can see some "tails" on the
arrow heads as you move out.  Once again experiment until you get what
you want - I arbitrarily chose an exponent of 1/4, maybe you will find
some other exponent or function will work better.

PlotVectorField[ {x/(x^2 + y^2)^(3/2),y/(x^2 + y^2)^(3/2)},
{x,-1,1},{y,-1,1},PlotPoints ->12,ScaleFunction -> (#^(1/4) &)]

In article <7ni60c\$5nj at smc.vnet.net>,
"Ing. Antonio F.R. CARABIO" <acarabio at arnet.com.ar> wrote:
>
> I am running Mathematica 2.1, and having trouble using Plot Vector
Field
> when trying to plot electrostatic fields with singularities of type
1/r
> or 1/r^2 at the origin of coordinates. Often when the plot goes near
the
> origin, the programme answers "Floating Point Error" and the PC goes
out
> of service. Is there any way of getting a plot in this case?, or do I
> have to accept only graphics in regions far from the origin? Can you
> help me, please? Thanks in advance. Rubin Carabio. Buenos Aires.
> Argentina.
>
> acarabio at arnet.com.ar
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

```

• Prev by Date: Re: saving a list.
• Next by Date: Removing Graphics3D polygon edges
• Previous by thread: Re: QUESTION ABOUT PLOT VECTOR FIELD
• Next by thread: a multivariate quadratic regression question.