Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3853 by [email protected]: recognize elliptical integrals
http://code.google.com/p/sympy/issues/detail?id=3853
This requires about 2 minutes
Ellipse((0,0),3,1).circumference.n()
13.3648932205553
This is nearly instantaneous
def EllipseCircumference(a, b):
... """
... Compute the circumference of an ellipse with semi-axes a and b.
... Require a >= 0 and b >= 0. Relative accuracy is about 0.5^53.
... """
... import math
... x, y = max(a, b), min(a, b)
... digits = 53; tol = math.sqrt(math.pow(0.5, digits))
... if digits * y < tol * x: return 4 * x
... s = 0; m = 1
... while x - y > tol * y:
... x, y = 0.5 * (x + y), math.sqrt(x * y)
... m *= 2; s += m * math.pow(x - y, 2)
... return math.pi * (math.pow(a + b, 2) - s) / (x + y)
...
EllipseCircumference(3,1)
13.364893220555258
Perhaps recognition of such integrals by integrate/Integral.evalf would be
a good idea.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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 http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.