MathGroup Archive 1999

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

Search the Archive


  • To: mathgroup at
  • From: adam.smith at
  • Date: Fri, 30 Jul 1999 01:33:49 -0400
  • References: <7ni60c$>
  • Sender: owner-wri-mathgroup at

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-

PlotVectorField[ {x/(x^2 + y^2)^(3/2),y/(x^2 + y^2)^(3/2)},

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) &)]

Adam Smith

In article <7ni60c$5nj at>,
  "Ing. Antonio F.R. CARABIO" <acarabio at> wrote:
> I am running Mathematica 2.1, and having trouble using Plot Vector
> when trying to plot electrostatic fields with singularities of type
> or 1/r^2 at the origin of coordinates. Often when the plot goes near
> origin, the programme answers "Floating Point Error" and the PC goes
> 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

Sent via
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.