Re: How to plot field lines ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg72208] Re: How to plot field lines ?*From*: "Narasimham" <mathma18 at hotmail.com>*Date*: Thu, 14 Dec 2006 05:49:33 -0500 (EST)*References*: <elos9v$oiq$1@smc.vnet.net>

Cham wrote: > Hello, I'm new here. > > I have some complicated deformed dipolar magnetic field in cartesian components, and I need to show > some field lines. I'll also have to extract coordinates of lines to a list. How should I do that ? > I can use the code below (with properly defined functions fx, fy and fz), but it's unreliable > (it frequently hit the singularity at the center) and it frequently gives many unpredictable curves. > Any idea ? Please, I need help ! :-( > > FieldCurve = NDSolve[{ > > x'[t] == fx[ x[t], y[t], z[t] ], y'[t] == fy[ x[t], y[t], z[t] ], z'[t] == fz[ x[t], y[t], z[t] ], > > x[0] == ... number ..., > y[0] == ... number ..., > z[0] == ... number ... > > }, {x, y, z}, {t, 0, 100}, MaxSteps -> 10000] > > Graph = ParametricPlot3D[ > Evaluate[{x[t], y[t], z[t]}/. FieldCurve], > {t, 0, 100}, PlotPoints -> 1000] ------ " It works fine for some right hand side functions/BC chosen as above. Check how your functions behave at required critical points by beginning with simple functions. Avoid giving BC at or near singularities, i.e.,near positive/negative charges/source/sinks &c." << RealTime3D` tm = 50 ; FieldCurve = NDSolve[{ x'[t] == Sin[ z[t]] - y[t], y'[t] == x[t] - Cos[z[t]], z'[t] == -Sin[y[t]] + x[t] , x[0] == 2, y[0] == 1, z[0] == 0 }, {x, y, z}, {t, 0, tm}, MaxSteps -> 10000] ; Graph = ParametricPlot3D[ Evaluate[{x[t], y[t], z[t]} /. FieldCurve], {t, 0,tm}, PlotPoints -> 1000] ; Narasimham