MathGroup Archive 2005

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

Search the Archive

field line with NDSolve

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.

Rafal Kosinski

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

  • Prev by Date: Re: For Loop and Array related
  • Next by Date: Re: For Loop and Array related
  • Previous by thread: Re: Problem defining assumptions on a set of variables
  • Next by thread: Re: field line with NDSolve