This looks like a computation of the arithmetic-geometric mean (https://en.wikipedia.org/wiki/Arithmetic%E2%80%93geometric_mean). There is an implementation called agm in mpmath. You could also use that for a complete elliptic integral of the first kind.
Kalevi Suominen On Saturday, November 4, 2017 at 3:26:48 AM UTC+2, Panna Lal Patodia wrote: > > I am attaching a new file giving program with comments. I have also made > slight changes so that if parameters are negative, it takes absolute value > and computes perimeter of ellipse correctly. > > On Saturday, November 4, 2017 at 2:41:59 AM UTC+5:30, Panna Lal Patodia > wrote: >> >> I find the following code for perimeter (or circumference of ellipse): >> >> 12*Integral(sqrt((-8*_x**2/9 + 1)/(-_x**2 + 1)), (_x, 0, 1)) >> >> This means the calculation depends on numerical integration which is very >> time consuming. >> >> I am attaching a file containing Python sympy code to calculate numerical >> value of perimeter of ellipse to hundreds of decimal places. It computes >> value of >> perimeter of Ellipse for 800 decimals in less than 1 second on my >> computer. >> >> Please incorporate in sympy after necessary modification if you find it >> suitable. >> >> Regards >> >> Panna Lal Patodia >> [email protected], [email protected] >> >> >> -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/bb3dde70-40de-4576-9e7e-99e29c80e8bb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
