Mercurial > hg > jgplsrc
view test/gpi.ijs @ 0:e0bbaa717f41 draft default tip
lol J
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 25 Nov 2013 11:56:30 -0500 |
parents | |
children |
line wrap: on
line source
NB. pi ------------------------------------------------------------------ NB. pi and the common mean (AGM, arithmetic-geometric mean) NB. see http://www.shef.ac.uk/~puremath/theorems/amgm.html am=: +/ % # gm=: */ %:~ # cm=: [: {. (am,gm)^:_ t=: (am,gm)^:(i.10) 1,%%:2 'a b'=: |: t (o.1) e. (}. 2**:a) % }: 1 - +/\ (2^i.#a) * a-&*:b 4!:55 ;:'a am b cm gm t'