MathGroup Archive 2005

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

Search the Archive

field line with NDSolve - attachment on www

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58129] field line with NDSolve - attachment on www
  • From: <topolog at gazeta.pl>
  • Date: Sun, 19 Jun 2005 03:43:37 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Daniel and All

Thank you for the example - I have checked and it works. Anyway, in
Mathematica4.0 my problem also can be solved but I moved to version
5.1 and here it fails. (A person from the mathgroup minded me the
names of variables, eg. 'eqn_b', which I agree is misleading and of
course in my code appears as 'eqnb'). 

If I still may count on your help, on
http://www.astri.uni.torun.pl/~krix you will find files b.mx
(contains the whole vector b and values {xmax,ymin,ymax,zref}). and
a notebook b.nb (prepared to work with b.mx). The link is called
'Temporary: MATHGROUP' (files are in an archive b.tar). 

I would like to remind, that the message I get (NDSolve::nlnum, see
my previous post) is not documented yet in 5.1.

Thank you and regards
Rafal

-----------

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
>


-- 
Promocja! Format 15x20 tylko 99gr!
Zamów odbitki cyfrowe online - odbierz za darmo w EMPiK-u lub wy¶lemy Ci je poczt±
http://gazeta.empikfoto.pl


  • Prev by Date: Re: Mathematica 5.0 eps generation
  • Next by Date: Re: Nested Commutators
  • Previous by thread: Re: New Line/CR
  • Next by thread: Re: field line with NDSolve - attachment on www