[Date Index]
[Thread Index]
[Author Index]
Re: field line with NDSolve
*To*: mathgroup at smc.vnet.net
*Subject*: [mg58055] Re: field line with NDSolve
*From*: dh <dh at metrohm.ch>
*Date*: Fri, 17 Jun 2005 05:19:06 -0400 (EDT)
*References*: <d8rl77$jnl$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Hi Rafal,
here is a working example of your problem:
xmax = 1;
ymin = 0;
ymax = 1;
zmax = 1;
Bx = Sin[y];
By = Cos[x];
Bz = z;
B = {Bx, By, Bz};
b = B/Abs[By] /. {x -> x[y], z -> z[y]};
r = {x[y], z[y]};
eqnb = {D[r[[1]], y] == b[[1]], D[r[[2]], y] == b[[3]]}
bndcon = {x[ymin] == xmax/2, z[ymin] == zmax/10}
eqnbnd = Join[eqnb, bndcon]
Bline = NDSolve[eqnbnd, r, {y, ymin, ymax}]
ParametricPlot3D[Evaluate[{x[y], y, z[y]} /. Bline], {y, ymin, ymax}]
sincerely, Daniel
topolog at gazeta.pl wrote:
> Hi everybody!
>
> I am trying to obtain a magnetic field line in 3d, i.e. z(x{y),y).
> So I have magnetic induction vector B = (Bx, By, Bz), where
> Bi=Bi(x,y,z), i={x,y,z}. By the definition I set an unit vector in
> direction y: b = B / Abs[By] = (bx, by, bz) and replace coordinates
> x and z with functions x[y], z[y]. The final step is to integrate
> the set of 2 equations:
> x'[y] = bx
> z'[y] = bz
>
> In version 4.0 of Mathematica I was able to solve that with the code
> below, but in 5.1 I am not anymore. I suppose the conflict exists in
> passing arguments as symbolic, since B depends on z through
> InterpolatingFunction(s) and after replacing z -> z[y], I got
> InterpolatingFunction[{{0., 1000.}}, <>][z[y]]. But I am not sure
> how to manage this ...
>
> B = {Bx, By, Bz};
> b = B/Abs[By] /. {x -> x[y], z -> z[y]};
> r = {x[y], z[y]};
> eqn_b = {D[r[[1]], y] == b[[1]], D[r[[2]], y] == b[[3]]}
>
> bnd_con = {x[ymin] == xmax/2, z[ymin] == zmax/10};
> eqn_bnd = Join[eqn_b, bnd_con];
> B_line = NDSolve[eqn_bnd, r, {y, ymin, ymax}];
>
> The error I get is:
>
> NDSSolve::nlnum : The function value {...a large expression...} is
> not a list of numbers with dimmensions {2} at y={...a value...}
>
> Any hints, please.
>
> Ragards
> Rafal Kosinski
>
>
>
Prev by Date:
**usage messages in packages**
Next by Date:
**Re: field line with NDSolve**
Previous by thread:
**field line with NDSolve**
Next by thread:
**Re: field line with NDSolve**
| |