From: "William R. Frensley" Subject: Re: Algorithm to draw electric force line? Date: Sat, 29 Apr 2000 21:52:50 -0500 Newsgroups: sci.math.num-analysis Summary: [missing] Ya Ha-wa wrote: > > Hi, all > > In all math tools programs such as MatLab or MathCAD can draw > vector graphs such as electric/magnetic field distribution. > But till now I found no function or any direct way to draw > electric force lines. > > A vector graph is made of many short straight lines of various > length and directions. While the electric force lines are groups > of continues curves, whice are perpendicular to the potential > contour lines. > > We know Cathy-Riemann condition relates the contour lines and the > force lines groups, but how to use numerical method to obtain > force lines from contour lines? > The first question is: are you solving a Laplace or a Poisson problem? If there are space charges present, there is no general solution. The best you can do is to start at some point and draw a sequence of short line segments in the direction of the gradient, as you describe above. There is no guarantee that this procedure will produce lines such that the distance between lines measures the field magnitude. In the very particular case of 2-d Laplace problems, there is a duality relation, as you mention, based upon the isomorphism between this problem and analytic functions in the complex plane. To draw the field lines simply solve the Cauchy-Reimann equations for the other function (called the stream function in fluid dynamics). These equations constitute a simple PDE for the stream function. For example, if you have your potential on a rectangular mesh, just evaluate the finite-differences to get the partial derivatives and add these up in the other direction to get the stream function. Then run any convenient contour plotting routine on the result. - Bill Frensley