[math-fun] garbled ellipse length
The Wikipedia ellipse article borrows (with the Goldwynism "For computational purposes a much faster series where the denominators vanish at a rate ...") a series from http://www.iamned.com/math/ which offers "A Rapidly converging formula for the circumference of an elipse that gives log (1024/27((a+b)/(a-b))^8) digits per term : ", a formula satisfyingly symmetrical in a and b, but which unfortunately vanishes (instead of 4a) for b=0, and generally fails for b<a. Does anybody know what this should be? The Wikipedia article actually corrects an obvious asymmetry in the iamned.com source, but the Wikigrapher must not have tested it. --rwg Here is what I typed: 8*\[Pi]/Q^(5/4)* Sum[Pochhammer[1/12, n]*Pochhammer[5/12, n]*(v1 + v2*n)* r^n/n!^2, {n, 0, \[Infinity]}] /. r -> 432*(a^2 - b^2)^2*(a - b)^6*b*a/Q^3 /. Q -> b^4 + 60*a*b^3 + 134*a^2*b^2 + 60*a^3*b + a^4 /. v1 -> a*b*(15*b^4 + 68*a*b^3 + 90*a^2*b^2 + 68*a^3*b + 15*a^4) /. v2 -> -a^6 - b^6 + 126*(a*b^5 + b*a^5) + 1041*(a^2*b^4 + a^4*b^2) + 1764*a^3*b^3 A correct formula for a>=b is elliplen[a_, b_] := 4*a*EllipticE[Sqrt[1 - b^2/a^2]]
David Cantrell to the rescue. On Mon, Sep 26, 2011 at 3:33 AM, Bill Gosper <billgosper@gmail.com> wrote:
The Wikipedia ellipse article borrows (with the Goldwynism "For computational purposes a much faster series where the denominators vanish at a rate ...") a series from http://www.iamned.com/math/ which offers "A Rapidly converging formula for the circumference of an elipse that gives log (1024/27((a+b)/(a-b))^8) digits per term : ", a formula satisfyingly symmetrical in a and b, but which unfortunately vanishes (instead of 4a) for b=0,
This is an unrelated, 0^0 problem.
and generally fails for b<a.
No, I was using in Mma the formula based Maple's notion of elliptic E. (The old modulus vs parameter confusion.) Does anybody know what this should be? The Wikipedia article actually
corrects an obvious asymmetry in the iamned.com source, but the Wikigrapher must not have tested it.
Apologies: The Wikipedia formula is correct! (Except possibly at b=0.)
--rwg Here is what I typed: 8*\[Pi]/Q^(5/4)* Sum[Pochhammer[1/12, n]*Pochhammer[5/12, n]*(v1 + v2*n)* r^n/n!^2, {n, 0, \[Infinity]}] /. r -> 432*(a^2 - b^2)^2*(a - b)^6*b*a/Q^3 /. Q -> b^4 + 60*a*b^3 + 134*a^2*b^2 + 60*a^3*b + a^4 /. v1 -> a*b*(15*b^4 + 68*a*b^3 + 90*a^2*b^2 + 68*a^3*b + 15*a^4) /. v2 -> -a^6 - b^6 + 126*(a*b^5 + b*a^5) + 1041*(a^2*b^4 + a^4*b^2) + 1764*a^3*b^3
A correct formula for a>=b is elliplen[a_, b_] := 4*a*EllipticE[Sqrt[1 - b^2/a^2]]
No, elliplen[a_, b_] := 4*a*EllipticE[1 - b^2/a^2] --rwg
On Mon, Sep 26, 2011 at 2:30 PM, Bill Gosper <billgosper@gmail.com> wrote:
David Cantrell to the rescue.
On Mon, Sep 26, 2011 at 3:33 AM, Bill Gosper <billgosper@gmail.com> wrote:
The Wikipedia ellipse article borrows (with the Goldwynism "For computational purposes a much faster series where the denominators vanish at a rate ...") a series from http://www.iamned.com/math/ which offers "A Rapidly converging formula for the circumference of an elipse that gives log (1024/27((a+b)/(a-b))^8) digits per term : ", a formula satisfyingly symmetrical in a and b, but which unfortunately vanishes (instead of 4a) for b=0,
This is an unrelated, 0^0 problem.
and generally fails for b<a.
No, I was using in Mma the formula based [on] Maple's notion of elliptic E. (The old modulus vs parameter confusion.)
Does anybody know what this should be? The Wikipedia article actually
corrects an obvious asymmetry in the iamned.com source, but the Wikigrapher must not have tested it.
Apologies: The Wikipedia formula is correct! (Except possibly at b=0.)
--rwg
This means that EllipticE[1-r^2]==(2 \[Pi] Sum[-1/(n!)^2*432^n (((-1+r)^8 r (1+r)^2)/(1+60 r+134 r^2+60 r^3+r^4)^3)^n (-r (15+68 r+90 r^2+68 r^3+15 r^4)+n (1-126 r-1041 r^2-1764 r^3-1041 r^4-126 r^5+r^6)) Pochhammer[1/12,n] Pochhammer[5/12,n],{n,0,\[Infinity]}])/(1+60 r+134 r^2+60 r^3+r^4)^(5/4) is an impressive acceleration formula for E'(r^2). You might be tempted to object that the k-fold speedup is cancelled by the general term being k times more complicated, but this is not the case. Once r is fixed, this is just a matrix product over n of quadratic/quadratic linear ( ). 1 0 However, it does cost a factor of 2 if you are computing megadigits of E'(nonsquare rational). A correct formula for a>=b is
elliplen[a_, b_] := 4*a*EllipticE[Sqrt[1 - b^2/a^2]]
No, elliplen[a_, b_] := 4*a*EllipticE[1 - b^2/a^2] --rwg
Which is, in fact, (nonobviously) symmetrical in a and b. --rwg
I keep neglecting to write mma2mac. (I do have a pretty good mac2mma.) Also I somewhat cavalierly Copied-as Plain text rather than Input. Nevertheless, Mma successfully read it back, even helpfully offering to strip the > comment markers as I pasted. Try this Macsyma: (c27) ELLIPTIC_E(%PI/2,1+(-1*R^2)) = 2*%PI*(1+60*R+134*R^2+60*R^3+R^4)^((-5)/4)*SUM(-1*432^N*((-1+R)^8*R*(1+R)^2*(1+60*R+134*R^2+60*R^3+R^4)^-3)^N*(-1*R*(15+68*R+90*R^2+68*R^3+15*R^4)+N*(1+(-126*R)+(-1041*R^2)+(-1764*R^3)+(-1041*R^4)+(-126*R^5)+R^6))*N!^-2*POCHHAMMER(1/12,N)*POCHHAMMER(5/12,N),N,0,INF); 2 (d27) elliptic_ec(1 - r ) = - 2 %pi inf ==== \ 1 5 n 8 n n 2 n ( > (--) (--) 432 (r - 1) r (r + 1) / 12 n 12 n ==== n = 0 6 5 4 3 2 (n (r - 126 r - 1041 r - 1764 r - 1041 r - 126 r + 1) 4 3 2 - r (15 r + 68 r + 90 r + 68 r + 15)) 2 4 3 2 3 n /(n! (r + 60 r + 134 r + 60 r + 1) )) 4 3 2 5/4 /(r + 60 r + 134 r + 60 r + 1) (c28) MATFORM(FIRST(INTOSUM(RHS(%))),N); 1 5 8 2 432 (n + --) (n + --) (r - 1) r (r + 1) 12 12 (d28) matrix([------------------------------------------, 2 4 3 2 3 (n + 1) (r + 60 r + 134 r + 60 r + 1) 5 4 3 2 15 r + 68 r + 90 r + 68 r + 15 r - 2 %pi (n - -----------------------------------------------------) 6 5 4 3 2 r - 126 r - 1041 r - 1764 r - 1041 r - 126 r + 1 2 4 3 2 (r + 6 r + 1) (r - 132 r - 250 r - 132 r + 1) 4 3 2 5/4 /(r + 60 r + 134 r + 60 r + 1) ], [0, 1]) (c29) SUBST(0.69105d0,R,LHS(D27)) = DFLOAT(PRUD(SUBST(0.69105d0,R,%),N,0,9)); (d29) 1.33925368878113d0 = [ 3.52840890972259d-78 1.33925368878113d0 ] [ ] [ 0.0d0 1.0d0 ] Note 77.5 digits! rcs>I'm having trouble parsing the EllipticE infinite series formula. Could you clarify if the 432^N is in the numerator or denominator, Numerator(!) Here, I should have used r=2/3 to illustrate the efficiency of the matrix: (c33) SUBST(2/3,R,D28); [ 1 5 59994 ] [ 64800 (n + --) (n + --) 1881502 %pi (n + ------) ] [ 12 12 940751 ] (d33) [ ----------------------- ------------------------ ] [ 2 1/4 ] [ 885012508801 (n + 1) 28803 9601 ] [ ] [ 0 1 ] --rwg rcs> and similarly for the other terms? I suspect I don't understand the grouping of terms in Mma. Rich ---- Quoting Bill Gosper <billgosper@gmail.com <http://gosper.org/webmail/src/compose.php?send_to=billgosper%40gmail.com>>: <clippage -- rcs>
This means that> EllipticE[1-r^2]==(2 \[Pi] Sum[-1/(n!)^2*432^n (((-1+r)^8 r (1+r)^2)/(1+60> r+134 r^2+60 r^3+r^4)^3)^n (-r (15+68 r+90 r^2+68 r^3+15 r^4)+n (1-126> r-1041 r^2-1764 r^3-1041 r^4-126 r^5+r^6)) Pochhammer[1/12,n]> Pochhammer[5/12,n],{n,0,\[Infinity]}])/(1+60 r+134 r^2+60 r^3+r^4)^(5/4)>> is an impressive acceleration formula for E'(r^2).>> You might be tempted to object that the k-fold speedup is cancelled by the> general term being k times more> complicated, but this is not the case. Once r is fixed, this is just a> matrix product over n of>> quadratic/quadratic linear> ( ).> 1 0>> However, it does cost a factor of 2 if you are computing megadigits of> E'(nonsquare rational).>> A correct formula for a>=b is>>> elliplen[a_, b_] := 4*a*EllipticE[Sqrt[1 - b^2/a^2]]>>>>>>> No, elliplen[a_, b_] := 4*a*EllipticE[1 - b^2/a^2]>> --rwg>>> Which is, in fact, (nonobviously) symmetrical in a and b.> --rwg
participants (1)
-
Bill Gosper