Re: PlotVectorField
- To: mathgroup at smc.vnet.net
- Subject: [mg59468] Re: [mg59412] PlotVectorField
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 10 Aug 2005 02:57:23 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Rafal,
First we have to make up some sample interpolation functions.
F1 = FunctionInterpolation[Sin[z], {z, 0, 2*Pi}];
F2 = FunctionInterpolation[Cos[z], {z, 0, 2*Pi}];
F3 = FunctionInterpolation[z, {z, 0, 2*Pi}];
Bo = FunctionInterpolation[z^2*Cos[z], {z, 0, 2*Pi}];
Then define an expression for the exponential term.
fexp[A_, kx_, ky_][x_, y_] = ComplexExpand[Re[Exp[A + I*kx*x + I*ky*y ]]]
E^A*Cos[kx*x + ky*y]
Then there is no trouble with the plots.
Needs["Graphics`PlotField`"]
Bx,By plot...
With[{z = 1},
PlotVectorField[
F1[z]fexp[1, 1, 1][x, y]{1, 1 + Bo[z]}, {x, -3, 3}, {y, -3, 3}]];
Bx, Bz plot
With[{z = 1},
PlotVectorField[F1[z]fexp[1, 1, 1][x, y]{1, 1}, {x, -3, 3}, {y, -3,
3}]];
But you seem to be having a problem with your particular interpolation
function, which is returning a complex number. First I would try to use
Chop.
With[{z = 1},
PlotVectorField[
F1[z]fexp[1, 1, 1][x, y]{1, 1} // Chop, {x, -3, 3}, {y, -3, 3}]];
If that doesn't work I would investigate what the F1,F2,F3 functions
actually look like, perhaps by plotting the separtately.
It is generally helpful to develop, simplify and perhaps define the plotting
expression outside of a Plot statement and when it looks reasonable put THAT
expression in the Plot statement.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: topolog at gazeta.pl [mailto:topolog at gazeta.pl]
To: mathgroup at smc.vnet.net
Dear Mathematica Users!
I met a difficulty in plotting a vector field B={Bx,By,Bz}. Here how
it looks like:
1. My vector components are:
Bx = Bx(x,y,z) = F1(z) * Exp[A + I*kx*x + I*ky*y ]
By = By(x,y,z) = Bo(z) + F2(z) * Exp[A + I*kx*x + I*ky*y ]
Bz = Bz(x,y,z) = F3(z) * Exp[A + I*kx*x + I*ky*y ]
where F1,F2,F3,Bo are Real functions in terms od
InterpolatingFunction[z], A,kx,ky are Real parameters, x,y,z are 3D
coordinates of Real space and I denotes Imaginary unit.
2. I take 2D cuts, for example {Bx,By} and {Bx,Bz}
2a) {Bx,By} works fine:
PlotVectorField[{Re[Bx], Re[By]} /. {z -> zmax}, {x, xmin, xmax},
{y, ymin, ymax}]
It works fine because I set a concrete value of z-functions F1,F2,F3,Bo.
2b) {Bx,Bz} fails:
PlotVectorField[{Re[Bx], Re[Bz]} /. {y -> ymax}, {x, xmin, xmax},
{z, zmin, zmax}]
It fails with following error:
'Min::nord: Invalid comparison with 0.721941 +0.I attempted'
3. I have been trying following modifications:
PlotVectorField[{ComplexExpand[Re[Bx]], ComplexExpand[Re[Bz]]} /. {y
-> ymax}, {x, xmin, xmax}, {z, zmin, zmax}]
and also
PlotVectorField[{ \\
ComplexExpand[Re[Bx]/. InterpolatingFunction[s__] -> \\
(InterpolatingFunction[s][Re[#]] &)], \\
ComplexExpand[Re[Bz]/. InterpolatingFunction[s__] -> \\
(InterpolatingFunction[s][Re[#]] &)]} \\
/. {y -> ymax}, {x, xmin, xmax}, {z, zmin, zmax}]
(here \\ denotes continuation of line)
Unfortunately no of that tricks helps.
It is very important to me and urgent, so I would appreciate any help.
Thanks in advance and best regards
Rafal Kosinski
--
Tylko w sierpniu Avanti tak¿e w wersji MINI - z ³atwo¶ci± zmie¶ci siê w
torebce!
http://www.avantimoda.pl