public class Potential { double rr; //The ring width double rx; double ry; double Pota; double E, K, m, num, den, den1,t1,t2,t3,t4; public Potential(double pot_A, double ring_radius, double ring_x, double ring_y) { Pota = pot_A; rr = ring_radius; rx = ring_x; ry = ring_y; //compute argument "m" to elliptic integrals E and K num = 4. * rr * java.lang.Math.abs(rx); den = rr * rr + rx * rx + ry * ry + 2.*rr*java.lang.Math.abs(rx); m = num/den; // Elliptic integrals E = 1.+0.46302*(1.-m)+0.10778*((1.-m) * (1.-m))+ java.lang.Math.log(1./(1.-m))*(0.24527*(1.-m)+0.04125*((1.-m) * (1.-m))); K = 1.3863+0.11197*(1.-m)+0.07253*((1.-m) * (1.-m))+ java.lang.Math.log(1./(1.-m))*(0.5+0.12135*(1.-m)+0.02887*((1.-m) * (1.-m))); // Potential // note this scale for Pota apparently missing a factor of "a", the radius of the ring, // but this is deliberate to make the resultant quantity dimensionless // Pota = (rx/(Math.PI * Math.sqrt(den)))*(((2.-m)*K-2.*E)/m) ; // This is the potential given in equations 4.2 and 6.1 of Force Memo #4 and #6 sans current and mhu naught Pota = (rr/(Math.PI * Math.sqrt(den)))*(((2.-m)*K-2.*E)/m) ; //System.out.println("rr " + rr + " rx " + rx + " ry " + ry + " pota " + Pota); } }