(*   This program calculates the potential of an elliptic filament of semi-axes=(a,b) with a charge density λ[θ,g] = λ(Subscript[, 0]) + λ(Subscript[, 1])(θ)/Log(ϵ), where (Subscript[λ, 0]) is a constant and λ(Subscript[, 1])(θ) is a 3-term Fourier series whose coefficients have been determined by trial and error.  The first plot shows the ratio of the capacitance per unit length of the filament to that of a circular one (the latter is calculated using an asymptotic formula valid for thin filaments), a quantity that is expected to approach 1 As ϵ->0.  The manipulation box plots the charge density and the electrostatic potential, both for one quarter of the elliptical filament.  a=1 m, b=2 m, and λ(Subscript[, 0])=1 C/m; SI units are used.   As ϵ->0, the two plots tend to uniformity as Log(1/ϵ), i.e., very slowly.  Other parametes are (gci,gcf)=plot limits on Log(1/ϵ) for "capaciatance," (gmi,gmf)=limits on Log(1/ϵ) for the manipulation box, (c2,c4,c6) the Fourier coefficients for λ(Subscript[, 1])(θ).  Depending on choice of parameters and the machine running it, the program may take a few tens of minutes.  Note the warnings caused by the exceptional point in the integration.  The manipulation box can animate the results. *)
Clear[a,b, gci,gcf,gmi,gmf,c2,c4,c6]
k=8.99*10^9;a=2; b=1;gci=2;gcf=15;gmi=4;gmf=12;    c2=-0.128;c4=-0.016;c6=-0.003; 

ϵ[g_]:=1.0*10^(-g);
R[θ_]:={a*Cos[θ],b*Sin[θ],0};
ν[θ_]:=-{Cos[θ]/a,Sin[θ]/b,0}/((Cos[θ]/a)^2+(Sin[θ]/b)^2)^(1/2);
τ[θ_]:={-Sin[θ]*a,Cos[θ]*b,0}/((b*Cos[θ])^2+(a*Sin[θ])^2)^(1/2);
β[θ_]:=Cross[τ[θ],ν[θ]];
n[θ_,α_]:=Cos[α]*ν[θ]+Sin[α]*β[θ];
alpha[θ_,α_]:=-Sin[α]*ν[θ]+Cos[α]*β[θ];
(* r = vector to the field point, point P;  R= vector to source point, point P0 on the filament *)
r[θ_,α_,g_]:=R[θ]+ϵ[g]*(b^2/a)* n[θ,α];
dist[ θ_,α_,ϕ_,g_]:=((r[θ,α,g]-R[ϕ]).(r[θ,α,g]-R[ϕ]))^(1/2);
λ[θ_,g_]:=(1.+(c2*Cos[2*θ]+c4*Cos[4*θ]+c6*Cos[6*θ])/Log[ϵ[g]]);
λp[θ_,g_]:=(1.+(c2*Cos[2*θ]+c4*Cos[4*θ]+c6*Cos[6*θ])/Log[ϵ[g]])*(a^2*Sin[θ]^2+b^2*Cos[θ]^2)^0.5; 
Φ[ θ_,α_,g_]:= NIntegrate[λp[ϕ,g]/dist[ θ,α,ϕ,g],{ϕ,0,2*π}, PrecisionGoal->6,MaxRecursion->1000];
γ[g_]:=2*Log[8/ϵ[g]]/Φ[0,π/2,g];
Plot[γ[g],{g,gci,gcf}, PlotStyle->Orange,PlotLabel->"Capacitance", Frame->True, ImageSize->Medium, PlotRange->{{gci,gcf},{0.8,1}},FrameLabel->{"Decimal logarithm of 1/ϵ","Capacitance relative to circlular filament"}, LabelStyle->{Orange, Medium,FontFamily->"Times"}] 
ilast=IntegerPart[ 2*(gmf-gmi)];
For[i=0,i≤ ilast,i++,g=gmi+.5*i;Φfigure[i]=Grid[{  {  Plot[λ[θ,g],{θ,0,π/2},Frame->True,ImageSize->Medium, PlotStyle->Green, PlotLabel->ϵ[g]"= ϵ",FrameLabel->{"Polar angle θ [rad]","λ [C/m]"},LabelStyle->{Green,Medium,FontFamily->"Times"}] },{"   "},{ Plot[k*Φ[ θ,π/2,g],{θ,0,π/2},Frame->True,ImageSize->Medium,PlotStyle->Blue,PlotLabel->ϵ[g]"= ϵ",  FrameLabel->{"Polar angle θ [rad]","Φ(α=π/2) [V]"},LabelStyle->{Blue,Medium,FontFamily->"Times"} ]}   }]  ];
Manipulate[Φfigure[i]  , {i,0,ilast,1}, FrameLabel->"Charge density and electrostatic potential for an elliptic filament", LabelStyle->Directive[Black,Medium,FontFamily->"Times"]]