This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,3 @@
mean=: +/ % #
(mean , */ %:~ #)^:_] 1,%%:2
0.8472130847939792 0.8472130847939791

View file

@ -0,0 +1,2 @@
~.(mean , */ %:~ #)^:_] 1,%%:2
0.8472130847939792

View file

@ -0,0 +1,6 @@
(mean, */ %:~ #)^:a: 1,%%:2
1 0.7071067811865475
0.8535533905932737 0.8408964152537145
0.8472249029234942 0.8472012667468915
0.8472130848351929 0.8472130847527654
0.8472130847939792 0.8472130847939791

View file

@ -0,0 +1,13 @@
print agm(1, 1/sqr(2))
print using("#.#################",agm(1, 1/sqr(2)))
function agm(a,g)
do
absdiff = abs(a-g)
an=(a+g)/2
gn=sqr(a*g)
a=an
g=gn
loop while abs(an-gn)< absdiff
agm = a
end function

View file

@ -0,0 +1,6 @@
> evalf( GaussAGM( 1, 1 / sqrt( 2 ) ) ); # default precision is 10 digits
0.8472130847
> evalf[100]( GaussAGM( 1, 1 / sqrt( 2 ) ) ); # to 100 digits
0.847213084793979086606499123482191636481445910326942185060579372659\
7340048341347597232002939946112300

View file

@ -0,0 +1,2 @@
> GaussAGM( 1.0, 1 / sqrt( 2 ) );
0.8472130847

View file

@ -0,0 +1,2 @@
PrecisionDigits = 85;
AGMean[a_, b_] := FixedPoint[{ (Plus@@#)/2, Sqrt[Times@@#] }&, N[{a,b}, PrecisionDigits]][[1]]

View file

@ -0,0 +1,4 @@
agm(a, b) := %pi/4*(a + b)/elliptic_kc(((a - b)/(a + b))^2)$
agm(1, 1/sqrt(2)), bfloat, fpprec: 85;
/* 8.472130847939790866064991234821916364814459103269421850605793726597340048341347597232b-1 */