What are the gradient lines of the magnetic field of a cylindrical magnet? The problem is identical to that for a finite-length solenoid.  I was interested in finding the family of curves for the equipotential lines, rather than the B field itself, which is more readily determined thru the magnetic vector potential.  It is a notoriously difficult problem analytically involving elliptic integrals, either way.  If you try to solve the problem using the scalar magnetic potential, it becomes reversed.  Instead of a continuous current sheet on the side of the cylinder, one finds no "surface magnetic charge density" on the sides, but only on the ends!  That is, the problem is equivalent to finding the field due to two uniformly charged disks separated equally apart by L/2.  These are the two "poles" of either our magnet or solenoid.  Using the same integral expressions as in electrostatics problems, one obtains two integrals of identical form, differing only in the parameter z+- L/2.  So the problem reduces to solving only one integral, for one of the "poles".  The solution is oft-quoted as the difference in two integrals, in cylindrical coordinates, each one corresponding to each pole.  They are of the form:
 
An analytical expression can be obtained, although the calculation is quite tedious and laborious since almost nothing cancels between the difference of the two integrals.  Even finding an expression for the far-field is challenging.  I won't post my calculation here because it is too long and likely of little practical use, but it consists of one elliptic integral of the first kind, one of the second kind, and a lot more terms containing pairs of elliptic integrals of the third kind.  I wonder if anyone's tried this.  Doubtful since it seems to be mainly a math exercise in elliptic integrals.  There are of course far better ways to approach the problem, by the magnetic vector potential for example. This and the spherical magnetic problem has brought to my attention the earth's weakening magnetic field which could be of even greater concern than global warming.  Thanks   
 A: 
There have been a lot of derivations on the magnetic field of a cylindrical magnet as a homework problem. See for example, this one and the plot below. The gradient line can be obtained by doing a gradient on the scalar potential equation given in the reference. 
A: Thanks for answering my question, and for the Mathematica link.  That's certainly a slick way to approach the problem.  I know the gradient lines or lines of equipotential can be worked out in a fairly straightforward manner from an analytical expression for the field.  I'm not sure that's always the case, but that's how I did it for the spherical magnet problem.  But I was inclined to use the magnetic potential method in this case as its a common method for solving magnetostatics problems involving permanent magnets.  It does commonly occur in homework problems in magnetostatics, but they generally stick to an on-axis problem, for good reason!  Even Jackson doesn't attack the general problem.  This problem has now evolved into becoming something of a math exercise in its own right.  In fact, I've continued to dog away at the thing since my original post and made a little progress toward finding an analytical expression for the scalar magnetic potential for a cylindrical magnet in this way.  So far I've worked on it long enough to convince myself that an analytical expression is feasible.  I've managed to reduce the equations to a sum of an integral in elliptic form (that is, integral over f(x,y), where y is the square root of a polynomial of order three or four, and another involving sqrt(1-x**2) that's relatively small and doable from an integral table or some straightforward method of reduction.  Anyway, to do it all out would probably take at least a ten pager of mathematics.  It's enough for now, might pick it up another time.  
I'm rather new to this forum and in a little hurry;  next time I'll try to use Mathjax. Thanks for the tip!
