field line with NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg58034] field line with NDSolve
- From: <topolog at gazeta.pl>
- Date: Thu, 16 Jun 2005 06:43:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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