actually, J lets you approximate pi to as many digits as you'd want, but you have to know the trick:
pix =. ([: <.@:o. 10^x:) _10 ]\ ": pix 100 3141592653 5897932384 6264338327 9502884197 1693993751 0582097494 4592307816 4062862089 9862803482 5342117067 9 gives the first 101 digits of pi (including the initial 3). This is so because it's implemented as special code in J. Somehow, this seems not yet to be documented in NuVoc, but can be found e.g. here: https://code.jsoftware.com/wiki/JPhrases/NumbersCounting pix gives you an extended integer of pi time 10^y, the _10 ]\ ": just does conversion to string, and formatting with 10 digits per line. Jan-Pieter On Sun, 15 May 2022, 10:49 Elijah Stone, <elro...@elronnd.net> wrote: > J has a few different ways of representing numbers, including: > > - Machine integers (limited to 64 or 32 bit); this is what you get if you > type a number like 123 > > - Machine floating-point numbers (limited precision, but can have decimal > points in them); this is what you get if you type a number like 3.45 or 1p1 > > - Extended-precision numbers (unlimited precision, but can only represent > integers and rational numbers); this is what you get if you type a number > like 123x or 3r4 > > You would like an unlimited-precision representation of pi, I assume. But > the > present implementation of j is incapable of this; the only things it can > represent with unlimited precision are integers and rational numbers, and > pi > is irrational. > > Machine representation of irrational numbers is a very interesting topic, > but > it is fraught with tradeoffs and complexities, and the present > implementation > of j does not attempt it. As far as I know, all implementations of apl > have > the same limitation; there, too, ○1 is a floating-point approximation. And > I > do not think most apl implementations even have extended-precision > integers or > rational numbers. > > You might like to look into computer algebra systems (cas), such as > mathematica. > > On Sun, 15 May 2022, yt wrote: > > > > > Dear All, > > i come back to start in J > > > > in jijx>tour>overview > > 3p5 NB. Pi (3 * Pi ^ 5) > > 918.059 > > > > may be it is not the better way to find Pi : > > 1p1 NB. Pi (1 * Pi ^ 1) > > > > 1p1 > > 3.14159 > > 1p1x > > |ill-formed number > > | 1p1x > > | ^ > > > > but this is ok for : > > ^/ 2 3 4 > > 2.41785e24 > > ^/ 2 3 4x > > 2417851639229258349412352 > > 3^4 > > 81 > > 2^81 > > 2.41785e24 > > 2^81x > > 2417851639229258349412352 > > > > why 1p1 is not good ? > > > > i have not this problem in APL > > > > Sorry for the inconvenience > > Regards, > > Yves > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm