Bill Allombert on Fri, 23 Jul 2021 14:21:09 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Making a polynomial and evaluating it many times from C++


On Fri, Jul 23, 2021 at 10:00:24AM +0000, Neven Sajko wrote:
> FTR, your function for the perimeter of an ellipse is not accurate.
> 
> ? ellipse_perimeter(0.75, 0.25)
> %9 = 3.3412233051388145575
> ? ellperimeter(0.75, 0.25)
> %19 = 3.5553025205101225533
> 
> An independent implementation also agrees with my answer (3.34122...).

Ah sorry, ellperimeter was missing a sqrt when computing the
eccentricity.  Also my script is obsolete since PARI now includes the
function ellE, so now you can just write

ellperimeter(a,b)=4*a*ellE(sqrt(1-(b/a)^2))

which is correct:

? ellperimeter(.75, 0.25)
%7 = 3.3412233051388145575323755812650490598

Cheers,
Bill.