[Date Index]
[Thread Index]
[Author Index]
Re: Vector Fields
*To*: mathgroup at smc.vnet.net
*Subject*: [mg14716] Re: Vector Fields
*From*: Rainer.Bassus at t-online.de (Rainer Bassus)
*Date*: Tue, 10 Nov 1998 01:21:06 -0500
*References*: <7258kj$8bi@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
David Farrelly wrote:<7258kj$8bi at smc.vnet.net>...
>
>I have a couple of questions that I'd appreciate some suggestions on;
>
>(i) I can't get PlotVectorField to work on Mathematica running
> on a PC. Basically I can't figure out what packages
> to load based on what the manual says.
>
You can plot a vector field in Cartesian coordinates with the following
steps:
A = ex Ax + ey Ay + ez Az **This is the Vector field**
ex, ey, ez **are the unit vectors**
Ax = fx(x,y,z), Ay = fy(x,y,z), Az = fz(x,y,z) Ax, Ay, Az **are three
different functions of x,y,z**
A very simple vector field is:
Ax = 0, Ay = 0, Az = 1 ** this vector field has no function of x,y,z but
an constant value of 1 in z-direction ***
The plot with Mathematica can be done with: A = {0,0,1};
<<Graphics`PlotField3D`;
PlotVectorField3D[ A ,{x,-1,1},{y,-1,1},{z,-1,1}]
>(ii) Does anyone know how to plot a vector field on a sphere.
> What I'd like to do is to represent fluid flow using colors
> to represent the fluid density and arrows to represent the
> vector field. This is done on the surface of a sphere (it is
> a quantum mechanical probability current rather than a real
> fluid). If anyone knows of non Mathematica ways of doing
> this I'd also be interested.
>
Mathematica doesn't support the statement SpericalPlotVectorField3D
so you have to convert the Spherical vector field into a Cartesian vector
field and choose than the statement PlotVectorField3D.
The Spherical vector field:
A = eph Aph + eth Ath + er Ar ( eph, eth, er are the units vectors
(bold))
Every part of this vector field in normally a function of phi, theta and
r:
Aph = f1(ph,th,r) (something like that: Aph = r^2Sin[th] Cos[ph])
Ath = f2(ph,th,r) (something like that: Ath =r^7Sin[th]^2
Cos[ph]^3) Ar = f3(ph,th,r)
as sample we choose a very simple field:
Aph = f1(ph,th,r) = r (no function of phi,th. But a function of r
) Ath = f2(ph,th,r) = 0 (no function of phi,th, r and no
constant value)
Ar = f3(ph,th,r) = 0 (no function of phi,th, r and no constant
value)
Asph = {Ar,Ath,Aph} ( That is our entire field)
For the PlotVectorField3D-command you need a x,y,z-dependent. So you
have to replace every r, sin[theta] ,sin[phi] by:
r = Sqrt[ x^2 + y^2 + z^2];
sinph = y/Sqrt[x^2 + y^2];
cosph = x/Sqrt[x^2 + y^2];
sinth = Sqrt[(x^2+y^2)/(x^2+y^2+z^2)]; costh = Sqrt[ z^2/(x^2+y^2+z^2)];
The sample vector field results in:
Aph = f1(x,y,z) = Sqrt[ x^2 + y^2 + z^2] Ath = f2(x,y,z) = 0
Ar = f3(x,y,z) = 0 (This is a Spherical vector field) Asph =
{ 0 , 0 , Sqrt[ x^2 + y^2 + z^2] } ( That is our entire field)
And now the transformation into cartasian coordinates. The standard
transformation is (I found this in "Bronstein Semendjajew - Taschenbuch
der Mathematik"):
Acat =Simplify[{
Asph[[1]] cosph sinth - Asph[[3]] sinph + Asph[[2]] cosph costh,
Asph[[1]] sinph sinth + Asph[[3]] cosph + Asph[[2]] sinph costh,
Asph[[1]] costh - Asph[[2]]
sinth }];
Now the plot with Mathematica:
<<Graphics`PlotField3D`;
PlotVectorField3D[ Acat,{x,-1,1},{y,-1,1},{z,-1,1}]
Rainer Bassus
Prev by Date:
**ODEs and phase portraits**
Next by Date:
**Generating C++BLAS wrapers with Mathematica**
Previous by thread:
**Vector Fields**
Next by thread:
**RE **
| |