MathGroup Archive 2008

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

Search the Archive

Re: vector field specifying location of vectors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92485] Re: vector field specifying location of vectors
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 1 Oct 2008 18:33:05 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gbuls7$ldh$1@smc.vnet.net>

yapster wrote:

> I'd like to plot a vector field and specify which vectors to plot (for example, only at points with integer coordinates). 
> 
> What I am trying to do is show how a vector field transforms under a planar transformation.  So, if F is the planar transformation, a vector V based at the point (x,y) will become a new vector NV based at F(x,y).

Mathematica 6.x has several functions to plot vector fields in 2D and 3D 
[1]. Among all these functions, *ListVectorFieldPlot* [2] might be 
appropriate to display only specific vectors.

Just build a rectangular list (at least 2 by 2) of pair of pairs, i.e. 
{{origX, origY}, {endX, endY}}, with integer coordinates and pass it to 
the function. For instance,

In[1]:= Needs["VectorFieldPlots`"]
data = Table[{-i, j^2}, {i, 0, 1, 0.1}, {j, 0, 1, 0.1}]
pts = Select[#, VectorQ[#, IntegerQ] &] & /@
    Rationalize[data] /. {} -> Sequence[]
ListVectorFieldPlot[pts]

Out[2]= {{{0., 0.}, {0., 0.01}, {0., 0.04}, {0., 0.09}, {0.,
    0.16}, {0., 0.25}, {0., 0.36}, {0., 0.49}, {0., 0.64}, {0.,
    0.81}, {0., 1.}}, {{-0.1, 0.}, {-0.1, 0.01}, {-0.1, 0.04}, {-0.1,
    0.09}, {-0.1, 0.16}, {-0.1, 0.25}, {-0.1, 0.36}, {-0.1,
    0.49}, {-0.1, 0.64}, {-0.1, 0.81}, {-0.1, 1.}}, {{-0.2, 0.}, {-0.2,
     0.01}, {-0.2, 0.04}, {-0.2, 0.09}, {-0.2, 0.16}, {-0.2,
    0.25}, {-0.2, 0.36}, {-0.2, 0.49}, {-0.2, 0.64}, {-0.2,
    0.81}, {-0.2, 1.}}, {{-0.3, 0.}, {-0.3, 0.01}, {-0.3, 0.04}, {-0.3,
     0.09}, {-0.3, 0.16}, {-0.3, 0.25}, {-0.3, 0.36}, {-0.3,
    0.49}, {-0.3, 0.64}, {-0.3, 0.81}, {-0.3, 1.}}, {{-0.4, 0.}, {-0.4,
     0.01}, {-0.4, 0.04}, {-0.4, 0.09}, {-0.4, 0.16}, {-0.4,
    0.25}, {-0.4, 0.36}, {-0.4, 0.49}, {-0.4, 0.64}, {-0.4,
    0.81}, {-0.4, 1.}}, {{-0.5, 0.}, {-0.5, 0.01}, {-0.5, 0.04}, {-0.5,
     0.09}, {-0.5, 0.16}, {-0.5, 0.25}, {-0.5, 0.36}, {-0.5,
    0.49}, {-0.5, 0.64}, {-0.5, 0.81}, {-0.5, 1.}}, {{-0.6, 0.}, {-0.6,
     0.01}, {-0.6, 0.04}, {-0.6, 0.09}, {-0.6, 0.16}, {-0.6,
    0.25}, {-0.6, 0.36}, {-0.6, 0.49}, {-0.6, 0.64}, {-0.6,
    0.81}, {-0.6, 1.}}, {{-0.7, 0.}, {-0.7, 0.01}, {-0.7, 0.04}, {-0.7,
     0.09}, {-0.7, 0.16}, {-0.7, 0.25}, {-0.7, 0.36}, {-0.7,
    0.49}, {-0.7, 0.64}, {-0.7, 0.81}, {-0.7, 1.}}, {{-0.8, 0.}, {-0.8,
     0.01}, {-0.8, 0.04}, {-0.8, 0.09}, {-0.8, 0.16}, {-0.8,
    0.25}, {-0.8, 0.36}, {-0.8, 0.49}, {-0.8, 0.64}, {-0.8,
    0.81}, {-0.8, 1.}}, {{-0.9, 0.}, {-0.9, 0.01}, {-0.9, 0.04}, {-0.9,
     0.09}, {-0.9, 0.16}, {-0.9, 0.25}, {-0.9, 0.36}, {-0.9,
    0.49}, {-0.9, 0.64}, {-0.9, 0.81}, {-0.9, 1.}}, {{-1., 0.}, {-1.,
    0.01}, {-1., 0.04}, {-1., 0.09}, {-1., 0.16}, {-1., 0.25}, {-1.,
    0.36}, {-1., 0.49}, {-1., 0.64}, {-1., 0.81}, {-1., 1.}}}

Out[3]= {{{0, 0}, {0, 1}}, {{-1, 0}, {-1, 1}}}

Out[4]= [... plot showing the two vectors deleted ...]


Regards,
- Jean-Marc

[1] "Vector Field Plotting Package"
http://reference.wolfram.com/mathematica/VectorFieldPlots/guide/VectorFieldPlottingPackage.html

[2] "ListVectorFieldPlot"
http://reference.wolfram.com/mathematica/VectorFieldPlots/ref/ListVectorFieldPlot.html




  • Prev by Date: Re: data source for demonstration
  • Next by Date: Re: extracting contour points
  • Previous by thread: Re: vector field specifying location of vectors
  • Next by thread: Re: signs in the mathematica output